4 ms·
Not entirely true. Moving from std::vector is required to not invalidate iterators and references when moved from. This is why strings can be small buffer optim
by leni536 7y ago
Not entirely true. Moving from std::vector is required to not invalidate iterators and references when moved from. This is why strings can be small buffer optimized and vectors can't be.
- zvrba 7y agoThis does not conflict with what I or the OP wrote; you're mixing up the vector and its contents. Moving from a vector can invalidate `data()`, yet references and iterators to its previous contents remain valid.
- steerablesafe 7y agoWell, kccqzy probably meant the pointer returned by data remaining valid, not calling data() again on a moved-from object.