CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Threaded View

  1. #1
    Join Date
    Feb 2003
    Iasi - Romania

    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
    "When in Rome, do as Romans do."
    My latest articles: http://codexpert.ro/blog/author/ovidiu-cucu/

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.