No, your obj variable is never redistributed because the members inside it are changing. A vector has its own pointers to its data and processes all its own distributions and redistributions inside.
Think of it this way: Normally, local variables (including full structures and arrays) are pushed onto the stack of the current function. The compiler accesses these variables through an offset from the base address. If the compiler (or system) suddenly began to move the variables in memory, this would greatly complicate access to the variable, as well as significantly affect the speed and efficiency of your program. Therefore, local variables are on the stack and remain where they were supplied by the compiler. The data allocated on the heap (for example, the data inside std::vector ) can be easily moved, because everything that needs to be updated in the data pointer, and, as I said, all this is processed inside the vector object, so nothing to you still would have noticed.
source share