Can I write both copy and move assignment operators for a class?
These are my prototypes, MyClass& operator=(MyClass rhs); // copy assignment MyClass& operator=(MyClass &&rhs); // move assignment But when I call MyClass a, b; a = std::move(b); , there is an error. 556 IntelliSense: more than one operator "=" matches these operands: function "MyClass::operator=(MyClass rhs)" function "MyClass::operator=(MyClass &&rhs)" operand types are: MyClass = MyClass And the compiler returns: Error 56 error C2593: 'operator =' is ambiguous Overload resolution is ambiguous because when you pass an rvalue, both MyClass and MyClass && can be directly initialised by it. If