61
Lets say we have the following code:
std::vector<int> f()
{
std::vector<int> y;
...
return y;
}
std::vector<int> x = ...
x = f();
It seems the compiler has two approaches here:
(a) NRVO: Destruct x, then construct f() in place of x.
(b) Move: Construct f() in temp space, move f() into x, destruct f().
Is the compiler free to use either approach, according to the standard?