Given the following:
Foo getFoo() { Foo result = doSomeWork(); return result; }
Does C ++ guarantee that the result will be moved, not copied? Or, to put it another way, writes return std::move(result) too much?
Are there any (other) situations where the standard indicates that the lvalue will silently move instead of copying, in the absence of an explicit expression std::move ?
Notes:
Suppose Foo is constructive in design.
Refusal to copy / move elision, which can be applied additionally.
source share