If you have a function that returns a value, and you use that function like: int i = function();
Will the value that is returned be copied to int i, or will only the reference of int i be changed to the point where the return value is in the memory?
If so, if you return an array value that is huge, like:
1 2 3 4 5 6
vector<int> function()
{
vector<int> vi;
//some code here to create a huge huge vector..., like 1,000,000 items
return vi;
}
Will then the whole vector be copied to the variable where you want to give it to, or not, as I asked above.