__is_trivial
Go Up to Type Trait Functions (C++11) Index
Category
Type Trait Functions
Syntax
bool __is_trivial( typename T )
Returns true if and only if T is a trivial type.
Error if T is an incomplete type.
Trivial types are defined in Section 3.9 p10 of the Working Draft.
Trivial classes are defined in Section 9 p5 of the Working Draft.
Returns true if T is both const and volatile qualified.
A type is trivial if it is:
- a scalar type
- an array of trivial types
- a class/union type where all 4 special members are trivial:
- default constructor
- copy constructor
- copy assignment operator
- destructor
Consult this online help for the definition of each __has_trivial_* traits.
Trivial types trigger several special clauses in the standard, which may affect code generation and optimizations, or simply whether certain constructs are undefined.
Note that trivial types are a generalization of PODs (plain old data objects) in the 2003 standard, if the POD/trivial refinement has not happened when this type function is initially implanted.