Quantcast
Channel: Am I guaranteed that pointers to std::vector elements are valid after the vector is moved? - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by dyp for Am I guaranteed that pointers to std::vector elements are...

This is LWG open issue 2321 [emphasis mine]Moving containers should (usually) be required to preserve iterators[...][by Stephan T. Lavavej] 23.2.1 [container.requirements.general]/10 says that unless...

View Article



Answer by Anders Abel for Am I guaranteed that pointers to std::vector...

cppreference.com states that:... have the option, but aren't required, to move any resources held by the argument...It looks like std::move just is a hint to the library that an optimization by...

View Article

Am I guaranteed that pointers to std::vector elements are valid after the...

Considering this example:std::vector<int> v1 = { 1, 2, 3 };const int* i = &v1[1];std::vector<int> v2(std::move(v1));std::cout << *i << std::endl;Even though in many STL...

View Article
Browsing latest articles
Browse All 3 View Live




Latest Images