Who coined the term unified (or unifying) assignment operator?

A C ++ wiki book refers to

... In C ++ 0x, such an assignment operator is known as a union assignment operator because it eliminates the need to write two different assignment operators ...

for an assignment operator that takes its 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 to use this term, but it seems it is not widely used.

Where is he from?

+7
source share
2 answers

This seems to refer to unification , which takes place in formal systems. The idea is that r- and l-values โ€‹โ€‹can be reduced to the same type (unified) only with the help of certain legal permutations, then the task is well-formed.

Wikipedia claims that the idea was first introduced by the meaningful attention (and perhaps its name) of John Alan Robinson .

+4
source

I'm not sure who formulated this, but the wiki is wrong. The word โ€œunificationโ€ appears exactly at zero time in the C ++ 0x standard โ€œstandardโ€ (currently you really should use the phrase โ€œC ++ 11โ€, it was approved in August 2011).

The correct term is a copy. From C ++ 0x (n3242, the latter I can get without shelling money), section 12.8 Copying and moving class objects, /34 :

When certain criteria are met, the implementation allows you to omit the copy / move construct of the class object, even if the copy / move constructor and / or destructor for the object have side effects.

In such cases, the implementation considers the source and purpose of the missed copy / move operation as just two different ways of accessing the same object, and the destruction of this object occurs at later times when two objects would be destroyed without optimization.

This exclusion of copy / move operations, called elision copy , is allowed in the following cases (which can be combined to eliminate multiple copies) ...

+1
source

All Articles