A C++ wiki book refers to
... In C++0x, such an assignment operator is known as a unifying assignment operator because it eliminates the need to write two different assignment operators ...
for an assignment operator that takes it's class type by value:
String & operator = (String s) // the pass-by-value parameter serves as a temporary
{
s.swap (*this); // Non-throwing swap
return *this;
}
I tried googling the term, but it doesn't appear to be in widespread use.
Where does it come from?
It appears to be in reference to the unification that takes place in formal type systems. The thought is if the r- and l-values can be brought to the same type (unified) by only certain, legal substitutions, then the assignment is well-formed.
Wikipedia claims the idea was first given meaningful attention (and possibly its name) by John Alan Robinson.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With