N
n.torrey.pines
If I insert and delete elements in a std::list, does the standard
guarantee that the pointers to the intact elements remain valid? If so,
where?
Example:
list<int> lst;
lst.push_back(1);
lst.push_back(2);
lst.push_back(3);
lst.push_back(4);
int* p = &(++lst.begin()); // *p == 2
lst.remove(3);
lst.push_front(5);
lst.resize(10);
assert(*p == 2); // guaranteed ?
guarantee that the pointers to the intact elements remain valid? If so,
where?
Example:
list<int> lst;
lst.push_back(1);
lst.push_back(2);
lst.push_back(3);
lst.push_back(4);
int* p = &(++lst.begin()); // *p == 2
lst.remove(3);
lst.push_front(5);
lst.resize(10);
assert(*p == 2); // guaranteed ?