功能特性测试 (C++20)_C++中文网
__has_cpp_attribute( 属性记号 )
宏名
功能特性
值
标准
__cpp_aggregate_bases
扩展聚合初始化
201603L
(C++17)
__cpp_aggregate_nsdmi
成员初始化器与聚合体
201304L
(C++14)
__cpp_aggregate_paren_init
形式为直接初始化的聚合初始化
201902L
(C++20)
__cpp_alias_templates
别名模版
200704L
(C++11)
__cpp_aligned_new
过对齐数据的动态内存分配
201606L
(C++17)
__cpp_attributes
属性
200809L
(C++11)
__cpp_binary_literals
C++ 核心语言中的二进制字面量
201304L
(C++14)
__cpp_capture_star_this
以
[=,*this] 进行 *this 的按值 lambda 捕获
201603L
(C++17)
__cpp_char8_t
char8_t
201811L
(C++20)
__cpp_conditional_explicit
explicit(bool)
201806L
(C++20)
__cpp_constexpr
constexpr
200704L
(C++11)
放松 constexpr 函数 / constexpr 成员函数上的限制和隐式 const
201304L
(C++14)
Constexpr lambda
201603L
(C++17)
constexpr 函数中的平凡默认初始化与汇编声明
201907L
(C++20)
__cpp_coroutines
协程
201902L
(C++20)
__cpp_decltype
decltype
200707L
(C++11)
__cpp_decltype_auto
常规函数的返回类型推导
201304L
(C++14)
__cpp_deduction_guides
类模板的模板实参推导
201703L
(C++17)
__cpp_delegating_constructors
委托构造函数
200604L
(C++11)
__cpp_enumerator_attributes
枚举项的属性
201411L
(C++17)
__cpp_fold_expressions
折叠表达式
201603L
(C++17)
__cpp_generic_lambdas
泛型(多态) lambda 表达式
201304L
(C++14)
__cpp_guaranteed_copy_elision
通过简化值类别保证复制消除
201606L
(C++17)
__cpp_hex_float
十六进制浮点字面量
201603L
(C++17)
__cpp_if_constexpr
constexpr if
201606L
(C++17)
__cpp_impl_destroying_delete
销毁的 operator delete (编译器支持)
201806L
(C++20)
__cpp_impl_three_way_comparison
三路比较(编译器支持)
201711L
(C++20)
__cpp_inheriting_constructors
继承构造函数
200802L
(C++11)
重述继承构造函数
201511L
(C++17)
__cpp_init_captures
通用化的 lambda 捕获
201304L
(C++14)
__cpp_initializer_lists
初始化器列表
200806L
(C++11)
__cpp_inline_variables
inline 变量
201606L
(C++17)
__cpp_lambdas
Lambda 表达式
200907L
(C++11)
__cpp_namespace_attributes
命名空间的属性
201411L
(C++17)
__cpp_noexcept_function_type
令异常规定为类型系统的一部分
201510L
(C++17)
__cpp_nontype_template_args
允许全部非类型模板实参的常量求值
201411L
(C++17)
__cpp_nontype_template_parameter_auto
以 auto 声明非类型模板形参
201606L
(C++17)
__cpp_nontype_template_parameter_class
非类型模板形参中的类类型
201806L
(C++20)
__cpp_nsdmi
非静态数据成员初始化器
200809L
(C++11)
__cpp_range_based_for
基于范围的 for 循环
200907L
(C++11)
通用化基于范围的 for 循环
201603L
(C++17)
__cpp_raw_strings
原始字符串字面量
200710L
(C++11)
__cpp_ref_qualifiers
引用限定符
200710L
(C++11)
__cpp_return_type_deduction
常规函数的返回类型推导
201304L
(C++14)
__cpp_rvalue_references
右值引用
200610L
(C++11)
__cpp_sized_deallocation
具大小解分配
201309L
(C++14)
__cpp_static_assert
static_assert
200410L
(C++11)
扩展 static_assert
201411L
(C++17)
__cpp_structured_bindings
结构化绑定
201606L
(C++17)
__cpp_template_template_args
模板模板实参的匹配
201611L
(C++17)
__cpp_threadsafe_static_init
带并发的动态初始化和销毁
200806L
(C++11)
__cpp_unicode_characters
新字符类型( char16_t 与 char32_t )
200704L
(C++11)
__cpp_unicode_literals
Unicode 字符串字面量
200710L
(C++11)
__cpp_user_defined_literals
用户定义字面量
200809L
(C++11)
__cpp_variable_templates
变量模板
201304L
(C++14)
__cpp_variadic_templates
变参模板
200704L
(C++11)
__cpp_variadic_using
using 声明中的包展开
201611L
(C++17)
如果包含了头文件 <version> 或下表中的任意对应头文件,则下列各个宏有定义。每个宏都展开成其对应的功能特性被包含于工作草案时的年份与月份的相应整数字面量。