type_traits

标准库标头<type[医]性状>

此标头是类型支撑图书馆。

*。

帮助者类

积分[医]恒博[医]常数%28C++11%29%28C++17%29指定类型的编译时常数,指定值%28类模板%29

千真万确[医]STD类型::整型[医]常数<bool,true>

假的[医]STD类型::整型[医]常数<bool,false>

主要类型类别

是[医]空%28C++11%29检查一个类型是否为空%28类模板%29

是[医]零[医]指针%28C++14%29检查类型是否为std::nullptr[医]T%28类模板%29

是[医]整数%28C++11%29检查类型是否为整型%28类模板%29

是[医]浮[医]点%28C++11%29检查类型是否为浮点数类型%28类模板%29

是[医]数组%28C++11%29检查类型是否为数组类型%28类模板%29

是[医]枚举%28C++11%29检查类型是否为枚举类型%28类模板%29

是[医]UNION%28C++11%29检查类型是否为联合类型%28类模板%29

是[医]类%28C++11%29检查某个类型是否为不合并类类型%28类模板%29。

是[医]函数%28C++11%29检查类型是否为函数类型%28类模板%29

是[医]指针%28C++11%29检查类型是否为指针类型%28类模板%29

是[医]洛值[医]引用%28C++11%29检查类型是否为lvalue引用%28class模板%29

是[医]r值[医]引用%28C++11%29检查类型是否为rvalue引用%28class模板%29

是[医]成员[医]对象[医]指针%28C++11%29检查类型是否是指向非静态成员对象%28类模板%29的指针。

是[医]成员[医]功能[医]指针%28C++11%29检查类型是否是指向非静态成员函数%28类模板%29的指针。

复合类型范畴

是[医]基本%28C++11%29检查一个类型是否是基本类型%28类模板%29

是[医]算术%28C++11%29检查一个类型是否是算术类型%28class模板%29

是[医]标量%28C++11%29检查类型是否为标量类型%28类模板%29

是[医]对象%28C++11%29检查类型是否为对象类型%28类模板%29

是[医]化合物%28C++11%29检查一个类型是否为复合类型%28类模板%29

是[医]引用%28C++11%29检查类型是否为lvalue引用或rvalue引用%28class模板%29

是[医]成员[医]指针%28C++11%29检查类型是否是指向非静态成员函数或对象%28类模板%29的指针。

类型属性

是[医]Const%28C++11%29检查类型是否为Const-合格%28类模板%29

是[医]挥发性%28C++11%29检查一个类型是否易失性-合格%28类模板%29

是[医]普通%28C++11%29检查类型是否为平凡%28类模板%29

是[医]琐碎[医]可复制%28C++11%29检查某类型是否可以复制%28类模板%29

是[医]标准[医]布局%28C++11%29检查某一类型是否为标准类型-布局类型%28类模板%29

是[医]POP%28C++11%29检查一个类型是否为旧数据%28POD%29类型%28class模板%29

是[医]文字[医]类型%28C++11%29%28在C++17%29中不建议使用,检查类型是否为文字类型%28class模板%29

有[医]独树一帜[医]对象[医]表示%28C++17%29检查类型%27s对象表示中的每一位是否有助于其值%28类模板%29

是[医]空的%28C++11%29检查类型是否为类%28,但不检查联合%29类型,并且没有数据%28类模板%29

是[医]多态%28C++11%29检查某一类型是否为多态类类型%28类模板%29

是[医]摘要%28C++11%29检查某个类型是否为抽象类类型%28类模板%29

是[医]最后%28C++14%29检查类型是否为最终类类型%28类模板%29

是[医]聚合%28C++17%29检查类型是否为聚合类型%28类模板%29

是[医]签名%28C++11%29检查类型是否有符号算术类型%28类模板%29

是[医]无符号%28C++11%29检查类型是否为无符号算术类型%28class模板%29

支助的业务

*。

是[医]构造性[医]琐碎[医]构造性[医]无抛[医]可构造的%28C++11%29%28C+11%29%28C+11%29检查类型是否具有特定参数的构造函数%28类模板%29

是[医]违约[医]构造性[医]琐碎[医]违约[医]构造性[医]无抛[医]违约[医]可构造的%28C++11%29%28C+11%29%28C+11%29检查类型是否具有默认构造函数%28类模板%29

是[医]复制[医]构造性[医]琐碎[医]复制[医]构造性[医]无抛[医]复制[医]可构造%28C++11%29%28C+11%29%28C+11%29检查类型是否具有复制构造函数%28class模板%29

