Reference

<type_traits>

header

<type_traits>

type_traits
This header defines a series of classes to obtain type information on compile-time.

The header contains:
  • Helper classes: Standard classes to assist in creating compile-time constants.
  • Type traits: Classes to obtain characteristics of types in the form of compile-time constant values.
  • Type transformations: Classes to obtain new types by applying specific transformations to existing types.

A basic trait for types is the categories in which they can be classified. This is a chart on how these categories overlap:
primary categoriescomposite categories
fundamental void
std::nullptr_tscalar object
integral arithmetic
floating point
compound pointer
member object pointer member pointer
member function pointer
enum
union
class *
array
l-value reference reference
r-value reference
function
* = excluding unions

Helper classes

integral_constant
Integral constant (class template)
true_type
True type (class)
false_type
False type (class)

Type traits

Primary type categories

is_array
Is array (class template)
is_class
Is non-union class (class template)
is_enum
Is enum (class template)
is_floating_point
Is floating point (class template)
is_function
Is function (class template)
is_integral
Is integral (class template)
is_lvalue_reference
Is lvalue reference (class template)
is_member_function_pointer
Is member function pointer (class template)
is_member_object_pointer
Is member object pointer (class template)
is_pointer
Is pointer (class template)
is_rvalue_reference
Is rvalue reference (class template)
is_union
Is union (class template)
is_void
Is void (class template)

Composite type categories

is_arithmetic
Is arithmetic type (class template)
is_compound
Is compound type (class template)
is_fundamental
Is fundamental type (class template)
is_member_pointer
Is member pointer type (class template)
is_object
Is object type (class template)
is_reference
Is reference type (class template)
is_scalar
Is scalar type (class template)

Type properties

is_abstract
Is abstract class (class template)
is_const
Is const-qualified (class template)
is_empty
Is empty class (class template)
is_literal_type
Is literal type (class template)
is_pod
Is POD type (class template)
is_polymorphic
Is polymorphic (class template)
is_signed
Is signed type (class template)
is_standard_layout
Is standard-layout type (class template)
is_trivial
Is trivial type (class template)
is_trivially_copyable
Is trivially copyable (class template)
is_unsigned
Is unsigned type (class template)
is_volatile
Is volatile-qualified (class template)

Type features

has_virtual_destructor
Has virtual destructor (class template)
is_assignable
Is assignable (class template)
is_constructible
Is constructible (class template)
is_copy_assignable
Is copy assignable (class template)
is_copy_constructible
Is copy constructible (class template)
is_destructible
Is destructible (class template)
is_default_constructible
Is default constructible (class template)
is_move_assignable
Is move assignable (class template)
is_move_constructible
Is move constructible (class template)
is_trivially_assignable
Is trivially assignable (class template)
is_trivially_constructible
Is trivially constructible (class template)
is_trivially_copy_assignable
Is trivially copy assignable (class template)
is_trivially_copy_constructible
Is trivially copy constructible (class template)
is_trivially_destructible
Is trivially destructible (class template)
is_trivially_default_constructible
Is trivially default constructible (class template)
is_trivially_move_assignable
Is trivially move assignable (class template)
is_trivially_move_constructible
Is trivially move constructible (class template)
is_nothrow_assignable
Is assignable throwing no exceptions (class template)
is_nothrow_constructible
Is constructible throwing no exceptions (class template)
is_nothrow_copy_assignable
Is copy assignable throwing no exceptions (class template)
is_nothrow_copy_constructible
Is copy constructible throwing no exceptions (class template)
is_nothrow_destructible
Is nothrow destructible (class template)
is_nothrow_default_constructible
Is default constructible throwing no exceptions (class template)
is_nothrow_move_assignable
Is move assignable throwing no exception (class template)
is_nothrow_move_constructible
Is move constructible throwing no exceptions (class template)

Type relationships

is_base_of
Is base class of (class template)
is_convertible
Is convertible (class template)
is_same
Is same type (class template)

Property queries

alignment_of
Alignment of (class template)
extent
Array dimension extent (class template)
rank
Array rank (class template)


Type transformations

Const-volatile qualifications

add_const
Add const qualification (class template)
add_cv
Add const volatile qualification (class template)
add_volatile
Add volatile qualification (class template)
remove_const
Remove const qualification (class template)
remove_cv
Remove cv qualification (class template)
remove_volatile
Remove volatile qualification (class template)

Compound type alterations

add_pointer
Add pointer (class template)
add_lvalue_reference
Add lvalue reference (class template)
add_rvalue_reference
Add rvalue reference (class template)
decay
Decay type (class template)
make_signed
Make signed (class template)
make_unsigned
Make unsigned (class template)
remove_all_extents
Remove all array extents (class template)
remove_extent
Remove array extent (class template)
remove_pointer
Remove pointer (class template)
remove_reference
Remove reference (class template)
underlying_type
Underlying type of enum (class template)

Other type generators

aligned_storage
Aligned storage (class template)
aligned_union
Aligned union (class template)
common_type
Common type (class template)
conditional
Conditional type (class template)
enable_if
Enable type if condition is met (class template)
result_of
Result of call (class template)

AltStyle によって変換されたページ (->オリジナル) /