[class.prop] (original) (raw)

11 Classes [class]

11.2 Properties of classes [class.prop]

A trivially copyable class is a class:

A class C is default-movable if

A class is eligible for trivial relocation unless it

except that it is implementation-defined whether an otherwise-eligible union having one or more subobjects of polymorphic class type is eligible for trivial relocation.

A class C is a trivially relocatable classif it is eligible for trivial relocation and

[Note 1:

A class with const-qualified or reference non-static data members can be trivially relocatable.

— _end note_]

A class C is eligible for replacement unless

A class C is a replaceable class if it is eligible for replacement and

[Note 2:

Accessibility of the special member functions is not considered when establishing trivial relocatability or replaceability.

— _end note_]

[Note 3:

Not all trivially copyable classes are trivially relocatable or replaceable.

— _end note_]

A class S is a standard-layout class if it:

[Example 1: struct B { int i; }; struct C : B { }; struct D : C { }; struct E : D { char : 4; }; struct Q {};struct S : Q { };struct T : Q { };struct U : S, T { }; — _end example_]

[Note 5:

Standard-layout classes are useful for communicating with code written in other programming languages.

— _end note_]

[Example 2: struct N { int i;int j;virtual ~N();};struct T { int i;private: int j;};struct SL { int i;int j;~SL();};struct POD { int i;int j;}; — _end example_]

A class S is an implicit-lifetime class if