Oh, ok. It sure shows I'm not a C++ language lawyer... :)
Alexander Nickolov <agnickolov@mvps.org> wrote:
Are you sure about that?
C++ standard:
12.8/8 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 user-defined 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 built-in assignment operator
is used.
Virtual base class subobjects shall be copied only once by the
implicitly-defined copy constructor (see 12.6.2).
12.8/13 The implicitly-defined copy assignment operator for class X
performs memberwise assignment of its subobjects. The direct base classes
of X are assigned first, in the order of their declaration in the
base-specifier-list, and then the immediate nonstatic data members of X
are assigned, in the order in which they were declared in the class
definition. Each subobject is assigned in the manner appropriate to its
type:
- if the subobject is of class type, the copy assignment operator for
the class is used (as if by explicit qualification; that is, ignoring any
possible virtual overriding functions in more derived classes);
- if the subobject is an array, each element is assigned, in the manner
appropriate to the element type;
- if the subobject is of scalar type, the built-in assignment operator
is used.
It is unspecified whether subobjects representing virtual base classes are
assigned more than once by the implicitly-defined copy assignment
operator.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925