Assume there is a class A that contains a vector of ints. Now assume that a vector of A\'s is created. If a reallocation of an A object occurs (so the vector object is moved) du
It would depend of your move constructor of A
.
but as it (*), it will use move constructor of vector
for a
, and according to http://www.cplusplus.com/reference/vector/vector/vector/
[..] no elements are constructed (their ownership is directly transferred).
So pointers to the ints themselves remain valid.
Edit: (*) A
should be noexcept
for that, and std::vector
is not guaranteed to be noexcept
.