Reputation: 251
Is there a way to actually see (output to file, console etc) implicit compiler generated or = default
methods (in C++
)?
(Target compilers: vc, clang, gcc)
I'd like to see how these functions are actually implemented. For example, how does the assignment operator assigns its values, does it check for self assignment, is const correctness given etc). I did not found any statisfying result on the www that actually shows the implementations of these compiler generated functions.
Upvotes: 1
Views: 159
Reputation: 30605
The semantics of the "special member" functions are defined by the C++ standard, in section 12
In brief, they do what you think they do;
If, for some reason, one of them would violate a const
correctness or the corresponding constructor or assignment of the base or members is not available, or some other issue arrises, then that special member is not declared.
An an additional note; there are specific rules that apply to the defaults if one (or some) of the special members are defined by the user (detailed here).
Upvotes: 1