C++: Does implicitly-defined copy constructor bitwise copy?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: C++: Does implicitly-defined copy constructor bitwise copy?

Hybrid View

  1. #1
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,021

    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
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: 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

This is a CodeGuru survey question.


Featured


HTML5 Development Center