If I have a function that returns some object like
std::vector<int> foo()
{
std::vector<int> v;
v.push_back(1);
return v;
}
then what's the difference between saying
std::vector<int> &&v = foo();
and
std::vector<int> v = foo();
?
(Why) would I prefer either over the other?
(I suspect this might be a duplicate question, but I couldn't find the right search terms.)