Is returning by rvalue reference more efficient?
Beta_ab&& Beta::toAB() const { return move(Beta_ab(1, 1)); } This returns a dangling reference, just like with the lvalue reference case. After the function returns, the temporary object will get destructed. You should return Beta_ab by value, like the following Beta_ab Beta::toAB() const { return Beta_ab(1, 1); } Now, it’s properly moving a temporary Beta_ab object … Read more