On Sat, 18 Nov 2006, loufoque wrote:
Thomas Grund wrote:
If I store an iterator to a std::vector and then push_back some elements
then the iterator is not valid anymore since the internal data of the vector
is reallocated.
Why not store the position instead since vectors give random access for O(1) ?
My question is concerning the map case. I want to build up some sparse
matrix structure. For this case I would like to have O(1) access to some
elements.
The example with the vector was just to tell that I am aware of possible
problems with using iterators.
Thomas