Have the assignment operator be callable on lvalues only:
class C
{
// ...
public:
C& operator=(const C&) & = default;
};
Note the single ampersand after the closing parenthesis. It prevents assigning to rvalues.
Have the assignment operator be callable on lvalues only:
class C
{
// ...
public:
C& operator=(const C&) & = default;
};
Note the single ampersand after the closing parenthesis. It prevents assigning to rvalues.