I just found some code in Boost paraphrased as the following:
class A {};
class B {
public:
B(A a): a_(std::move(a)) {}
private:
A a_;
};
int main() {
A a;
B b(std::move(a));
}
Assuming this works, why use move constructor/assignment with an rvalue reference? Or does a move constructor/assignment just save you the trouble of a second std::move()
call?