是[医]移动[医]构造性[医]琐碎[医]移动[医]构造性[医]无抛[医]移动[医]可构造%28C++11%29%28C+11%29%28C+11%29检查是否可以从rvalue引用%28class模板%29构造类型

是[医]可分配[医]琐碎[医]可分配[医]无抛[医]可分配%28C++11%29%28C+11%29%28C+11%29检查类型是否有特定参数%28类模板%29的赋值运算符

是[医]复制[医]可分配[医]琐碎[医]复制[医]可分配[医]无抛[医]复制[医]可分配%28C++11%29%28C+11%29%28C+11%29检查类型是否有副本赋值操作符%28类模板%29

是[医]移动[医]可分配[医]琐碎[医]移动[医]可分配[医]无抛[医]移动[医]可分配%28C++11%29%28C+11%29%28C+11%29检查类型是否有移动赋值操作符%28class模板%29

是[医]破坏性[医]琐碎[医]破坏性[医]无抛[医]可销毁%28C+11%29%28C+11%29%28C+11%29检查类型是否具有非删除的析构函数%28类模板%29

有[医]虚拟[医]析构函数%28C++11%29检查类型是否具有虚拟析构函数%28类模板%29

是[医]可互换[医]威斯[医]可换[医]无抛[医]可互换[医]威斯[医]无抛[医]可交换%28C+17%29%28C+17%29%28C++17%29%28C+17%29检查类型的对象是否可以与相同或不同类型的对象交换%28class模板%29

属性查询

*。

对齐[医]%28C++11%29获得类型%27s对齐要求%28类模板%29

秩%28C++11%29获得数组类型的维数%28类模板%29

范围%28C++11%29沿指定维度%28类模板获得数组类型的大小

类型关系

*。

是[医]相同的%28C++11%29检查两种类型是否为相同的%28类模板%29

是[医]底座[医]在%28C++11%29中,检查类型是否派生自其他类型%28类模板%29

是[医]可转换%28C++11%29检查一个类型是否可以转换为其他类型%28class模板%29

是[医]可调用[医]可调用[医]RIS[医]无抛[医]可调用[医]无抛[医]可调用[医]r%28C++17%29检查一个类型是否可以通过std::调用%29与给定的参数类型%28类模板%29

Const-挥发性说明符

移除[医]移除[医]移除[医]挥发性%28C++11%29%28C+11%29%28C+11%29从给定类型%28类模板%29中删除Const或/和挥发性说明符

加[医]cvadd[医]星座[医]挥发性%28C++11%29%28C+11%29%28C+11%29在给定类型%28类模板%29中添加Const或/和挥发性说明符

参考文献

移除[医]引用%28C++11%29从给定类型%28类模板%29中删除引用

加[医]洛值[医]参考添加[医]r值[医]引用%28C++11%29%28C++11%29向给定类型%28类模板%29添加lvalue或rvalue引用

指针

移除[医]指针%28C++11%29从给定类型%28类模板%29中删除指针

加[医]指针%28C++11%29将指针添加到给定类型%28类模板%29

符号修饰符

制造[医]有符号%28C++11%29使给定的整数类型有符号%28类模板%29

制造[医]无符号%28C++11%29使给定的整型无符号%28类模板%29

阵列

移除[医]范围%28C++11%29从给定数组类型%28类模板%29中删除一个区段

移除[医]全[医]区段%28C++11%29从给定数组类型%28类模板%29中删除所有区段

杂项变换

对齐[医]存储%28C++11%29将适合使用的类型定义为给定大小的类型的未初始化存储%28类模板%29

对齐[医]UNION%28C++11%29定义适合用于所有给定类型的未初始化存储类型%28类模板%29

衰变%28C++11%29在通过值%28类模板%29传递函数参数时应用类型转换

使能[医]如果%28C++11%29隐藏基于编译时布尔值%28类模板%29的函数重载或模板专门化

条件%28C++11%29基于编译类型boole%28 class模板%29选择一种类型或另一种类型。

共同[医]类型%28C++11%29确定类型组%28类模板%29的公共类型

底层[医]类型%28C++11%29获得给定枚举类型%28类模板%29的基础整数类型

结果[医]奥芬沃克[医]结果%28C++11%29%28在C++17%29%28C+17%29中不推荐使用一组参数%28类模板%29演绎调用可调用对象的结果类型

