C++: Does implicitly-defined copy constructor bitwise copy?
Q: Does implicitly-defined copy constructor bitwise (bit by bit) copy?
A: No, it doesn't. The implicitly-defined copy constructor performs memberwise (member by member) copy.
ISO/IEC 14882:1998 Programming languages — C++
The implicitly defined copy constructor for class X performs a memberwise copy of its subobjects. The order of copying is the same as the order of initialization of bases and members in a userdefined constructor (see 12.6.2).
Each subobject is copied in the manner appropriate to its type:
— if the subobject is of class type, the copy constructor for the class is used;
— if the subobject is an array, each element is copied, in the manner appropriate to the element type;
— if the subobject is of scalar type, the builtin assignment operator is used.
Last edited by ovidiucucu; July 30th, 2010 at 06:53 AM.