Handling Type with <type_traits>
Types Defined in header <type_traits>
Header <type_traits> defines a series of classes to obtain type information at compile-time.
The header contains:
-
Helper classes: Standard classes to assist in creating compile-time constants.
- integral_constant
- true_type
- false_type
-
Type traits: Classes to obtain characteristics of types in the form of compile-time constant values.
- is_array
- is_class
- is_enum
- is_floating_point
- is_function
- is_integral
- is_lvalue_reference
- is_member_function_pointer
- is_member_object_pointer
- is_pointer
- is_rvalue_reference
- is_union
- is_void
-
Composite type categories
- is_arithmetic
- is_compound
- is_fundamental
- is_member_pointer
- is_object
- is_reference
- is_scalar
-
Type transformations: Classes to obtain new types by applying specific transformations to existing types.
- add_const
- add_cv
- add_volatile
- remove_const
- remove_cv
- remove_volatile
Compound type alterations
- add_pointer
- add_lvalue_reference
- add_rvalue_reference
- decay
- make_signed
- make_unsigned
- remove_all_extents
- remove_extent
- remove_pointer
- remove_reference
- underlying_type
Other type generators
- aligned_storage
- aligned_union
- common_type
- conditional
- enable_if
- result_of