Type support (basic types, RTTI, type traits)
来自cppreference.com
< cpp
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
[编辑] 基本类型
[编辑] 基本类型定义的语言
[编辑] 其他的基本类型和宏
| Defined in header
<cstddef> | |
| 返回无符号整数类型的sizeof运营商 Original: unsigned integer type returned by the sizeof operator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (的typedef) | |
| 符号的整数类型时,返回两个指针相减 Original: signed integer type returned when subtracting two pointers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (的typedef) | |
| (C++11) |
类型的文字nullptr空指针 Original: the type of the null pointer literal nullptr The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (的typedef) |
| 实现定义的空指针常量 Original: implementation-defined null pointer constant The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (宏不变) | |
| (C++11) |
POD类型的对齐要求大,任何其他标量类型 Original: POD type with alignment requirement as great as any other scalar type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (的typedef) |
| 一个标准的布局类型指定的成员从一开始的字节偏移量 Original: byte offset from the beginning of a standard-layout type to specified member The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数宏) | |
| Defined in header
<cstdbool> | |
| __bool_true_false_are_defined (C++11) |
C的兼容性宏不变,扩展到整数常量1 Original: C compatibility macro constant, expands to integer constant 1 The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (宏不变) |
| Defined in header
<cstdalign> | |
| __alignas_is_defined (C++11) |
C的兼容性宏不变,扩展到整数常量1 Original: C compatibility macro constant, expands to integer constant 1 The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (宏不变) |
[编辑] 固定宽度的整数类型 (C++11 起)
[编辑] numeric_limits
| Defined in header
<limits> | |
| 提供了一个接口的所有基本数字类型的查询性能. Original: provides an interface to query properties of all fundamental numeric types. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
[编辑] C数字限制接口
[编辑] 运行时类型识别
| 包含某些类型的信息,这是类的implementation. 产生的,由typeid的运算符返回 Original: contains some type's information, generated by the implementation. This is the class, returned by the typeid的 operator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
| (C++11) |
包装周围的 type_info对象,可以作为指数的关联和无序关联式容器 Original: wrapper around a type_info object, that can be used as index in associative and unordered associative containers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) |
| 在typeid的表达引发的异常如果有一个参数为空 Original: exception that is thrown if an argument in a typeid的表达 is null The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
| 被抛出的异常的无效dynamic_cast表达,即引用类型的强制转换失败 Original: exception that is thrown by an invalid dynamic_cast expression, i.e. a cast of reference type fails The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
[编辑] 型性状NJ
类型特征定义了一个基于模板的编译时间接口来查询或修改属性的类型.
Original:
Type traits defines an compile-time template-based interface to query or modify the properties of types.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 类型属性
| Defined in header
<type_traits> | |
Original: Primary type categories The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (C++11) |
如果一个类型的检查是void Original: checks if a type is void The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查如果一个类型是整数类型 Original: checks if a type is integral type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查如果一个类型是浮点型 Original: checks if a type is floating-point type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查如果一个类型是数组类型 Original: checks if a type is an array type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查如果一个类型是一个枚举类型 Original: checks if a type is an enumeration type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查如果一个类型是一个联合类型 Original: checks if a type is an union type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
checks if a type is a class type (but not union type) (类模板) |
| (C++11) |
如果一个类型的检查是函数类型 Original: checks if a type is a function type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查如果一个类型是一个指针类型 Original: checks if a type is a pointer type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查如果一个类型是“左值参考” Original: checks if a type is lvalue reference The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查,如果一个类型是“右值引用” Original: checks if a type is rvalue reference The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查如果一个类型是一个指针,指向一个非静态成员对象 Original: checks if a type is a pointer to a non-static member object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
如果一个类型的检查是一个非静态成员函数的指针 Original: checks if a type is a pointer to a non-static member function The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
Original: Composite type categories The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (C++11) |
检查如果一个类型是基本类型 Original: checks if a type is fundamental type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
如果一个类型的检查是算术型 Original: checks if a type is arithmetic type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
如果一个类型的检查是标量类型 Original: checks if a type is scalar type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
如果一个类型的检查对象的类型 Original: checks if a type is object type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查如果一个类型是复合型 Original: checks if a type is compound type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
如果一个类型的检查是“左值引用”或“右值引用' Original: checks if a type is either lvalue reference or rvalue reference The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
checks if a type is a pointer to a non-static member function or object (类模板) |
Original: Type properties The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (C++11) |
检查如果一个类型是const限定 Original: checks if a type is const-qualified The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
类型检查,如果是挥发合格的 Original: checks if a type is volatile-qualified The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
如果一个类型的检查是微不足道的 Original: checks if a type is trivial The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
checks if a type is trivially copyable (类模板) |
| (C++11) |
检查如果一个类型是标准的布局类型 Original: checks if a type is standard-layout type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查如果一个类型是普通的旧数据(POD)类型 Original: checks if a type is plain-old data (POD) type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
checks if a type is literal type (类模板) |
| (C++11) |
checks if a type is class (but not union) type and has no data (类模板) |
| (C++11) |
检查如果一个类型是多态类的类型 Original: checks if a type is polymorphic class type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查如果一个类型是一个抽象类类型 Original: checks if a type is abstract class type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
检查 Original: checks if a type is signed arithmetic type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
如果一个类型的检查是无符号的算术类型 Original: checks if a type is unsigned arithmetic type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
Original: Supported operations The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (C++11) (C++11) (C++11) |
检查如果一个类型有一个构造函数的具体参数 Original: checks if a type has a constructor for specific arguments The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| 检查如果一个类型有一个默认的构造函数 Original: checks if a type has a default constructor The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| (C++11) (C++11) (C++11) |
一类的检查,如果有拷贝构造函数 Original: checks if a type has a copy constructor The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) (C++11) (C++11) |
类型检查,如果有一个移动的构造函数 Original: checks if a type has a move constructor The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) (C++11) (C++11) |
如果一个类型的检查有特定参数的赋值操作符 Original: checks if a type has a assignment operator for a specific argument The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) (C++11) (C++11) |
检查如果一个类型有一个拷贝赋值运算符 Original: checks if a type has a copy assignment operator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) (C++11) (C++11) |
一类的检查,如果有一招赋值运算符 Original: checks if a type has a move assignment operator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) (C++11) (C++11) |
如果一个类型的检查,具有不可删除的析构函数 Original: checks if a type has a non-deleted destructor The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
一类的检查,如果有虚析构函数 Original: checks if a type has a virtual destructor The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
Original: Property queries The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (C++11) |
获得该类型的对齐要求 Original: obtains the type's alignment requirements The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
获得一个数组类型的尺寸 Original: obtains the number of dimensions of an array type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
获得一个数组类型的大小,沿着指定的尺寸 Original: obtains the size of an array type along a specified dimension The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
Original: Type relationships The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (C++11) |
两种类型的检查,如果是相同的 Original: checks if two types are the same The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
checks if a type is derived from the other type (类模板) |
| (C++11) |
如果一个类型的检查,可以被转换成另一种类型 Original: checks if a type can be converted to the other type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
[编辑] 类型的修改
类型修改模板创建新的类型定义通过应用模板参数的修改。类型可以通过访问
type成员typedef.Original:
Type modification templates create new type definitions by applying modifications on a template parameter. The resulting type can then be accessed through
type member typedef.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| Defined in header
<type_traits> | |
Original: Const-volatility specifiers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (C++11) (C++11) (C++11) |
移除const和/或volatile从给定的类型说明符 Original: removes const or/and volatile specifiers from the given type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) (C++11) (C++11) |
adds const or/and volatile specifiers to the given type (类模板) |
Original: References The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (C++11) |
移除参考给定的类型 Original: removes reference from the given type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) (C++11) |
增加了“左值”或“右值”参考给定类型 Original: adds lvalue or rvalue reference to the given type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
Original: Pointers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (C++11) |
移除从给定类型的指针 Original: removes pointer from the given type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
添加到给定的类型的指针 Original: adds pointer to the given type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
Original: Sign modifiers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (C++11) |
整体式签署 Original: makes the given integral type signed The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
整体式无符号 Original: makes the given integral type unsigned The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
Original: Arrays The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (C++11) |
删除一个程度上给定的数组类型 Original: removes one extent from the given array type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
removes all extents from the given array type (类模板) |
[编辑] 其他的转换
| Defined in header
<type_traits> | |
| (C++11) |
定义的类型适合用作未初始化的存储类型的给定尺寸 Original: defines the type suitable for use as uninitialized storage for types of given size The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
适合所有类型的使用未初始化的存储定义的类型 Original: defines the type suitable for use as uninitialized storage for all given types The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
适用于当一个函数传递参数的值的类型转换 Original: applies type transformations as when passing a function argument by value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
隐藏的功能过载或编译时布尔基于模板专业化 Original: hides a function overload or template specialization based on compile-time boolean The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
选择一种或另一种编译型布尔的基础上 Original: chooses one type or another based on compile-type boolean The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
deduces the result type of a mixed-mode arithmetic expression (类模板) |
| (C++11) |
获得一个给定的枚举类型的底层整数类型 Original: obtains the underlying integer type for a given enumeration type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
推导出的返回类型的函数调用表达式 Original: deduces the return type of a function call expression The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
[编辑] Helper类
| Defined in header
<type_traits> | |
| (C++11) |
编译时指定类型的指定的值保持不变 Original: compile-time constant of specified type with specified value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
std::integral_constant的类型bool两个专业
Original:
Two specializations of std::integral_constant for the type bool are provided:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| Defined in header
<type_traits> | |
| 类型
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
true_type
|
std::integral_constant<bool, true> |
false_type
|
std::integral_constant<bool, false> |