Hello.
A non-modifying algorithm I implemented uses two associative containers
from STL: set and map. The elements on those containers are supposed to
refer to actual elements which lie on another, bigger container.
I had the definition of my auxiliary containers based on pointers, but
considered using iterators instead. I know iterators might become
invalid upon certain operations, but as I said, the algorithm is
non-modifying. This is a snippet of what I was trying:
set<int> s;
typedef set<int>::iterator ITER;
s.insert(1);
set<ITER> t;
t.insert(s.begin());
In spite of my attempts, I could not get the code to work when using
iterators as keys for the associative containers. This probably has
good, obvious reasons, which are not clear to me at the moment. Would
anybody be so kind to explain that which I am missing?
Thank you,
--
Ney André de Mello Zunino