What does std::vector look like in memory?
It roughly looks like this (excuse my MS Paint masterpiece): The std::vector instance you have on the stack is a small object containing a pointer to a heap-allocated buffer, plus some extra variables to keep track of the size and and capacity of the vector. So it seems as though when I push_back() to the … Read more