If I return a gigantic vector of integers from a function, am I better off just passing a reference to the function instead and having it filled that way? I'm wondering if returning a vector that takes up a very large amount of memory is a problem.
for example:
Code:
vector<int> getPrimes()
{
vector<int> primes;
//FILL vector<int> with a bajillion integers
return primes;
}
void getPrimes(vector<int>& primes)
{
//FILL vector<int> with a bajillion integers
}
Is there any difference whatsoever? (besides programming style)