-
July 30th, 2010, 04:59 AM
#1
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.
Reason: typo
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|