Code:
vector<int> test() {
	vector<int> eg;
        [.......]
	return eg;
}    
vector<int> myvec = test();
Is this copied, or are references implicitly used?

In other words, if eg turns out to have 5000 elements and I call test in a loop a few thousand times, AND eg is created and then copied each time -- this is not so good.

I was hoping the magic of ref counting would mean that I could return a reference to eg, but I guess eg is still just a local variable, so it seems the only way around this is:

Code:
vector<int> *test() {
	vector<int> *eg = new vector<int>();
	return eg;
}
Or have I misunderstood something?