When i put the class in the vector and define the move operator, i can see that the values are moved when the vector is reallocated.
if So, does it move if you add an integer instead of a class and reallocate it?
When i put the class in the vector and define the move operator, i can see that the values are moved when the vector is reallocated.
if So, does it move if you add an integer instead of a class and reallocate it?
Fundamental types such as integers don't have any constructors. As such, they don't have move constructors. As such, they are not "moved". The algorithm may still use std::move
to convert the operand of the assignment into an xvalue, but that is still a copy assignment.
Conceptually, a move is a shallow copy, with added enforcement of class invariants. Integer is not a referential type, so there is no distinction between shallow and deep copy. It is also not a class and has no invariants.