序号 | 关键字 | The Usage | 关键字的用法 | 变迁 |
1 | alignas | alignas specifier,specifies the alignment requirement of a type or an object |
对齐指定符, 指定类型或对象的对齐要求 |
since C++11 |
2 | alignof | alignof operator,queries alignment requirements of a type | 对齐运算符,查询类型的对齐要求 | since C++11 |
3 | and | alternative operators,as an alternative for && | 替代运算符,作为&&的替代 | |
4 | and_eq | alternative operators,as an alternative for &= | 替代运算符,作为&=的替代 | |
5 | asm | declaration of an inline assembly block,asm-declaration gives the ability to embed assembly language source code within a C++ program. This declaration is conditionally-supported and implementation defined, meaning that it may not be present and, even when provided by the implementation, it does not have a fixed meaning. |
内联汇编块的声明,asm声明提供 在C++程序中嵌入汇编语言源代码的能力. 该声明的支持是有条件的,并且和具体的实现相关, 这意味着它可能不存在,而且即使由实现提供了这个功能,(由于不同的实现方法)它也没有一个固定的含义. |
|
6 | atomic_cancel | transactional memory related | 具备事务属性的内存相关,正在构建中,截止目前没有编译器适配 | TM TS |
7 | atomic_commit | transactional memory related | 具备事务属性的内存相关,正在构建中,截止目前没有编译器适配 | TM TS |
8 | atomic_noexcept | transactional memory related | 具备事务属性的内存相关,正在构建中,截止目前没有编译器适配 | TM TS |
9 | auto | automatic storage duration specifier(until C++11) auto placeholder type specifier(since C++11) function declaration with trailing return type(since C++11) structured binding declaration(since C++17) |
C++11之前,自动存储持续时间说明符; 自C++11,自动占位符类型说明符; 自C++11,带有尾随返回类型的函数声明; 自C++17,结构化约束性声明. |
changed or new meaning added in C++11 |
10 | bitand | alternative operators,as an alternative for & | 替代运算符,作为&的替代 | |
11 | bitor | alternative operators,as an alternative for | | 替代运算符,作为|的替代 | |
12 | bool | bool type,as the declaration of the type | 布尔类型,作为一种类型的声明 | |
13 | break | break statement,as the declaration of the statement | break语句,作为语句的声明,跳出当前循环(循环语句关键词) | |
14 | case | switch statement,as the declaration of the case labels | 开关语句,作为开关语句的声明,开关语句分支(开关语句) | |
15 | catch | (1)try-block,associates one or more exception handlers (catch-clauses) with a compound statement. (2)function-try-block,establishes an exception handler around the body of a function. |
(1)try-block,将一个或多个异常处理程序(捕获-子句)与复合语句相关联; (2)function-try-block,在函数体周围建立异常处理程序. |
|
16 | char | char type,as the declaration of the type | char类型,作为一种类型的声明 | |
17 | char8_t | char8_t type,as the declaration of the type | char8_t类型,作为一种类型的声明 | since C++20 |
18 | char16_t | char16_t type,as the declaration of the type | char16_t类型,作为一种类型的声明 | since C++11 |
19 | char32_t | char32_t type,as the declaration of the type | char32_t类型,作为一种类型的声明 | since C++11 |
20 | class | (1)declaration of a class (2)declaration of a scoped enumeration type (since C++11) (3)In a template declaration, class can be used to introduce type template parameters and template template parameters (4)If a function or a variable exists in scope with the name identical to the name of a class type, class can be prepended to the name for disambiguation, resulting in an elaborated type specifier |
(1)一个类的申明; (2)限定作用域枚举类型的声明; (3)在模板声明中,class关键字可用于引入类型模板参数和模板模板参数; (4)如果作用域中存在一个函数或变量,其名称与类类型的名称相同,则可以在类的名称前面加上类以消除歧义,从而产生一个详细的类型说明符. |
changed or new meaning added in C++11 |
21 | compl | alternative operators,as an alternative for ~ | 替代运算符,作为~的替代 | |
22 | concept | declares a named type requirement | 声明命名类型要求 | since C++20 |
23 | const | (1)const type qualifier; (2)const-qualified member functions; |
(1)const类型限定符; (2)成员函数的const属性限定. |
|
24 | consteval | consteval declaration specifier,specifies that a function is an immediate function, that is, every call to the function must produce a compile-time constant | consteval声明说明符,指定函数是即时函数,也就是说,对该函数的每次调用都必须产生一个编译时常量. | since C++20 |
25 | constexpr | (1)constexpr declaration specifier (since C++11),specifies that the value of a variable or function can appear in constant expressions; (2)constexpr if statement (since C++17),conditionally executes another statement,used where code needs to be executed based on a run-time or compile-time condition. |
(1)constexpr声明说明符(从C++11开始),指定变量或函数的值可以出现在常量表达式中; (2)constexpr条件语句(自C++17以来),有条件地执行另一个语句,用于需要基于运行时或编译时条件执行代码的情况. |
since C++11 |
26 | constinit | constinit declaration specifier(since C++20),asserts that a variable has static initialization, i.e. zero initialization and constant initialization, otherwise the program is ill-formed | constinit声明说明符(自C++20以来),断言变量具有静态初始化,即零初始化和常量初始化,否则程序是病态的. | since C++20 |
27 | const_cast | const_cast type conversion expression,as the declaration of the expression.Converts between types with different cv-qualification. | const_cast类型转换表达式,作为该表达式的声明.在具有不同cv限定的类型之间进行转换. | |
28 | continue | continue statement,as the declaration of the statemen | continue语句,作为语句的声明,结束当前循环,开始下一轮循环(循环语句关键词) | |
29 | co_await | The unary operator co_await suspends a coroutine and returns control to the caller. | 一元操作符co_await挂起一个协程并将控制返回给调用方. | since C++20 |
30 | co_return | return statement in a coroutine (since C++20),uses the keyword co_return to complete execution returning a value | 在协程中使用返回语句(自C++20以来),使用关键字co_return来完成返回一个值的执行 | since C++20 |
31 | co_yield | yields a value from a coroutine (since C++20),uses the keyword co_yield to suspend execution returning a value | 从协程中生成一个值(自C++20),使用关键字co_yield来暂停返回一个值的执行 | since C++20 |
32 | decltype | (1)decltype specifier,inspects the declared type of an entity or the type and value category of an expression(since C++11) (2)decltype(auto)(since C++14),for variables, specifies that the type of the variable that is being declared will be automatically deduced from its initializer.Placeholder type specifiers.For variables, specifies that the type of the variable that is being declared will be automatically deduced from its initializer.For functions, specifies that the return type will be deduced from its return statements(since C++14).For non-type template parameters, specifies that the type will be deduced from the argument(since C++17). |
(1)declotype说明符,检查一个实体的声明类型或一个表达式的类型和值类别(自C++11以来); (2)declotype(auto)(自C++14以来),对于变量,指定要声明的变量的类型将从其初始化器自动推导出来.占位符类型说明符.对于变量,指定要声明的变量的类型将自动从其初始化式推导出来.对于函数,指定返回类型将从它的返回语句推导出来(自C++14以来).对于非类型模板参数,指定将从参数推导出类型(自c++17以后). |
since C++11 |
33 | default | (1)switch statement: as the declaration of the default case label; (2)explicitly-defaulted function definition: as an explicit instruction to the compiler to generate special member function or a comparison operator (since C++20) for a class.(since C++11) |
(1)开关语句:作为缺省大小写标签的声明; (2)显式默认函数定义:作为一个显式指令告诉编译器,为一个类生成特殊的成员函数或比较运算符(自C++20以来).(自C++11) |
changed or new meaning added in C++11 |
34 | delete | (1)delete expression,to destroys object(s) previously allocated by the new expression and releases obtained memory area; (2)deallocation functions as the name of operator-like functions; (3)deleted functions(since C++11).If, instead of a function body, the special syntax = delete ; is used, the function is defined as deleted. Any use of a deleted function is ill-formed (the program will not compile). This includes calls, both explicit (with a function call operator) and implicit (a call to deleted overloaded operator, special member function, allocation function etc), constructing a pointer or pointer-to-member to a deleted function, and even the use of a deleted function in an unevaluated expression. However, implicit ODR-use of a non-pure virtual member function that happens to be deleted is allowed. If the function is overloaded, overload resolution takes place first, and the program is only ill-formed if the deleted function was selected. |
(1)delete表达式,销毁以前由new表达式分配的对象并释放获得的内存区域; (2)释放函数作为类操作符函数的名称; (3)显示删除一个函数.如果对一个函数使用特殊语法=delete,而不是定义一个函数体,则函数定义为deleted.任何对已删除函数的使用都是错误的(程序将无法编译).这包括显式(使用函数调用操作符)和隐式(调用删除的重载操作符、特殊成员函数、分配函数等)调用,构造指向已删除函数的指针或成员指针,甚至在未求值表达式中使用已删除的函数.但是,一个碰巧被删除的非纯虚拟成员函数的ODR-USE是被允许的. 如果函数是重载的,那么重载解析将首先发生,并且只有选择了被删除的函数,程序才会出错. |
changed or new meaning added in C++11 |
35 | do | do-while loop,as the declaration of the loop | do-while循环,作为循环的声明 | |
36 | double | double type, as the declaration of the type | double类型,作为类型的声明 | |
37 | dynamic_cast | dynamic_cast type conversion expression,as the declaration of the expression | dynamic_cast类型转换表达式,作为该表达式的声明 | |
38 | else | if statement,as the declaration of the alternative branch | if语句,作为替代分支的声明 | |
39 | enum | declaration of an enumeration type | 枚举类型的声明 | |
40 | explicit | explicit specifier | 显式说明符 | |
41 | export | (1)Used to mark a template definition exported, which allows the same template to be declared, but not defined, in other translation units.(until C++11) (2)The keyword is unused and reserved.(since C++11,until C++20) (3)Marks a declaration, a group of declarations, or another module as exported by the current module.(since C++20) |
(1)用于标记导出的模板定义,允许在其他转换单元中声明但不定义相同的模板(C++11前); (2)在C++11和C++20期间,这个关键字没有被使用,被保留了; (3)标记当前模块导出的声明、声明组或另一个模块.(自C++20) |
changed or new meaning added in C++11 |
42 | extern | (1)static storage duration with external linkage specifier (2)language linkage specification (3)explicit template instantiation declaration (or "extern template") |
(1)用来标记一个变量带外部链接且具有静态存储的特性; (2)提供语言链接规范; (3)用于显式模板实例化声明(或“extern模板”). |
changed or new meaning added in C++11 |
43 | false | boolean literal | 布尔字面值常量 | |
44 | float | float type,as the name of the type | 浮点数类型,作为类型的名称 | |
45 | for | (1)for loop,as the declaration of the loop (2)range-based for loop,as the declaration of the loop (since C++11) |
(1)for循环,作为循环的声明; (2)基于范围的for循环,作为循环的声明(自C++11以来) |
|
46 | friend | friend specifier,the friend declaration appears in a class body and grants a function or another class access to private and protected members of the class where the friend declaration appears. | 友元说明符.友元声明出现在类主体中,确保声明为友元的函数或它的友元类有权访问这个类的私有成员和受保护成员. | |
47 | goto | goto statement,as the declaration of the goto statement | goto语句,作为goto声明的声明,无条件跳转语句(条件语句关键词) | |
48 | if | if statement, as the declaration of the if statement | if语句,作为if语句的声明 | |
49 | inline | (1)inline specifier for functions and variables (since C++17) (2)inline namespace definition (since C++11) |
(1)函数和变量的内联说明符(自C++17) (2)内联命名空间定义(自C++11) |
changed or new meaning added in C++11 |
50 | int | int type,as the declaration of the type | int类型,作为类型的声明 | |
51 | long | long type modifier | long类型说明符 | |
52 | mutable | (1)mutable type specifier (2)lambda-declarator that removes const qualification from parameters captured by copy (since C++11) |
(1)可变类型说明符 (2)从复制捕获的参数中移除const限定的Lambda声明符. |
changed or new meaning added in C++11 |
53 | namespace | (1)namespace declaration (2)namespace alias definition (3)using-directives |
(1)命名空间声明; (2)命名空间别名定义; (3)使用指令. |
|
54 | new | (1)new expression (2)allocation functions as the name of operator-like functions |
(1)new表达式 (2)分配函数作为类操作符函数的名称. |
|
55 | noexcept | (1)noexcept operator,the noexcept operator performs a compile-time check that returns true if an expression is declared to not throw any exceptions.It can be used within a function template's noexcept specifier to declare that the function will throw exceptions for some types but not others. (2)noexcept specifier,specifies whether a function could throw exceptions. |
(1)noexcept运算符.执行编译时检查,如果表达式被声明为不引发任何异常,则该检查返回true.它可以在函数模板的noexcept说明符中使用,以声明函数将对某些类型抛出异常,但对其他类型不抛出异常. (2)noexcept说明符,指定函数是否可以引发异常. |
since C++11 |
56 | not | alternative operators,as an alternative for ! | 替代运算符,作为!的替代 | |
57 | not_eq | alternative operators,as an alternative for != | 替代运算符,作为!=的替代 | |
58 | nullptr | nullptr pointer literal (since C++11) | nullptr指针字面量 | since C++11 |
59 | operator | declaration of an overloaded operator | 重载运算符的声明 | |
60 | or | alternative operators,as an alternative for || | 替代运算符,作为||的替代 | |
61 | or_eq | alternative operators,as an alternative for != | 替代运算符,作为!=的替代 | |
62 | private | private access specifier | 私有访问说明符 | |
63 | protected | protected access specifier | 受保护访问说明符 | |
64 | public | public access specifier | 公有访问说明符 | |
65 | reflexpr | (1)gets the member list of a class type, or the enumerator list of an enum type. (2)gets the name of type and member. (3)detects whether a data member is static or constexpr. (4)detects whether member function is virtual, public, protected or private. (5)get the row and column of the source code when the type defines. |
(1)获取类类型的成员列表或枚举类型的枚举数列表; (2)获取类型和成员的名称; (3)检测数据成员是静态成员还是constexpr; (4)检测成员函数是虚拟的,公有的,受保护的还是私有的; (5)获取类型定义时源代码的行和列. (实验中,暂无编译器支持) |
reflection TS |
66 | register | (1)automatic storage duration specifier (deprecated)(until C++17) (2)The keyword is unused and reserved.(since C++17) |
(1)自动存储持续时间说明符(不建议使用,C++17前); (2)关键字未使用并被保留(自C++17). |
changed or new meaning added in C++11 |
67 | reinterpret_cast | reinterpret_cast type conversion expression,as the declaration of the expression | 类型转换表达式,作为表达式的声明 | |
68 | requires | (1)specifies a constant expression on template parameters that evaluate a requirement(since C++20) (2)in a template declaration, specifies an associated constraint (since C++20) |
(1)指定一个用于评估需求的模板参数的常量表达式(自C++20以来); (2)在模板声明中,指定一个关联的约束(自C++20以来). |
since C++20 |
69 | return | return statement,as the declaration of the statement | 返回语句,作为语句的声明 | |
70 | short | short type modifier | short类型说明符 | |
71 | signed | signed type modifier | signed类型说明符 | |
72 | sizeof | (1)sizeof operator,queries size of the object or type,used when actual size of the object must be known. (2)sizeof... operator (since C++11),queries the number of elements in a parameter pack,returns a constant of type std::size_t. |
(1)查询对象或类型的大小,当必须知道对象的实际大小时使用; (2)查询参数包中的元素数,返回std::size_t类型的常量. |
changed or new meaning added in C++11 |
73 | static | (1)declarations of namespace members with static storage duration and internal linkage (2)definitions of block scope variables with static storage duration and initialized once (3)declarations of class members not bound to specific instances |
(1)具有静态存储持续时间和内部链接的命名空间成员的声明 (2)具有静态存储持续时间和一次初始化的块作用域变量的定义 (3)不绑定到特定实例的类成员的声明 |
|
74 | static_assert | static_assert declaration (since C++11),performs compile-time assertion checking | static_assert声明,执行编译时断言检查 | since C++11 |
75 | static_cast | static_cast type conversion expression,as the declaration of the expression | static_cast类型转换表达式,作为表达式的声明 | |
76 | struct | (1)declaration of a compound type (2)declaration of a scoped enumeration type(since C++11) (3)If a function or a variable exists in scope with the name identical to the name of a non-union class type, struct can be prepended to the name for disambiguation, resulting in an elaborated type specifier |
(1)复合型声明 (2)范围枚举类型的声明(自C++11以来) (3)如果作用域中存在一个函数或变量,其名称与非联合类类型的名称相同,则可以将struct加在名称前面以消除歧义,从而产生一个详细的类型说明符 |
changed or new meaning added in C++11 |
77 | switch | switch statement,as the declaration of the statement | switch语句,作为该语句的声明 | |
78 | synchronized | Work in progress. | 正在开发中,大概是同步相关的内容 | TM TS |
79 | template | (1)declaration of a template (2)inside a template definition, template can be used to declare that a dependent name is a template. |
(1)模板声明; (2)在模板定义里面,模板可以用来声明依赖名是模板. |
|
80 | this | This Pointer The keyword this is a prvalue expression whose value is the address of the implicit object parameter (object on which the non-static member function is being called). It can appear in the following contexts: 1) Within the body of any non-static member function, including member initializer list 2) within the declaration of a non-static member function anywhere after the (optional) cv-qualifier sequence, including dynamic exception specification(deprecated), noexcept specification(C++11), and the trailing return type(since C++11) 3) within default member initializer (since C++11) |
This指针. 关键字this是一个prvalue表达式,其值是隐式对象参数(调用非静态成员函数的对象)的地址,它可以出现在以下场景中: 1)在任何非静态成员函数体中,包括成员初始化列表 2)在非静态成员函数的声明中,位于(可选的)cv-qualifier序列之后的任何地方,包括动态异常规范(不建议)、noexcept规范(C++11)和尾随返回类型(自C++11以来); 3)在默认的成员初始化器内(自C++11以来). |
|
81 | thread_local | thread local storage duration specifier (since C++11),the storage class specifiers are a part of the decl-specifier-seq of a name's declaration syntax. Together with the scope of the name, they control two independent properties of the name: its storage duration and its linkage. | 线程本地存储持续时间说明符(自C++11),存储类说明符是名称声明语法的decl-specifier-seq的一部分.它们与名称的作用域一起控制名称的两个独立属性:存储持续时间和链接. | since C++11 |
82 | throw | (1)throw expression (2)exception specifications |
(1)抛出表达式 (2)异常说明符 |
|
83 | true | boolean literal | 布尔字面值常量 | |
84 | try | (1)try-block (2)function-try-block |
与catch一起看 | |
85 | typedef | typedef specifier,creates an alias that can be used anywhere in place of a (possibly complex) type name. | typedef说明符创建一个别名,可在任何地方代替(可能是复杂的)类型名使用 | |
86 | typeid | typeid operator,queries information of a type.Used where the dynamic type of a polymorphic object must be known and for static type identification. | 类型标识符,查询类型信息,用于必须知道多态对象的动态类型以及用于静态类型标识 | |
87 | typename | (1)In a template declaration, typename can be used as an alternative to class to declare type template parameters and template template parameters (since C++17). (2)Inside a declaration or a definition of a template, typename can be used to declare that a dependent qualified name is a type. (3)Inside a declaration or a definition of a template, (until C++11) typename can be used before a non-dependent qualified type name. It has no effect in this case. (4)Inside a requirements for type requirements (since C++20) |
(1)在模板声明中,typename可以作为类的替代,用于声明类型模板参数和模板模板参数(自C++17以来); (2)在模板的声明或定义中,可以使用类型名来声明依赖限定名是类型; (3)在模板的声明或定义中,(直到C++11)类型名可以用在非 依赖限定类型名之前。在这种情况下没有任何影响; (4)存在于一个需求类型中(因为C++20). |
|
88 | union | (1)declaration of a union type (2)if a function or a variable exists in scope with the name identical to the name of a union type, union can be prepended to the name for disambiguation, resulting in an elaborated type specifier |
(1)联合类型的声明 (2)如果一个函数或一个变量在作用域中的名称与联合类型的名称相同,则可以在名称前面加上联合以消除歧义,从而产生一个详细的类型说明符 |
|
89 | unsigned | unsigned type modifier | 无符号类型修饰符 | |
90 | using | (1)using-directives for namespaces and using-declarations for namespace members (2)using-declarations for class members (3)type alias and alias template declaration (since C++11) |
(1)命名空间的使用指令和命名空间成员的使用声明 (2)类成员的使用声明 (3)类型别名和别名模板声明(自C++11以来) |
changed or new meaning added in C++11 |
91 | virtual | (1)virtual function specifier (2)virtual base class specifier |
(1)虚函数说明符 (2)虚拟基类说明符 |
|
92 | void | (1)void type (2)parameter list of a function with no parameters |
(1)空类型 (2)无参数函数的参数表 |
|
93 | volatile | (1)volatile type qualifier (2)volatile-qualified member functions |
(1)易失性类型限定符 (2)易失性限定成员函数 |
|
94 | wchar_t | wchar_t type, as the declaration of the type.wchar_t - type for wide character representation (see wide strings). Required to be large enough to represent any supported character code point (32 bits on systems that support Unicode. A notable exception is Windows, where wchar_t is 16 bits and holds UTF-16 code units) It has the same size, signedness, and alignment as one of the integer types, but is a distinct type. | wchar_t类型,作为type.wchart-type的声明,用于宽字符表示(参见宽字符串)要求足够大,以表示任何支持的字符代码点(在支持Unicode的系统上为32位).一个显著的例外是Windows,其中wchar_t为16位,并持有UTF-16代码单元).它具有与整数类型之一相同的大小,符号和对齐方式,但它是一种不同的类型。 | |
95 | while | (1)while loop: as the declaration of the loop (2)do-while loop: as the declaration of the terminating condition of the loop |
(1)while循环:作为循环的声明 (2)do-while循环:作为循环终止条件的声明 |
|
96 | xor | alternative operators,as an alternative for ^ | 替代运算符,作为^的替代 | |
97 | xor_eq | alternative operators,as an alternative for ^= | 替代运算符,作为^=的替代 |