Can someone explain why the move assignment operator is (usually) declared as
Foo& operator=(Foo&&);
Why return a reference and not e.g. Foo
or Foo&&
? I understand why we want this for the regular assignment operator, due to associativeness rules as (a=b)=c
being logically broken (although still compilable) if not returned by reference, but why is this the case when the RHS is a rvalue (xvalue/prvalue)?