空隙[医]t%28C++17%29空可变别名模板%28别名模板%29

性状运算

连接%28C++17%29可变逻辑和元功能%28类模板%29

分离%28C++17%29可变逻辑或元功能%28类模板%29

否定%28C++17%29逻辑非元功能%28类模板%29

简介

二次

namespace std { // helper class: template <class T, T v> struct integral_constant; template <bool B> using bool_constant = integral_constant<bool, B>; using true_type = bool_constant<true>; using false_type = bool_constant<false>; // primary type categories: template <class T> struct is_void; template <class T> struct is_null_pointer; template <class T> struct is_integral; template <class T> struct is_floating_point; template <class T> struct is_array; template <class T> struct is_pointer; template <class T> struct is_lvalue_reference; template <class T> struct is_rvalue_reference; template <class T> struct is_member_object_pointer; template <class T> struct is_member_function_pointer; template <class T> struct is_enum; template <class T> struct is_union; template <class T> struct is_class; template <class T> struct is_function; // composite type categories: template <class T> struct is_reference; template <class T> struct is_arithmetic; template <class T> struct is_fundamental; template <class T> struct is_object; template <class T> struct is_scalar; template <class T> struct is_compound; template <class T> struct is_member_pointer; // type properties: template <class T> struct is_const; template <class T> struct is_volatile; template <class T> struct is_trivial; template <class T> struct is_trivially_copyable; template <class T> struct is_standard_layout; template <class T> struct is_pod; template <class T> struct is_empty; template <class T> struct is_polymorphic; template <class T> struct is_abstract; template <class T> struct is_final; template <class T> struct is_aggregate; template <class T> struct is_signed; template <class T> struct is_unsigned; template <class T, class... Args> struct is_constructible; template <class T> struct is_default_constructible; template <class T> struct is_copy_constructible; template <class T> struct is_move_constructible; template <class T, class U> struct is_assignable; template <class T> struct is_copy_assignable; template <class T> struct is_move_assignable; template <class T, class U> struct is_swappable_with; template <class T> struct is_swappable; template <class T> struct is_destructible; template <class T, class... Args> struct is_trivially_constructible; template <class T> struct is_trivially_default_constructible; template <class T> struct is_trivially_copy_constructible; template <class T> struct is_trivially_move_constructible; template <class T, class U> struct is_trivially_assignable; template <class T> struct is_trivially_copy_assignable; template <class T> struct is_trivially_move_assignable; template <class T> struct is_trivially_destructible; template <class T, class... Args> struct is_nothrow_constructible; template <class T> struct is_nothrow_default_constructible; template <class T> struct is_nothrow_copy_constructible; template <class T> struct is_nothrow_move_constructible; template <class T, class U> struct is_nothrow_assignable; template <class T> struct is_nothrow_copy_assignable; template <class T> struct is_nothrow_move_assignable; template <class T, class U> struct is_nothrow_swappable_with; template <class T> struct is_nothrow_swappable; template <class T> struct is_nothrow_destructible; template <class T> struct has_virtual_destructor; template <class T> struct has_unique_object_representations; // type property queries: template <class T> struct alignment_of; template <class T> struct rank; template <class T, unsigned I = 0> struct extent; // type relations: template <class T, class U> struct is_same; template <class Base, class Derived> struct is_base_of; template <class From, class To> struct is_convertible; template <class Fn, class... ArgTypes> struct is_invocable; template <class R, class Fn, class... ArgTypes> struct is_invocable_r; template <class Fn, class... ArgTypes> struct is_nothrow_invocable; template <class R, class Fn, class... ArgTypes> struct is_nothrow_invocable_r; // const-volatile modifications: template <class T> struct remove_const; template <class T> struct remove_volatile; template <class T> struct remove_cv; template <class T> struct add_const; template <class T> struct add_volatile; template <class T> struct add_cv; template <class T> using remove_const_t = typename remove_const<T>::type; template <class T> using remove_volatile_t = typename remove_volatile<T>::type; template <class T> using remove_cv_t = typename remove_cv<T>::type; template <class T> using add_const_t = typename add_const<T>::type; template <class T> using add_volatile_t = typename add_volatile<T>::type; template <class T> using add_cv_t = typename add_cv<T>::type; // reference modifications: template <class T> struct remove_reference; template <class T> struct add_lvalue_reference; template <class T> struct add_rvalue_reference; template <class T> using remove_reference_t = typename remove_reference<T>::type; template <class T> using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; template <class T> using add_rvalue_reference_t = typename add_rvalue_reference<T>::type; // sign modifications: template <class T> struct make_signed; template <class T> struct make_unsigned; template <class T> using make_signed_t = typename make_signed<T>::type; template <class T> using make_unsigned_t = typename make_unsigned<T>::type; // array modifications: template <class T> struct remove_extent; template <class T> struct remove_all_extents; template <class T> using remove_extent_t = typename remove_extent<T>::type; template <class T> using remove_all_extents_t = typename remove_all_extents<T>::type; // pointer modifications: template <class T> struct remove_pointer; template <class T> struct add_pointer; template <class T> using remove_pointer_t = typename remove_pointer<T>::type; template <class T> using add_pointer_t = typename add_pointer<T>::type; // other transformations: template <size_t Len, size_t Align = /*default-alignment*/ > struct aligned_storage; template <size_t Len, class... Types> struct aligned_union; template <class T> struct decay; template <bool, class T = void> struct enable_if; template <bool, class T, class F> struct conditional; template <class... T> struct common_type; template <class T> struct underlying_type; template <class> class result_of; // not defined template <class F, class... ArgTypes> class result_of<F(ArgTypes...)>; template <class F, class... ArgTypes> class invoke_result; template <size_t Len, size_t Align = /*default-alignment*/ > using aligned_storage_t = typename aligned_storage<Len, Align>::type; template <size_t Len, class... Types> using aligned_union_t = typename aligned_union<Len, Types...>::type; template <class T> using decay_t = typename decay<T>::type; template <bool b, class T = void> using enable_if_t = typename enable_if<b, T>::type; template <bool b, class T, class F> using conditional_t = typename conditional<b, T, F>::type; template <class... T> using common_type_t = typename common_type<T...>::type; template <class T> using underlying_type_t = typename underlying_type<T>::type; template <class T> using result_of_t = typename result_of<T>::type; template <class F, class... ArgTypes> using invoke_result_t = typename invoke_result<F, ArgTypes...>::type; template <class...> using void_t = void; // logical operator traits: template<class... B> struct conjunction; template<class... B> struct disjunction; template<class B> struct negation; // primary type categories template <class T> inline constexpr bool is_void_v = is_void<T>::value; template <class T> inline constexpr bool is_null_pointer_v = is_null_pointer<T>::value; template <class T> inline constexpr bool is_integral_v = is_integral<T>::value; template <class T> inline constexpr bool is_floating_point_v = is_floating_point<T>::value; template <class T> inline constexpr bool is_array_v = is_array<T>::value; template <class T> inline constexpr bool is_pointer_v = is_pointer<T>::value; template <class T> inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<T>::value; template <class T> inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<T>::value; template <class T> inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<T>::value; template <class T> inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<T>::value; template <class T> inline constexpr bool is_enum_v = is_enum<T>::value; template <class T> inline constexpr bool is_union_v = is_union<T>::value; template <class T> inline constexpr bool is_class_v = is_class<T>::value; template <class T> inline constexpr bool is_function_v = is_function<T>::value; // composite type categories template <class T> inline constexpr bool is_reference_v = is_reference<T>::value; template <class T> inline constexpr bool is_arithmetic_v = is_arithmetic<T>::value; template <class T> inline constexpr bool is_fundamental_v = is_fundamental<T>::value; template <class T> inline constexpr bool is_object_v = is_object<T>::value; template <class T> inline constexpr bool is_scalar_v = is_scalar<T>::value; template <class T> inline constexpr bool is_compound_v = is_compound<T>::value; template <class T> inline constexpr bool is_member_pointer_v = is_member_pointer<T>::value; // type properties template <class T> inline constexpr bool is_const_v = is_const<T>::value; template <class T> inline constexpr bool is_volatile_v = is_volatile<T>::value; template <class T> inline constexpr bool is_trivial_v = is_trivial<T>::value; template <class T> inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<T>::value; template <class T> inline constexpr bool is_standard_layout_v = is_standard_layout<T>::value; template <class T> inline constexpr bool is_pod_v = is_pod<T>::value; template <class T> inline constexpr bool is_empty_v = is_empty<T>::value; template <class T> inline constexpr bool is_polymorphic_v = is_polymorphic<T>::value; template <class T> inline constexpr bool is_abstract_v = is_abstract<T>::value; template <class T> inline constexpr bool is_final_v = is_final<T>::value; template <class T> inline constexpr bool is_aggregate_v = is_aggregate<T>::value; template <class T> inline constexpr bool is_signed_v = is_signed<T>::value; template <class T> inline constexpr bool is_unsigned_v = is_unsigned<T>::value; template <class T, class... Args> inline constexpr bool is_constructible_v = is_constructible<T, Args...>::value; template <class T> inline constexpr bool is_default_constructible_v = is_default_constructible<T>::value; template <class T> inline constexpr bool is_copy_constructible_v = is_copy_constructible<T>::value; template <class T> inline constexpr bool is_move_constructible_v = is_move_constructible<T>::value; template <class T, class U> inline constexpr bool is_assignable_v = is_assignable<T, U>::value; template <class T> inline constexpr bool is_copy_assignable_v = is_copy_assignable<T>::value; template <class T> inline constexpr bool is_move_assignable_v = is_move_assignable<T>::value; template <class T, class U> inline constexpr bool is_swappable_with_v = is_swappable_with<T, U>::value; template <class T> inline constexpr bool is_swappable_v = is_swappable<T>::value; template <class T> inline constexpr bool is_destructible_v = is_destructible<T>::value; template <class T, class... Args> inline constexpr bool is_trivially_constructible_v = is_trivially_constructible<T, Args...>::value; template <class T> inline constexpr bool is_trivially_default_constructible_v = is_trivially_default_constructible<T>::value; template <class T> inline constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible<T>::value; template <class T> inline constexpr bool is_trivially_move_constructible_v = is_trivially_move_constructible<T>::value; template <class T, class U> inline constexpr bool is_trivially_assignable_v = is_trivially_assignable<T, U>::value; template <class T> inline constexpr bool is_trivially_copy_assignable_v = is_trivially_copy_assignable<T>::value; template <class T> inline constexpr bool is_trivially_move_assignable_v = is_trivially_move_assignable<T>::value; template <class T> inline constexpr bool is_trivially_destructible_v = is_trivially_destructible<T>::value; template <class T, class... Args> inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<T, Args...>::value; template <class T> inline constexpr bool is_nothrow_default_constructible_v = is_nothrow_default_constructible<T>::value; template <class T> inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<T>::value; template <class T> inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<T>::value; template <class T, class U> inline constexpr bool is_nothrow_assignable_v = is_nothrow_assignable<T, U>::value; template <class T> inline constexpr bool is_nothrow_copy_assignable_v = is_nothrow_copy_assignable<T>::value; template <class T> inline constexpr bool is_nothrow_move_assignable_v = is_nothrow_move_assignable<T>::value; template <class T, class U> inline constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<T, U>::value; template <class T> inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<T>::value; template <class T> inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<T>::value; template <class T> inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<T>::value; template <class T> inline constexpr bool has_unique_object_representations_v = has_unique_object_representations<T>::value; // type property queries template <class T> inline constexpr size_t alignment_of_v = alignment_of<T>::value; template <class T> inline constexpr size_t rank_v = rank<T>::value; template <class T, unsigned I = 0> inline constexpr size_t extent_v = extent<T, I>::value; // type relations template <class T, class U> inline constexpr bool is_same_v = is_same<T, U>::value; template <class Base, class Derived> inline constexpr bool is_base_of_v = is_base_of<Base, Derived>::value; template <class From, class To> inline constexpr bool is_convertible_v = is_convertible<From, To>::value; template <class Fn, class... ArgTypes> inline constexpr bool is_invocable_v = is_invocable<Fn, ArgTypes...>::value; template <class R, class Fn, class... ArgTypes> inline constexpr bool is_invocable_r_v = is_invocable_r<R, Fn, ArgTypes...>::value; template <class Fn, class... ArgTypes> inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<Fn, ArgTypes...>::value; template <class R, class Fn, class... ArgTypes> inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<R, Fn, ArgTypes...>::value; // logical operator traits: template<class... B> inline constexpr bool conjunction_v = conjunction<B...>::value; template<class... B> inline constexpr bool disjunction_v = disjunction<B...>::value; template<class B> inline constexpr bool negation_v = negation<B>::value; } // namespace std

二次

类std::integral_constant

二次

namespace std { template <class T, T v> struct integral_constant { static constexpr T value = v; using value_type = T; using type = integral_constant<T, v>; constexpr operator value_type() const noexcept { return value; } constexpr value_type operator()() const noexcept { return value; } }; }

二次

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/报头/类型[医]性状