I just noticed that for vector push_back this returns a reference to the element.
void push_back ( const T& x );
My question is: has the memory layout changed after push_back?
For example, I have the first array that contains five elements and the layout is as follows.
| | | | | |
| A1 | A2 | A3 | A4 | A5 |
Now I have a vector v
v.push_back(A3)
Now, what does memory look like?
How does a vector store elements here?
How does a vector access an element?
source
share