From RAD Studio
Jump to: navigation, search

Go Up to Type Trait Functions (C++11) Index


Type Trait Functions


bool __has_trivial_copy_constructor ( typename T )

Returns true if and only if T has a trivial default constructor.

Error if T is an incomplete type.

False (but well-formed) if a class type does not have a default constructor

The definition (from Section of the Working Draft) notes has a type T has a trivial copy constructor if it is in the list::

  • a scalartype (or array thereof)
  • a reference type (or array thereof)
  • an array of class type with trivial destructor
  • a class type with a trivial copy constructor (12.8)

According to Section 12.8 p6 of the Working Draft:

A copy constructor for class X is trivial if:

  • It is not user provided (see Section 8.4)
  • class X has no virtual functions
  • class X has no virtual base classes
  • each direct base class of X has a trivial copy constructor.
  • for all the non-static data members of X that are of class type (or array thereof), each such class type has a trivial copy constructor;.

A copy constructor is not user provided if it is implicitly declared, or defined inline as = default;

Ox interaction false if the default constructor is defined as deleted.

Ox interactionwith default function definitions.

See Also