gcc: Type Traits
1
1 7.9 Type Traits
1 ===============
1
1 The C++ front end implements syntactic extensions that allow
1 compile-time determination of various characteristics of a type (or of a
1 pair of types).
1
1 '__has_nothrow_assign (type)'
1 If 'type' is const qualified or is a reference type then the trait
1 is false. Otherwise if '__has_trivial_assign (type)' is true then
1 the trait is true, else if 'type' is a cv class or union type with
1 copy assignment operators that are known not to throw an exception
1 then the trait is true, else it is false. Requires: 'type' shall
1 be a complete type, (possibly cv-qualified) 'void', or an array of
1 unknown bound.
1
1 '__has_nothrow_copy (type)'
1 If '__has_trivial_copy (type)' is true then the trait is true, else
1 if 'type' is a cv class or union type with copy constructors that
1 are known not to throw an exception then the trait is true, else it
1 is false. Requires: 'type' shall be a complete type, (possibly
1 cv-qualified) 'void', or an array of unknown bound.
1
1 '__has_nothrow_constructor (type)'
1 If '__has_trivial_constructor (type)' is true then the trait is
1 true, else if 'type' is a cv class or union type (or array thereof)
1 with a default constructor that is known not to throw an exception
1 then the trait is true, else it is false. Requires: 'type' shall
1 be a complete type, (possibly cv-qualified) 'void', or an array of
1 unknown bound.
1
1 '__has_trivial_assign (type)'
1 If 'type' is const qualified or is a reference type then the trait
1 is false. Otherwise if '__is_pod (type)' is true then the trait is
1 true, else if 'type' is a cv class or union type with a trivial
1 copy assignment ([class.copy]) then the trait is true, else it is
1 false. Requires: 'type' shall be a complete type, (possibly
1 cv-qualified) 'void', or an array of unknown bound.
1
1 '__has_trivial_copy (type)'
1 If '__is_pod (type)' is true or 'type' is a reference type then the
1 trait is true, else if 'type' is a cv class or union type with a
1 trivial copy constructor ([class.copy]) then the trait is true,
1 else it is false. Requires: 'type' shall be a complete type,
1 (possibly cv-qualified) 'void', or an array of unknown bound.
1
1 '__has_trivial_constructor (type)'
1 If '__is_pod (type)' is true then the trait is true, else if 'type'
1 is a cv class or union type (or array thereof) with a trivial
1 default constructor ([class.ctor]) then the trait is true, else it
1 is false. Requires: 'type' shall be a complete type, (possibly
1 cv-qualified) 'void', or an array of unknown bound.
1
1 '__has_trivial_destructor (type)'
1 If '__is_pod (type)' is true or 'type' is a reference type then the
1 trait is true, else if 'type' is a cv class or union type (or array
1 thereof) with a trivial destructor ([class.dtor]) then the trait is
1 true, else it is false. Requires: 'type' shall be a complete type,
1 (possibly cv-qualified) 'void', or an array of unknown bound.
1
1 '__has_virtual_destructor (type)'
1 If 'type' is a class type with a virtual destructor ([class.dtor])
1 then the trait is true, else it is false. Requires: 'type' shall
1 be a complete type, (possibly cv-qualified) 'void', or an array of
1 unknown bound.
1
1 '__is_abstract (type)'
1 If 'type' is an abstract class ([class.abstract]) then the trait is
1 true, else it is false. Requires: 'type' shall be a complete type,
1 (possibly cv-qualified) 'void', or an array of unknown bound.
1
1 '__is_base_of (base_type, derived_type)'
1 If 'base_type' is a base class of 'derived_type' ([class.derived])
1 then the trait is true, otherwise it is false. Top-level cv
1 qualifications of 'base_type' and 'derived_type' are ignored. For
1 the purposes of this trait, a class type is considered is own base.
1 Requires: if '__is_class (base_type)' and '__is_class
1 (derived_type)' are true and 'base_type' and 'derived_type' are not
1 the same type (disregarding cv-qualifiers), 'derived_type' shall be
1 a complete type. A diagnostic is produced if this requirement is
1 not met.
1
1 '__is_class (type)'
1 If 'type' is a cv class type, and not a union type
1 ([basic.compound]) the trait is true, else it is false.
1
1 '__is_empty (type)'
1 If '__is_class (type)' is false then the trait is false. Otherwise
1 'type' is considered empty if and only if: 'type' has no non-static
1 data members, or all non-static data members, if any, are
1 bit-fields of length 0, and 'type' has no virtual members, and
1 'type' has no virtual base classes, and 'type' has no base classes
1 'base_type' for which '__is_empty (base_type)' is false. Requires:
1 'type' shall be a complete type, (possibly cv-qualified) 'void', or
1 an array of unknown bound.
1
1 '__is_enum (type)'
1 If 'type' is a cv enumeration type ([basic.compound]) the trait is
1 true, else it is false.
1
1 '__is_literal_type (type)'
1 If 'type' is a literal type ([basic.types]) the trait is true, else
1 it is false. Requires: 'type' shall be a complete type, (possibly
1 cv-qualified) 'void', or an array of unknown bound.
1
1 '__is_pod (type)'
1 If 'type' is a cv POD type ([basic.types]) then the trait is true,
1 else it is false. Requires: 'type' shall be a complete type,
1 (possibly cv-qualified) 'void', or an array of unknown bound.
1
1 '__is_polymorphic (type)'
1 If 'type' is a polymorphic class ([class.virtual]) then the trait
1 is true, else it is false. Requires: 'type' shall be a complete
1 type, (possibly cv-qualified) 'void', or an array of unknown bound.
1
1 '__is_standard_layout (type)'
1 If 'type' is a standard-layout type ([basic.types]) the trait is
1 true, else it is false. Requires: 'type' shall be a complete type,
1 (possibly cv-qualified) 'void', or an array of unknown bound.
1
1 '__is_trivial (type)'
1 If 'type' is a trivial type ([basic.types]) the trait is true, else
1 it is false. Requires: 'type' shall be a complete type, (possibly
1 cv-qualified) 'void', or an array of unknown bound.
1
1 '__is_union (type)'
1 If 'type' is a cv union type ([basic.compound]) the trait is true,
1 else it is false.
1
1 '__underlying_type (type)'
1 The underlying type of 'type'. Requires: 'type' shall be an
1 enumeration type ([dcl.enum]).
1
1 '__integer_pack (length)'
1 When used as the pattern of a pack expansion within a template
1 definition, expands to a template argument pack containing integers
1 from '0' to 'length-1'. This is provided for efficient
1 implementation of 'std::make_integer_sequence'.
1