Original Post
If you do the following: At the end of the main function, will a have size 100, and will it contain values 0 through 99? In the bla function, w is created and filled with values 0 through 99. Then v is set to w. Is the memory of w copied over to v, or do v and w share the same memory? And when the function bla is done and we're back in main, w has gone out of scope, so if the memory of w is then destroyed, what happens to that of a?
void bla(std::vector<int> &v)
{
std::vector<int> w;
for(int i = 0; i < 100; i++) w.push_back(i);
v = w;
}
int main(...)
{
std::vector<int> a;
bla(a);
}