2. The Problem
void foo(Object && object)
{
// Should we apply std::move
// to the object member?
consume( std::move(object.member) );
// or to the object itself?
consume( std::move(object).member );
}
Note that it’s all related to std::forward as well.
6. Sometimes it may be really different
Slice from a tuple. Member that are rvalues are moved:
auto tuple = hana::make_tuple("abc"s, "def"s,
"ghi"s, "jkl"s);
consume(hana::slice_c<0, 2>(std::move(tuple)));
consume(hana::slice_c<2, 4>(std::move(tuple)));
Applying std::move at the last step is useless, members are already copied inside
slice:
consume(std::move(hana::slice_c<0, 2>(tuple))); // copy
Another example where behavior may differ is ref-qualified methods.