Say I have the following:
std::vector<int> myints;
and then I have a function that returns an 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 then do:
myints = GiveNumbers();
would doing this safely make it so that myints has the numbers 0 to 49 in it and nothing else? Would doing this clear what could have been in myints previously? If not whats the proper way to do this?
Thanks