Can anyone explain this statement from ISO N3242 §3.2, 2nd point
A non-placement allocation or
deallocation function for a class is
odr-used by the definition of a
constructor of that class. A
non-placement deallocation function
for a class is odr-usedby the
definition of the destructor of that
class, or by being selected by the
lookup at the point of definitionof a
virtual destructor (12.4).26 A
copy-assignment function for a class
is odr-used by an implicitly-defined
copy-assignment function for another
class as specified in 12.8. A
move-assignment function for a class
is odr-used by an implicitly-defined
move-assignment function for another
class as specified in 12.8.
ISO Standard 2003 says:
A copy-assignment function for a class
is used by an implicitly-defined
copy-assignment function for another
class as specified in 12.8.
What is the actual difference in these statements?
Any one explain the above added point in terms of example/program…?
I know move constructor / move assigment function –>new feature added .
Can any one explain this with the help of an example/program?
please………….
please………. answer
The rationale for this addition, with examples can be found here. In short, it is a clarification of exactly when an allocation/deallocation function for a class needs to be defined.
The (C++03) One Definition Rule requires that every variable or function that is used in the program, for a very specific definition of “use”, must have exactly one definition.
Therefore, a description of when a (de)allocation function is considered “used”, also mandates when a definition is required.
To avoid confusion between the general meaning of the word “use”, and the meaning of “use” as defined in ODR, the word “use” has been replaced with “odr-use” whenever the second meaning is intended.