Your link describing the potential implementations of an assignment operator described class_name& class_name::operator=(class_name)
as:
Typical declaration of a copy assignment operator when copy-and-swap idiom can be used
And class_name& class_name::operator=(const class_name&)
as:
Typical declaration of a copy assignment operator when copy-and-swap idiom cannot be used
Basically we would always want to use copy-and-swap when possible, as mentioned in the excellent answer to your linked question, because it will pass the self-assignment test.
So now the question is why the convention mentioned on http://www.cppreference.com?
Let's say I'm implementing a copy constructor to a virtual class, and I want to make it clear to anyone who will inherit that they should use the copy-and-swap idiom. How would I do that? I could help them by doing the copy for them in the initial call:
class_name& class_name::operator=(class_name)
This is a copy by value, so the implementer of any child classes would see that I've already made the copy for them so all they'll need to do is swap.
Now, what if I had a class_name
which contained a member which could not be copy constructed, for example what if my class has a unique_ptr
such that it cannot be copy-constructed. I can indicate that by not making a copy by value argument to the assignment operator, for example:
class_name& class_name::operator(const class_name&)
Indicating it will be on implementer of any child classes to ensure that sufficient checking is done to pass the self-assignment test.