When using C ++ STL containers, under what conditions do I need to access reference values? For example, are any links invalid after the next function call to the container?
{ std::vector<int> vector; vector.push_back (1); vector.push_back (2); vector.push_back (3); vector[0] = 10;
I understand that in most stl implementations this will work, but I'm interested in what a standard declaration requires.
- edit: I'm interested because I wanted to try STXXL ( http://stxxl.sourceforge.net/ ) for C ++, but I realized that the links returned by the containers were not constant over multiple reads and therefore incompatible without making changes (as if superficially) to my existing stl code. Example:
{ std::vector<int> vector; vector.push_back (1); vector.push_back (2); int& refA = vector[0]; int& refB = vector[1];
I just wanted to know if this means that the STXXL containers where are not 100% compatible, or really, if I used the STL containers all the time in an unsafe / implementation-dependent way.
c ++ stl
Akusete
source share