Say I have the following:
std::vector<int> myints;
and then I have a function that returns int vector:
std::vector<int> GiveNumbers()
{
std::vector<int> numbers;
for(int i = 0; i < 50; ++i)
{
numbers.push_back(i);
}
return numbers;
}
could i do the following:
myints = GiveNumbers();
would it be safe to make myints have numbers from 0 to 49 in it and nothing more? Understand what could be in the past? If not, what is the way to do this?
thank
source
share