Feature testing (since C++20)
标准定义了一组 预处理器宏 对应 C++11 或之后版本引入的 C++ 语言和库特性。这些宏旨在提供一种简单且可移植的方法来检测相关特性的存在。
目录 |
属性
__has_cpp_attribute(
attribute-token
)
|
|||||||||
检查是否支持由 attribute-token (在宏展开后)命名的 attribute 。
对于每个标准属性,由实现定义
__has_cpp_attribute
是否展开为下表所列值(即该属性加入工作草案的年份和月份)或
0
。当且仅当该标准属性使实现表现出推荐行为(发出诊断信息、影响类布局等)时,才会展开为表中的给定值。
供应商特定属性的存在由非零值确定。
__has_cpp_attribute
可在
#if
和
#elif
的表达式中展开。
它被
#ifdef
、
#ifndef
、
#elifdef
、
#elifndef
(C++23 起)
以及
defined
视为已定义的宏,但不能在其他任何地方使用。
| 属性标记 | 属性 | 值 | 标准 | 提案文档 |
|---|---|---|---|---|
assume
|
[[
assume
]]
|
202207L
|
(C++23) | P1774R8 |
carries_dependency
|
[[
carries_dependency
]]
|
200809L
|
(C++11)
(直至 C++26) |
N2556
N2643 P3475R2 |
deprecated
|
[[
deprecated
]]
|
201309L
|
(C++14) | N3760 |
fallthrough
|
[[
fallthrough
]]
|
201603L
|
(C++17) | P0188R1 |
indeterminate
|
[[
indeterminate
]]
|
202403L
|
(C++26) | P2795R5 |
likely
|
[[
likely
]]
|
201803L
|
(C++20) | P0479R5 |
maybe_unused
|
[[
maybe_unused
]]
|
201603L
|
(C++17) | P0212R1 |
no_unique_address
|
[[
no_unique_address
]]
|
201803L
|
(C++20) | P0840R2 |
nodiscard
|
[[
nodiscard
]]
|
201603L
|
(C++17) | P0189R1 |
[[
nodiscard
]]
带原因说明
|
201907L
|
(C++20) | P1301R4 | |
noreturn
|
[[
noreturn
]]
|
200809L
|
(C++11) | N2761 |
unlikely
|
[[
unlikely
]]
|
201803L
|
(C++20) | P0479R5 |
| 属性总数:11 | ||||
语言特性
以下宏可用于检测当前实现是否支持某个语言特性。这些宏在 每个翻译单元中预定义 。
每个宏展开为对应的整数字面量,对应功能被纳入工作草案的年份和月份。当功能发生重大变更时,宏将相应更新。
| 宏名称 | 特性 | 值 | 标准 | 文献编号 |
|---|---|---|---|---|
__cpp_aggregate_
bases
|
具有基类的聚合类 |
201603L
|
(C++17) | P0017R1 |
__cpp_aggregate_
nsdmi
|
聚合类 支持 默认成员初始化器 |
201304L
|
(C++14) | N3653 |
__cpp_aggregate_
paren_init
|
聚合初始化 的 直接初始化 形式 |
201902L
|
(C++20) | P0960R3 |
__cpp_alias_templates
|
别名模板 |
200704L
|
(C++11) | N2258 |
__cpp_aligned_new
|
超对齐数据的动态内存分配 |
201606L
|
(C++17) | P0035R4 |
__cpp_attributes
|
属性 |
200809L
|
(C++11) | N2761 |
__cpp_auto_cast
|
auto ( x ) 和 auto { x } |
202110L
|
(C++23) | P0849R8 |
__cpp_binary_literals
|
二进制字面量 |
201304L
|
(C++14) | N3472 |
__cpp_capture_star_
this
|
通过值捕获 * this 的Lambda捕获 [ = , * this ] |
201603L
|
(C++17) | P0018R3 |
__cpp_char8_t
|
char8_t |
201811L
|
(C++20) | P0482R6 |
| char8_t 兼容性与可移植性修复(允许 (无符号)字符数组 从 UTF-8字符串字面量 进行初始化) |
202207L
|
(C++23)
(DR20) |
P2513R4 | |
__cpp_concepts
|
概念 |
201907L
|
(C++20) |
P0734R0
P1084R2 P1452R2 |
| 条件性平凡特殊成员函数 |
202002L
|
P0848R3
P2493R0 |
||
__cpp_conditional_
explicit
|
explicit(bool)
|
201806L
|
(C++20) | P0892R2 |
__cpp_consteval
|
立即函数 |
201811L
|
(C++20) | P1073R3 |
| 使 consteval 向上传播 |
202211L
|
(C++23)
(DR20) |
P2564R3 | |
__cpp_constexpr
|
constexpr |
200704L
|
(C++11) | N2235 |
放宽的
constexpr
,
非
const
constexpr
方法
|
201304L
|
(C++14) | N3652 | |
| 常量表达式 lambda |
201603L
|
(C++17) | P0170R1 | |
虚函数
在常量表达式中的调用;
try
代码块
在
constexpr
函数中,
dynamic_cast
与多态
typeid
在常量表达式中的使用;平凡
默认初始化
及
asm声明
在
constexpr
函数中
|
201907L
|
(C++20) |
P1064R0
P1002R1 P1327R1 P1331R2 P1668R1 |
|
| 在常量求值中更改联合体的活跃成员 |
202002L
|
P1330R0
P2493R0 |
||
| 非 字面量 类型的变量、标签以及 goto 语句在 constexpr 函数中的使用 |
202110L
|
(C++23) | P2242R3 | |
| 放宽对 constexpr 函数和函数模板的部分限制 |
202207L
|
P2448R2 | ||
| 允许在 constexpr 函数中使用静态 constexpr 变量 |
202211L
|
P2647R1 | ||
| 从 void * 的常量表达式转换:迈向 constexpr 类型擦除 |
202306L
|
(C++26) | P2738R1 | |
| constexpr 布局 new |
202406L
|
P2747R2 | ||
__cpp_constexpr_
dynamic_alloc
|
在 constexpr 函数中的动态存储期操作 |
201907L
|
(C++20) | P0784R7 |
__cpp_constexpr_
exceptions
|
constexpr 异常: [1] , [2] |
202411L
|
(C++26) | P3068R6 |
__cpp_constexpr_
in_decltype
|
在 常量求值需要时 生成函数和变量定义 |
201711L
|
(C++20)
(DR11) |
P0859R0 |
__cpp_constinit
|
constinit |
201907L
|
(C++20) | P1143R2 |
__cpp_contracts
|
契约 |
202502L
|
(C++26) | P2900R14 |
__cpp_decltype
|
decltype |
200707L
|
(C++11) | N2343 |
__cpp_decltype_auto
|
普通函数的返回类型推导 |
201304L
|
(C++14) | N3638 |
__cpp_deduction_
guides
|
类模板的模板参数推导 (CTAD) |
201703L
|
(C++17) |
P0091R3
P0512R0 P0620R0 |
| 聚合类型与别名的CTAD |
201907L
|
(C++20) |
P1814R0
P1816R0 |
|
__cpp_delegating_
constructors
|
委托构造函数 |
200604L
|
(C++11) | N1986 |
__cpp_deleted_function
|
带消息的删除 函数定义 ( = delete ( "should have a reason" ) ; ) |
202403L
|
(C++26) | P2573R2 |
__cpp_designated_
initializers
|
指定初始化器 |
201707L
|
(C++20) | P0329R4 |
__cpp_enumerator_
attributes
|
用于 枚举项 的属性 |
201411L
|
(C++17) | N4266 |
__cpp_explicit_this_
parameter
|
显式对象参数 |
202110L
|
(C++23) | P0847R7 |
__cpp_fold_expressions
|
折叠表达式 |
201603L
|
(C++17) |
N4295
P0036R0 |
| 涉及 约束 与 折叠表达式 的排序规则 |
202406L
|
(C++26) | P2963R3 | |
__cpp_generic_lambdas
|
泛型 lambda 表达式 |
201304L
|
(C++14) | N3649 |
| 用于 泛型lambda 的显式模板参数列表 |
201707L
|
(C++20) | P0428R2 | |
__cpp_guaranteed_
copy_elision
|
通过简化的 值类别 实现保证的复制消除 |
201606L
|
(C++17) | P0135R1 |
__cpp_hex_float
|
十六进制浮点数字面量 |
201603L
|
(C++17) | P0245R1 |
__cpp_if_consteval
|
if consteval
|
202106L
|
(C++23) | P1938R3 |
__cpp_if_constexpr
|
if constexpr
|
201606L
|
(C++17) | P0292R2 |
__cpp_impl_coroutine
|
协程 (编译器支持) |
201902L
|
(C++20) |
P0912R5
LWG3393 |
__cpp_impl_destroying_
delete
|
销毁式
operator delete
(编译器支持)
|
201806L
|
(C++20) | P0722R3 |
__cpp_impl_three_
way_comparison
|
三路比较 (编译器支持) |
201907L
|
(C++20) |
P0515R3
P0768R1 P1185R2 P1630R1 |
__cpp_implicit_move
|
简化版 隐式移动 |
202207L
|
(C++23) | P2266R3 |
__cpp_inheriting_
constructors
|
继承构造函数 |
200802L
|
(C++11) | N2540 |
| 重定义继承构造函数:针对 继承构造函数 的新规范 ( DR1941 等) |
201511L
|
(C++17)
(DR11) |
P0136R1 | |
__cpp_init_captures
|
Lambda 初始化捕获 |
201304L
|
(C++14) | N3648 |
| 允许在 lambda 初始化捕获中使用包展开 |
201803L
|
(C++20) | P0780R2 | |
__cpp_initializer_
lists
|
列表初始化 和 std::initializer_list |
200806L
|
(C++11) | N2672 |
__cpp_inline_variables
|
内联变量 |
201606L
|
(C++17) | P0386R2 |
__cpp_lambdas
|
Lambda 表达式 |
200907L
|
(C++11) | N2927 |
__cpp_modules
|
Modules |
201907L
|
(C++20) |
P1103R3
P1811R0 |
__cpp_multidimensional_
subscript
|
多维 下标运算符 |
202110L
|
(C++23) | P2128R6 |
| 静态 operator[] |
202211L
|
P2589R1 | ||
__cpp_named_character_
escapes
|
命名 通用字符转义 |
202207L
|
(C++23) | P2071R2 |
__cpp_namespace_
attributes
|
用于 命名空间 的属性 |
201411L
|
(C++17) | N4266 |
__cpp_noexcept_function_
type
|
使 异常规范 成为类型系统的一部分 |
201510L
|
(C++17) | P0012R1 |
__cpp_nontype_template_
args
|
允许对所有 常量模板参数 进行常量求值 |
201411L
|
(C++17) | N4268 |
| 类类型与浮点类型在 常量模板参数 中 |
201911L
|
(C++20) | P1907R1 | |
__cpp_nontype_template_
parameter_auto
|
使用 auto 声明 常量模板参数 |
201606L
|
(C++17) | P0127R2 |
__cpp_nsdmi
|
非静态数据成员初始化器 |
200809L
|
(C++11) | N2756 |
__cpp_pack_indexing
|
包索引 |
202311L
|
(C++26) | P2662R3 |
__cpp_placeholder_
variables
|
无名称的优质占位符 |
202306L
|
(C++26) | P2169R4 |
__cpp_pp_embed
|
#embed |
202502L
|
(C++26) | P1967R14 |
__cpp_range_based_
for
|
基于范围的
for
循环
|
200907L
|
(C++11) | N2930 |
基于范围的
for
循环
支持不同的
begin
/
end
类型
|
201603L
|
(C++17) | P0184R0 | |
| 基于范围的 for 循环中的生命周期扩展 |
202211L
|
(C++23) |
P2644R1
P2718R0 CWG2659 |
|
__cpp_raw_strings
|
原始字符串字面量 |
200710L
|
(C++11) | N2442 |
__cpp_ref_qualifiers
|
引用限定符 |
200710L
|
(C++11) | N2439 |
__cpp_return_type_
deduction
|
普通函数的返回类型推导 |
201304L
|
(C++14) | N3638 |
__cpp_rvalue_references
|
右值引用 |
200610L
|
(C++11) | N2118 |
__cpp_size_t_suffix
|
用于
std::size_t
及其有符号版本的
字面量后缀
|
202011L
|
(C++23) | P0330R8 |
__cpp_sized_deallocation
|
带大小释放 |
201309L
|
(C++14) | N3778 |
__cpp_static_assert
|
static_assert |
200410L
|
(C++11) | N1720 |
单参数
static_assert
|
201411L
|
(C++17) | N3928 | |
用户生成的
static_assert
消息
|
202306L
|
(C++26) | P2741R3 | |
__cpp_static_call_
operator
|
静态 operator() |
202207L
|
(C++23) | P1169R4 |
__cpp_structured_
bindings
|
结构化绑定 |
201606L
|
(C++17) | P0217R3 |
| 属性 用于 结构化绑定 |
202403L
|
(C++26) | P0609R3 | |
| 结构化绑定 声明 作为条件 |
202406L
|
P0963R3 | ||
| 结构化绑定 可以引入一个 包 |
202411L
|
P1061R10 | ||
__cpp_template_parameters
|
概念与变量模板的模板形参 |
202502L
|
(C++26) | P2841R7 |
__cpp_template_template_
args
|
模板模板参数的 匹配 |
201611L
|
(C++17) | P0522R0 |
__cpp_threadsafe_
static_init
|
并发环境下的动态初始化与析构 |
200806L
|
(C++11) | N2660 |
__cpp_trivial_relocatability
|
平凡可重定位性 |
202502L
|
(C++26) | P2786R13 |
__cpp_trivial_union
|
平凡联合 |
202502L
|
(C++26) | P3074R7 |
__cpp_unicode_characters
|
新字符类型 ( char16_t 和 char32_t ) |
200704L
|
(C++11) | N2249 |
__cpp_unicode_literals
|
Unicode 字符串字面量 |
200710L
|
(C++11) | N2442 |
__cpp_user_defined_
literals
|
用户定义字面量 |
200809L
|
(C++11) | N2765 |
__cpp_using_enum
|
using enum |
201907L
|
(C++20) | P1099R5 |
__cpp_variable_templates
|
变量模板 |
201304L
|
(C++14) | N3651 |
__cpp_variadic_friend
|
可变参数 友元声明 |
202403L
|
(C++26) | P2893R3 |
__cpp_variadic_templates
|
可变参数模板 |
200704L
|
(C++11) | N2242 |
__cpp_variadic_using
|
using
-声明
中的包展开
|
201611L
|
(C++17) | P0195R2 |
| 宏定义总数:76 | ||||
库功能特性
以下宏可用于检测当前实现是否支持某个标准库特性。与语言特性测试宏不同,它们不是预定义的,而是由头文件 <version> 提供。
对于每个库功能测试宏,提供相关标准库组件的头文件也会提供该宏。有关提供这些宏的头文件的完整列表,请参阅 库功能测试宏 。
每个宏展开为一个整数字面量,对应功能被纳入工作草案的年份和月份。当功能发生重大变更时,相应宏将同步更新。
| 宏名称 | 特性 | 值 | 标准 | 提案文档 |
|---|---|---|---|---|
__cpp_lib_adaptor_
iterator_pair_constructor
|
std::stack 和 std::queue 的迭代器对构造函数 |
202106L
|
(C++23) | P1425R4 |
__cpp_lib_addressof_
constexpr
|
常量表达式 std::addressof |
201603L
|
(C++17) | LWG2296 |
__cpp_lib_algorithm_
default_value_type
|
启用对 列表初始化 的 算法 支持 |
202403L
|
(C++26) |
P2248R8
P3217R0 |
__cpp_lib_algorithm_
iterator_requirements
|
将范围迭代器作为非范围 算法 的输入 |
202207L
|
(C++23) | P2408R5 |
__cpp_lib_aligned_
accessor
|
std::aligned_accessor :一种表达指针超对齐的 std::mdspan 访问器 |
202411L
|
(C++26) | P2897R7 |
__cpp_lib_allocate_
at_least
|
分配器接口中的容量反馈机制,例如: std::allocator::allocate_at_least 、 std::allocator_traits::allocate_at_least |
202302L
|
(C++23) |
P0401R6
P2652R2 LWG3887 |
__cpp_lib_allocator_
traits_is_always_equal
|
std::allocator_traits::is_always_equal , noexcept 清理 |
201411L
|
(C++17) | N4258 |
__cpp_lib_any
|
std::any |
201606L
|
(C++17) |
P0220R1
P0032R3 |
__cpp_lib_apply
|
std::apply |
201603L
|
(C++17) | P0220R1 |
__cpp_lib_array_
constexpr
|
为 std::reverse_iterator 、 std::move_iterator 、 std::array 及 范围访问 提供常量表达式支持 |
201603L
|
(C++17) | P0031R0 |
| ConstexprIterator ; constexpr 对 std::array 的比较操作; 杂项 constexpr 功能( std::array::fill 等) |
201811L
|
(C++20) |
P0858R0
LWG3257 P1023R0 P1032R1 |
|
__cpp_lib_as_const
|
std::as_const |
201510L
|
(C++17) | P0007R1 |
__cpp_lib_associative_
heterogeneous_erasure
|
关联容器与无序关联容器中的 异构擦除 |
202110L
|
(C++23) | P2077R3 |
__cpp_lib_associative_
heterogeneous_insertion
|
为 有序 和 无序关联容器 中剩余成员函数提供的异构重载 |
202306L
|
(C++26) | P2363R5 |
__cpp_lib_assume_
aligned
|
std::assume_aligned |
201811L
|
(C++20) | P1007R3 |
__cpp_lib_atomic_
flag_test
|
std::atomic_flag::test |
201907L
|
(C++20) | P1135R6 |
__cpp_lib_atomic_
float
|
浮点原子类型 |
201711L
|
(C++20) | P0020R6 |
__cpp_lib_atomic_
is_always_lock_free
|
Constexpr std::atomic<T>::is_always_lock_free |
201603L
|
(C++17) | P0152R1 |
__cpp_lib_atomic_
lock_free_type_aliases
|
原子无锁整型类型 ( std::atomic_signed_lock_free , std::atomic_unsigned_lock_free ) |
201907L
|
(C++20) | P1135R6 |
__cpp_lib_atomic_
min_max
|
原子最小值/最大值操作 ( std::atomic::fetch_min , std::atomic::fetch_max 等) |
202403L
|
(C++26) | P0493R5 |
__cpp_lib_atomic_
ref
|
std::atomic_ref |
201806L
|
(C++20) | P0019R8 |
| std::atomic_ref::address() |
202411L
|
(C++26) | P2835R7 | |
__cpp_lib_atomic_
shared_ptr
|
std::atomic<std::shared_ptr> |
201711L
|
(C++20) | P0718R2 |
__cpp_lib_atomic_
value_initialization
|
修复原子初始化(默认值初始化 std::atomic ) |
201911L
|
(C++20) | P0883R2 |
__cpp_lib_atomic_
wait
|
高效的 std::atomic 等待机制 |
201907L
|
(C++20) | P1135R6 |
__cpp_lib_barrier
|
std::barrier |
201907L
|
(C++20) | P1135R6 |
| std::barrier 的相位完成保证 |
202302L
|
(C++23) | P2588R3 | |
__cpp_lib_bind_back
|
std::bind_back |
202202L
|
(C++23) | P2387R3 |
| 允许将可调用对象作为常量模板参数传递给 std::bind_back |
202306L
|
(C++26) | P2714R1 | |
__cpp_lib_bind_front
|
std::bind_front |
201907L
|
(C++20) |
P0356R5
P1651R0 |
| 允许将可调用对象作为常量模板参数传递给 std::bind_front |
202306L
|
(C++26) | P2714R1 | |
__cpp_lib_bit_cast
|
std::bit_cast |
201806L
|
(C++20) | P0476R2 |
__cpp_lib_bitops
|
位操作 |
201907L
|
(C++20) | P0553R4 |
__cpp_lib_bitset
|
连接 std::bitset 与 std::string_view |
202306L
|
(C++26) | P2697R1 |
__cpp_lib_bool_constant
|
std::bool_constant |
201505L
|
(C++17) | N4389 |
__cpp_lib_bounded_
array_traits
|
std::is_bounded_array , std::is_unbounded_array |
201902L
|
(C++20) | P1357R1 |
__cpp_lib_boyer_
moore_searcher
|
搜索器 |
201603L
|
(C++17) | P0220R1 |
__cpp_lib_byte
|
std::byte |
201603L
|
(C++17) | P0298R3 |
__cpp_lib_byteswap
|
std::byteswap |
202110L
|
(C++23) | P1272R4 |
__cpp_lib_char8_
t
|
对
char8_t
的库支持
|
201907L
|
(C++20) |
P0482R6
P1423R3 |
__cpp_lib_chrono
|
用于 std::chrono::duration 和 std::chrono::time_point 的舍入函数 |
201510L
|
(C++17) | P0092R1 |
为
std::chrono::duration
和
std::chrono::time_point
的所有成员函数添加
constexpr
|
201611L
|
P0505R0 | ||
| 日历 和 时区 |
201907L
|
(C++20) |
P0355R7
P1466R3 |
|
| 哈希 对 std::chrono 值类的支持 |
202306L
|
(C++26) | P2592R3 | |
__cpp_lib_chrono_
udls
|
时间类型的用户定义字面量 |
201304L
|
(C++14) | N3642 |
__cpp_lib_clamp
|
std::clamp |
201603L
|
(C++17) | P0025R1 |
__cpp_lib_common_
reference
|
使 std::common_reference_t 的 std::reference_wrapper 成为引用类型 |
202302L
|
(C++23) | P2655R3 |
__cpp_lib_common_
reference_wrapper
|
使 std::common_reference_t 的 std::reference_wrapper 成为引用类型 |
202302L
|
(C++23) | P2655R3 |
__cpp_lib_complex_
udls
|
std::complex
的用户定义字面量
|
201309L
|
(C++14) | N3779 |
__cpp_lib_concepts
|
标准库概念 |
202002L
|
(C++20) |
P0898R3
P1754R1 P1964R2 |
用于
equality_comparable_with
、
totally_ordered_with
和
three_way_comparable_with
的仅移动类型
|
202207L
|
(C++23) | P2404R3 | |
__cpp_lib_constexpr_
algorithms
|
用于 算法 的常量表达式 |
201806L
|
(C++20) |
P0202R3
P0879R0 LWG3256 LWG3792 |
| Constexpr 稳定排序 |
202306L
|
(C++26) | P2562R1 | |
__cpp_lib_constexpr_
atomic
|
constexpr std::atomic 和 std::atomic_ref |
202411L
|
(C++26) | P3309R3 |
__cpp_lib_constexpr_
bitset
|
更完善的 constexpr std::bitset |
202207L
|
(C++23) | P2417R2 |
__cpp_lib_constexpr_
charconv
|
用于整型类型的 std::to_chars 和 std::from_chars 的常量表达式支持 |
202207L
|
(C++23) | P2291R3 |
__cpp_lib_constexpr_
cmath
|
<cmath> 和 <cstdlib> 中数学函数的常量表达式支持 |
202202L
|
(C++23) | P0533R9 |
| 更多 constexpr 用于 <cmath> |
202306L
|
(C++26) | P1383R2 | |
__cpp_lib_constexpr_
complex
|
std::complex 的常量表达式支持 |
201711L
|
(C++20) | P0415R1 |
| 更多 constexpr 用于 <complex> |
202306L
|
(C++26) | P1383R2 | |
__cpp_lib_constexpr_
deque
|
constexpr std::deque |
202502L
|
(C++26) | P3372R3 |
__cpp_lib_constexpr_
dynamic_alloc
|
std::allocator 及相关工具的常量表达式支持 |
201907L
|
(C++20) | P0784R7 |
__cpp_lib_constexpr_
exceptions
|
constexpr 用于异常类型,例如 std::bad_alloc 、 std::bad_cast 等 |
202411L
|
(C++26) | P3068R6 |
| 异常类型的更多 constexpr 支持 |
202502L
|
P3378R2 | ||
__cpp_lib_constexpr_
flat_map
|
constexpr std::flat_map 和 std::flat_multimap |
202502L
|
(C++26) | P3372R3 |
__cpp_lib_constexpr_
flat_set
|
constexpr std::flat_set 和 std::flat_multiset |
202502L
|
(C++26) | P3372R3 |
__cpp_lib_constexpr_
forward_list
|
constexpr std::forward_list |
202502L
|
(C++26) | P3372R3 |
__cpp_lib_constexpr_
functional
|
杂项
constexpr
组件 (
std::default_searcher
);
constexpr
INVOKE
|
201907L
|
(C++20) |
P1032R1
P1065R2 |
__cpp_lib_constexpr_
inplace_vector
|
constexpr std::inplace_vector 用于非平凡类型 |
202502L
|
(C++26) | P3074R7 |
__cpp_lib_constexpr_
iterator
|
杂项 constexpr 功能 ( std::insert_iterator 等) |
201811L
|
(C++20) | P1032R1 |
__cpp_lib_constexpr_
list
|
constexpr std::list |
202502L
|
(C++26) | P3372R3 |
__cpp_lib_constexpr_
map
|
constexpr std::map 和 std::multimap |
202502L
|
(C++26) | P3372R3 |
__cpp_lib_constexpr_
memory
|
std::pointer_traits 中的常量表达式支持 |
201811L
|
(C++20) | P1006R1 |
| Constexpr std::unique_ptr |
202202L
|
(C++23) | P2273R3 | |
__cpp_lib_constexpr_
new
|
常量表达式 放置 new |
202406L
|
(C++26) | P2747R2 |
__cpp_lib_constexpr_
numeric
|
算法 的常量表达式支持 <numeric> |
201911L
|
(C++20) | P1645R1 |
__cpp_lib_constexpr_
queue
|
constexpr std::queue |
202502L
|
(C++26) | P3372R3 |
__cpp_lib_constexpr_
set
|
constexpr std::set 和 std::multiset |
202502L
|
(C++26) | P3372R3 |
__cpp_lib_constexpr_
stack
|
constexpr std::stack |
202502L
|
(C++26) | P3372R3 |
__cpp_lib_constexpr_
string
|
constexpr std::char_traits |
201611L
|
(C++17) | P0426R1 |
| constexpr std::string |
201907L
|
(C++20) | P0980R1 | |
__cpp_lib_constexpr_
string_view
|
杂项 constexpr 功能位 ( std::string_view::copy ) |
201811L
|
(C++20) | P1032R1 |
__cpp_lib_constexpr_
tuple
|
杂项 constexpr 功能位 ( std::tuple::operator= 等) |
201811L
|
(C++20) | P1032R1 |
__cpp_lib_constexpr_
typeinfo
|
std::type_info::operator== 的常量表达式支持 |
202106L
|
(C++23) | P1328R1 |
__cpp_lib_constexpr_
unordered_map
|
constexpr std::unordered_map 和 std::unordered_multimap |
202502L
|
(C++26) | P3372R3 |
__cpp_lib_constexpr_
unordered_set
|
constexpr std::unordered_set 和 std::unordered_multiset |
202502L
|
(C++26) | P3372R3 |
__cpp_lib_constexpr_
utility
|
杂项 constexpr 功能位 ( std::pair::operator= 等) |
201811L
|
(C++20) | P1032R1 |
__cpp_lib_constexpr_
vector
|
std::vector 的常量表达式支持 |
201907L
|
(C++20) | P1004R2 |
__cpp_lib_constrained_
equality
|
为 std::pair 、 std::tuple 、 std::optional 和 std::variant 提供约束关系运算符 |
202403L
|
(C++26) | P2944R3 |
| 约束 std::expected 相等运算符 |
202411L
|
P3379R0 | ||
__cpp_lib_containers_
ranges
|
面向范围 的容器与字符串构造及插入操作 |
202202L
|
(C++23) | P1206R7 |
__cpp_lib_contracts
|
<contracts> :契约支持 |
202502L
|
(C++26) | P2900R14 |
__cpp_lib_copyable_
function
|
std::copyable_function |
202306L
|
(C++26) | P2548R6 |
__cpp_lib_coroutine
|
协程 (库支持) |
201902L
|
(C++20) |
P0912R5
LWG3393 |
__cpp_lib_debugging
|
<debugging> : 调试支持 |
202311L
|
(C++26) | P2546R5 |
| 可替换的 std::is_debugger_present |
202403L
|
P2810R4 | ||
__cpp_lib_destroying_
delete
|
销毁式 operator delete (库支持) |
201806L
|
(C++20) | P0722R3 |
__cpp_lib_enable_
shared_from_this
|
std::enable_shared_from_this::weak_from_this |
201603L
|
(C++17) | P0033R1 |
__cpp_lib_endian
|
std::endian |
201907L
|
(C++20) |
P0463R1
P1612R1 |
__cpp_lib_erase_
if
|
统一容器擦除 |
202002L
|
(C++20) |
P1209R0
P1115R3 |
__cpp_lib_exchange_
function
|
std::exchange |
201304L
|
(C++14) | N3668 |
__cpp_lib_execution
|
执行策略 |
201603L
|
(C++17) | P0024R2 |
| std::execution::unsequenced_policy |
201902L
|
(C++20) | P1001R2 | |
__cpp_lib_expected
|
类模板 std::expected |
202202L
|
(C++23) | P0323R12 |
| 用于 std::expected 的单子函数 |
202211L
|
P2505R5 | ||
__cpp_lib_filesystem
|
文件系统库 |
201703L
|
(C++17) |
P0218R1
P0219R1 P0392R0 P0317R1 |
__cpp_lib_flat_map
|
std::flat_map 和 std::flat_multimap |
202207L
|
(C++23) | P0429R9 |
__cpp_lib_flat_set
|
std::flat_set 和 std::flat_multiset |
202207L
|
(C++23) |
P1222R4
LWG3751 |
__cpp_lib_format
|
文本格式化 |
201907L
|
(C++20) |
P0645R10
P1361R2 P1652R1 |
| 编译时格式字符串检查;减少 std::vformat_to 的参数化 |
202106L
|
(C++23)
(DR20) |
P2216R3 | |
| 修复chrono格式化器中的区域设置处理;支持非常量可格式化类型 |
202110L
|
P2372R3
P2418R2 |
||
| 公开 std::basic_format_string ;明确时间类型本地化格式化中的编码处理方式 |
202207L
|
(C++23) |
P2419R2
P2508R1 |
|
| 格式化指针 |
202304L
|
(C++26) | P2510R3 | |
| 类型检查格式参数 |
202305L
|
P2757R3 | ||
| 成员函数 visit |
202306L
|
P2637R3 | ||
| 运行时格式字符串 |
202311L
|
P2918R2 | ||
__cpp_lib_format_
path
|
std::filesystem::path 的格式化 |
202403L
|
(C++26) | P2845R8 |
__cpp_lib_format_
ranges
|
格式化范围 |
202207L
|
(C++23) |
P2286R8
P2585R1 LWG3750 |
__cpp_lib_format_
uchar
|
将代码单元格式化为整数的修复 |
202311L
|
(C++26) | P2909R4 |
__cpp_lib_formatters
|
格式化 std::thread::id 和 std::stacktrace |
202302L
|
(C++23) | P2693R1 |
__cpp_lib_forward_
like
|
std::forward_like |
202207L
|
(C++23) | P2445R1 |
__cpp_lib_freestanding_
algorithm
|
<algorithm> 中的独立设施 |
202311L
|
(C++26) | P2407R5 |
| 独立库: <algorithm> |
202502L
|
P2976R1 | ||
__cpp_lib_freestanding_
array
|
使 std::array 的部分组件可独立部署 |
202311L
|
(C++26) | P2407R5 |
__cpp_lib_freestanding_
char_traits
|
独立环境 std::char_traits |
202306L
|
(C++26) | P2338R4 |
__cpp_lib_freestanding_
charconv
|
<charconv> 中的独立环境设施 |
202306L
|
(C++26) | P2338R4 |
__cpp_lib_freestanding_
cstdlib
|
<cstdlib> 中的独立环境设施 |
202306L
|
(C++26) | P2338R4 |
__cpp_lib_freestanding_
cstring
|
<cstring> 中的独立环境设施 |
202306L
|
(C++26) | P2338R4 |
| 从独立设施中移除 std::strtok |
202311L
|
P2937R0 | ||
__cpp_lib_freestanding_
cwchar
|
<cwchar> 中的独立环境设施 |
202306L
|
(C++26) | P2338R4 |
__cpp_lib_freestanding_
errc
|
独立环境 std::errc |
202306L
|
(C++26) | P2338R4 |
__cpp_lib_freestanding_
execution
|
独立环境库: <execution> |
202502L
|
(C++26) | P2976R1 |
__cpp_lib_freestanding_
expected
|
使 std::expected 的部分功能支持独立环境 |
202311L
|
(C++26) | P2833R2 |
__cpp_lib_freestanding_
feature_test_macros
|
对独立环境特性测试宏的支持 |
202306L
|
(C++26) | P2198R7 |
__cpp_lib_freestanding_
functional
|
<functional> 中的独立环境设施 |
202306L
|
(C++26) | P2198R7 |
__cpp_lib_freestanding_
iterator
|
<iterator> 中的独立环境设施 |
202306L
|
(C++26) | P2198R7 |
__cpp_lib_freestanding_
mdspan
|
独立环境 std::mdspan |
202311L
|
(C++26) | P2833R2 |
__cpp_lib_freestanding_
memory
|
<memory> 中的独立环境设施 |
202306L
|
(C++26) | P2198R7 |
| 独立库: <memory> |
202502L
|
P2976R1 | ||
__cpp_lib_freestanding_
numeric
|
<numeric> 中的独立环境设施 (饱和算术) |
202311L
|
(C++26) | P0543R3 |
| 独立库: <numeric> |
202502L
|
P2976R1 | ||
__cpp_lib_freestanding_
operator_new
|
operator new 的定义 (在独立实现中为可选) |
202306L
|
(C++26) | P2198R7 |
__cpp_lib_freestanding_
optional
|
使 std::optional 的部分功能支持独立环境 |
202311L
|
(C++26) | P2407R5 |
__cpp_lib_freestanding_
random
|
独立库实现: <random> |
202502L
|
(C++26) | P2976R1 |
__cpp_lib_freestanding_
ranges
|
<ranges> 中的独立环境设施 |
202306L
|
(C++26) | P2198R7 |
__cpp_lib_freestanding_
ratio
|
<ratio> 中的独立环境设施 |
202306L
|
(C++26) | P2198R7 |
__cpp_lib_freestanding_
string_view
|
使 std::string_view 的部分功能支持独立环境 |
202311L
|
(C++26) | P2407R5 |
__cpp_lib_freestanding_
tuple
|
<tuple> 中的独立环境设施 |
202306L
|
(C++26) | P2198R7 |
__cpp_lib_freestanding_
utility
|
|
202306L
|
(C++26) | P2198R7 |
__cpp_lib_freestanding_
variant
|
使 std::variant 的部分组件可独立部署 |
202311L
|
(C++26) | P2407R5 |
__cpp_lib_fstream_
native_handle
|
从文件流获取原生句柄 |
202306L
|
(C++26) | P1759R6 |
__cpp_lib_function_
ref
|
std::function_ref :类型擦除的可调用引用 |
202306L
|
(C++26) | P0792R14 |
__cpp_lib_gcd_lcm
|
std::gcd , std::lcm |
201606L
|
(C++17) | P0295R0 |
__cpp_lib_generator
|
std::generator :用于范围的同步协程生成器 |
202207L
|
(C++23) | P2502R2 |
__cpp_lib_generic_
associative_lookup
|
关联容器中的 异构比较查找 |
201304L
|
(C++14) | N3657 |
__cpp_lib_generic_
unordered_lookup
|
无序关联容器中的 异构比较查找 |
201811L
|
(C++20) | P0919R3 |
__cpp_lib_hardened_
array
|
标准库强化 (仅在强化实现中提供) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
basic_string
|
标准库强化 (仅在强化实现中提供) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
basic_string_view
|
标准库强化 (仅在强化实现中提供) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
bitset
|
标准库强化 (仅在强化实现中提供) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
deque
|
标准库强化 (仅在强化实现中提供) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
expected
|
标准库强化 (仅在强化实现中提供) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
forward_list
|
标准库强化 (仅存在于强化实现中) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
inplace_vector
|
标准库强化 (仅在强化实现中提供) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
list
|
标准库强化 (仅存在于强化实现中) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
mdspan
|
标准库强化 (仅在强化实现中提供) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
optional
|
标准库强化 (仅在强化实现中提供) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
span
|
标准库强化 (仅在强化实现中提供) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
valarray
|
标准库强化 (仅在强化实现中提供) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardened_
vector
|
标准库强化 (仅在强化实现中提供) |
202502L
|
(C++26) | P3471R4 |
__cpp_lib_hardware_
interference_size
|
Constexpr std::hardware_{constructive, destructive}_interference_size |
201703L
|
(C++17) | P0154R1 |
__cpp_lib_hive
|
<hive> :一种基于桶的容器,可重用被擦除元素的内存位置 |
202502L
|
(C++26) | P0447R28 |
__cpp_lib_has_unique_
object_representations
|
std::has_unique_object_representations |
201606L
|
(C++17) | P0258R2 |
__cpp_lib_hazard_
pointer
|
<hazard_pointer> :危险指针 |
202306L
|
(C++26) | P2530R3 |
__cpp_lib_hypot
|
std::hypot 的三参数重载 |
201603L
|
(C++17) | P0030R1 |
__cpp_lib_incomplete_
container_elements
|
针对 std::forward_list 、 std::list 和 std::vector 的最小化不完整类型支持 |
201505L
|
(C++17) | N4510 |
__cpp_lib_indirect
|
std::indirect |
202502L
|
(C++26) | P3019R13 |
__cpp_lib_inplace_
vector
|
std::inplace_vector :具有固定容量的动态可调整大小向量(就地存储) |
202406L
|
(C++26) | P0843R14 |
__cpp_lib_int_pow2
|
整型二次幂运算 ( std::has_single_bit , std::bit_ceil , std::bit_floor , std::bit_width ) |
202002L
|
(C++20) |
P0556R3
P1956R1 |
__cpp_lib_integer_
comparison_functions
|
整数比较函数 |
202002L
|
(C++20) | P0586R2 |
__cpp_lib_integer_
sequence
|
编译期整数序列 |
201304L
|
(C++14) | N3658 |
__cpp_lib_integral_
constant_callable
|
std::integral_constant::operator() |
201304L
|
(C++14) | N3545 |
__cpp_lib_interpolate
|
std::lerp , std::midpoint |
201902L
|
(C++20) | P0811R3 |
__cpp_lib_invoke
|
std::invoke |
201411L
|
(C++17) | N4169 |
__cpp_lib_invoke_
r
|
std::invoke_r |
202106L
|
(C++23) | P2136R3 |
__cpp_lib_ios_noreplace
|
支持 独占模式 用于文件流 |
202207L
|
(C++23) | P2467R1 |
__cpp_lib_is_aggregate
|
std::is_aggregate |
201703L
|
(C++17) | LWG2911 |
__cpp_lib_is_constant_
evaluated
|
std::is_constant_evaluated |
201811L
|
(C++20) | P0595R2 |
__cpp_lib_is_final
|
std::is_final |
201402L
|
(C++14) | LWG2112 |
__cpp_lib_is_implicit_
lifetime
|
std::is_implicit_lifetime |
202302L
|
(C++23) | P2674R1 |
__cpp_lib_is_invocable
|
std::is_invocable , std::invoke_result |
201703L
|
(C++17) | P0604R0 |
__cpp_lib_is_layout_
compatible
|
std::is_layout_compatible |
201907L
|
(C++20) | P0466R5 |
__cpp_lib_is_nothrow_
convertible
|
std::is_convertible |
201806L
|
(C++20) |
P0758R1
LWG3356 |
__cpp_lib_is_null_
pointer
|
std::is_null_pointer |
201309L
|
(C++14)
(DR11) |
LWG2247 |
__cpp_lib_is_pointer_
interconvertible
|
指针可互转换特性: std::is_pointer_interconvertible_with_class , std::is_pointer_interconvertible_base_of |
201907L
|
(C++20) | P0466R5 |
__cpp_lib_is_scoped_
enum
|
std::is_scoped_enum |
202011L
|
(C++23) | P1048R1 |
__cpp_lib_is_sufficiently_
aligned
|
std::is_sufficiently_aligned :检查指针的对齐前提条件 |
202411L
|
(C++26) | P2897R7 |
__cpp_lib_is_swappable
|
(无抛出)可交换特性 |
201603L
|
(C++17) | P0185R1 |
__cpp_lib_is_virtual_
base_of
|
std::is_virtual_base_of :用于检测虚基类的类型特征 |
202406L
|
(C++26) | P2985R0 |
__cpp_lib_is_within_
lifetime
|
检查联合体成员是否处于生存期内 ( std::is_within_lifetime ) |
202306L
|
(C++26) | P2641R4 |
__cpp_lib_jthread
|
停止令牌 与 可汇合线程 |
201911L
|
(C++20) |
P0660R10
P1869R1 |
__cpp_lib_latch
|
std::latch |
201907L
|
(C++20) | P1135R6 |
__cpp_lib_launder
|
CWG 问题 1776 :包含引用成员的类对象替换( std::launder ) |
201606L
|
(C++17) | P0137R1 |
__cpp_lib_linalg
|
基于BLAS的免费函数线性代数接口 |
202311L
|
(C++26) | P1673R13 |
__cpp_lib_list_remove_
return_type
|
更改
std::forward_list
和
std::list
的
remove()
、
remove_if()
及
unique()
成员函数的返回类型
|
201806L
|
(C++20) | P0646R1 |
__cpp_lib_logical_
traits
|
类型特征上的逻辑操作 |
201510L
|
(C++17) | P0013R1 |
__cpp_lib_make_from_
tuple
|
std::make_from_tuple |
201606L
|
(C++17) | P0209R2 |
__cpp_lib_make_reverse_
iterator
|
std::make_reverse_iterator |
201402L
|
(C++14) | LWG2285 |
__cpp_lib_make_unique
|
std::make_unique |
201304L
|
(C++14) | N3656 |
__cpp_lib_map_try_
emplace
|
std::map::try_emplace , std::map::insert_or_assign |
201411L
|
(C++17) | N4279 |
__cpp_lib_math_constants
|
数学常量 |
201907L
|
(C++20) | P0631R8 |
__cpp_lib_math_special_
functions
|
数学特殊函数 |
201603L
|
(C++17) | P0226R1 |
__cpp_lib_mdspan
|
std::mdspan |
202207L
|
(C++23) |
P0009R18
P2599R2 P2604R0 P2613R1 |
| std::dims 用于 std::mdspan |
202406L
|
(C++26) | P2389R2 | |
__cpp_lib_memory_
resource
|
std::pmr::memory_resource |
201603L
|
(C++17) | P0220R1 |
__cpp_lib_modules
|
标准库模块
std
和
std.compat
|
202207L
|
(C++23) | P2465R3 |
__cpp_lib_move_iterator_
concept
|
使 std::move_iterator<T*> 成为随机访问迭代器 |
202207L
|
(C++23) | P2520R0 |
__cpp_lib_move_only_
function
|
std::move_only_function |
202110L
|
(C++23) | P0288R9 |
__cpp_lib_node_extract
|
映射与集合的节点拼接( std::map::extract 、 std::map::merge 、 insert(node_type) 等) |
201606L
|
(C++17) | P0083R3 |
__cpp_lib_nonmember_
container_access
|
std::size 、 std::data 和 std::empty |
201411L
|
(C++17) | N4280 |
__cpp_lib_not_fn
|
std::not_fn |
201603L
|
(C++17) | P0005R4 |
| 允许将可调用对象作为常量模板参数传递给 std::not_fn |
202306L
|
(C++26) | P2714R1 | |
__cpp_lib_null_iterators
|
空 LegacyForwardIterator s |
201304L
|
(C++14) | N3644 |
__cpp_lib_optional
|
std::optional |
201606L
|
(C++17) |
P0220R1
P0032R3 P0307R2 |
| 完全 constexpr std::optional |
202106L
|
(C++23)
(DR20) |
P2231R1 | |
| 单子操作 于 std::optional |
202110L
|
(C++23) |
P0798R8
LWG3621 |
|
__cpp_lib_optional_
range_support
|
std::optional 范围支持 |
202406L
|
(C++26) | P3168R2 |
__cpp_lib_out_ptr
|
std::out_ptr , std::inout_ptr |
202106L
|
(C++23) | P1132R8 |
| 独立实现 std::out_ptr , std::inout_ptr |
202311L
|
(C++26) | P2833R2 | |
__cpp_lib_parallel_
algorithm
|
并行算法 |
201603L
|
(C++17) | P0024R2 |
__cpp_lib_polymorphic
|
std::polymorphic |
202502L
|
(C++26) | P3019R13 |
__cpp_lib_polymorphic_
allocator
|
std::pmr::polymorphic_allocator<> 作为词汇类型 |
201902L
|
(C++20) |
P0339R6
LWG3437 |
__cpp_lib_print
|
格式化输出 |
202207L
|
(C++23) | P2093R14 |
| 允许高效实现 std::print |
202403L
|
(C++26)
(DR23) |
P3107R5
P3235R3 |
|
| 使用 std::println 打印空行 |
202403L
|
(C++26) | P3142R0 | |
__cpp_lib_quoted_
string_io
|
std::quoted |
201304L
|
(C++14) | N3654 |
__cpp_lib_philox_
engine
|
std::philox_engine :基于计数器的随机数引擎 |
202406L
|
(C++26) | P2075R6 |
__cpp_lib_ranges
|
范围库 与 约束算法 |
201911L
|
(C++20) |
P0896R4
P1035R7 P1716R3 |
| 非 可默认初始化 视图 |
202106L
|
(C++23)
(DR20) |
P2325R3 | |
| 视图 具有 所有权 |
202110L
|
P2415R2 | ||
| std::ranges::range_adaptor_closure |
202202L
|
(C++23) | P2387R3 | |
| 放宽 范围适配器 以支持仅移动类型 |
202207L
|
P2494R2 | ||
| 移除 ranges::begin 、 ranges::end 、 ranges::rbegin 、 ranges::rend 和 ranges::size 中的“毒丸”重载 |
202211L
|
P2602R2 | ||
| 放宽范围以允许特定投影 |
202302L
|
P2609R3 | ||
| 从间接可调用概念中移除共同引用要求 |
202406L
|
(C++26)
(DR20) |
P2997R1 | |
__cpp_lib_ranges_
as_const
|
std::const_iterator , std::ranges::as_const_view |
202207L
|
(C++23) | P2278R4 |
| 使 std::basic_const_iterator 遵循其底层类型的可转换性 |
202311L
|
(C++26) | P2836R1 | |
__cpp_lib_ranges_
as_rvalue
|
std::ranges::as_rvalue_view |
202207L
|
(C++23) | P2446R2 |
__cpp_lib_ranges_
cache_latest
|
std::ranges::cache_latest_view |
202411L
|
(C++26) | P3138R5 |
__cpp_lib_ranges_
cartesian_product
|
std::ranges::cartesian_product_view |
202207L
|
(C++23) |
P2374R4
P2540R1 |
__cpp_lib_ranges_
chunk
|
std::ranges::chunk_view |
202202L
|
(C++23) | P2442R1 |
__cpp_lib_ranges_
chunk_by
|
std::ranges::chunk_by_view |
202202L
|
(C++23) | P2443R1 |
__cpp_lib_ranges_
concat
|
std::ranges::concat_view |
202403L
|
(C++26) | P2542R8 |
__cpp_lib_ranges_
contains
|
std::ranges::contains |
202207L
|
(C++23) | P2302R4 |
__cpp_lib_ranges_
enumerate
|
std::ranges::enumerate_view |
202302L
|
(C++23) | P2164R9 |
__cpp_lib_ranges_
find_last
|
std::ranges::find_last 、 std::ranges::find_last_if 和 std::ranges::find_last_if_not |
202207L
|
(C++23) |
P1223R5
LWG3807 |
__cpp_lib_ranges_
fold
|
std::ranges
折叠算法
|
202207L
|
(C++23) | P2322R6 |
__cpp_lib_ranges_
generate_random
|
用于随机数生成的向量API ( std::ranges::generate_random ) |
202403L
|
(C++26) | P1068R11 |
__cpp_lib_ranges_
iota
|
std::ranges::iota |
202202L
|
(C++23) | P2440R1 |
__cpp_lib_ranges_
join_with
|
std::ranges::join_with_view |
202202L
|
(C++23) | P2441R2 |
__cpp_lib_ranges_
repeat
|
std::ranges::repeat_view |
202207L
|
(C++23) | P2474R2 |
__cpp_lib_ranges_
reserve_hint
|
std::ranges::approximately_sized_range 和 std::ranges::reserve_hint |
202502L
|
(C++26) | P2846R6 |
__cpp_lib_ranges_
slide
|
std::ranges::slide_view |
202202L
|
(C++23) | P2442R1 |
__cpp_lib_ranges_
starts_ends_with
|
std::ranges::starts_with , std::ranges::ends_with |
202106L
|
(C++23) | P1659R3 |
__cpp_lib_ranges_
stride
|
std::ranges::stride_view |
202207L
|
(C++23) | P1899R3 |
__cpp_lib_ranges_
to_container
|
std::ranges::to |
202202L
|
(C++23) | P1206R7 |
__cpp_lib_ranges_
to_input
|
std::ranges::to_input_view |
202502L
|
(C++26) | P3137R3 |
__cpp_lib_ranges_
zip
|
std::ranges::zip_view , std::ranges::zip_transform_view , std::ranges::adjacent_view , std::ranges::adjacent_transform_view |
202110L
|
(C++23) | P2321R2 |
__cpp_lib_ratio
|
新增2022年国际单位制词头 |
202306L
|
(C++26) | P2734R0 |
__cpp_lib_raw_memory_
algorithms
|
扩展内存管理工具 |
201606L
|
(C++17) | P0040R3 |
| constexpr 用于 专用内存算法 |
202411L
|
(C++26) |
P3508R0
P3369R0 |
|
__cpp_lib_rcu
|
<rcu> : 读-复制更新 (RCU) |
202306L
|
(C++26) | P2545R4 |
__cpp_lib_reference_
from_temporary
|
std::reference_constructs_from_temporary 和 std::reference_converts_from_temporary |
202202L
|
(C++23) | P2255R2 |
__cpp_lib_reference_
wrapper
|
std::reference_wrapper 的比较操作 |
202403L
|
(C++26) | P2944R3 |
__cpp_lib_remove_
cvref
|
std::remove_cvref |
201711L
|
(C++20) | P0550R2 |
__cpp_lib_result_
of_sfinae
|
std::result_of 和 SFINAE |
201210L
|
(C++14) | N3462 |
__cpp_lib_robust_
nonmodifying_seq_ops
|
增强非修改序列操作的健壮性(为 std::mismatch 、 std::equal 和 std::is_permutation 提供双范围重载版本) |
201304L
|
(C++14) | N3671 |
__cpp_lib_sample
|
std::sample |
201603L
|
(C++17) | P0220R1 |
__cpp_lib_saturation_
arithmetic
|
饱和算术 |
202311L
|
(C++26) | P0543R3 |
__cpp_lib_scoped_
lock
|
std::scoped_lock |
201703L
|
(C++17) | P0156R2 |
__cpp_lib_semaphore
|
std::counting_semaphore
,
std::binary_semaphore
|
201907L
|
(C++20) | P1135R6 |
__cpp_lib_senders
|
std::execution :执行控制的发送者-接收者模型 |
202406L
|
(C++26) | P2300R10 |
__cpp_lib_shared_
mutex
|
std::shared_mutex (非定时) |
201505L
|
(C++17) | N4508 |
__cpp_lib_shared_
ptr_arrays
|
std::shared_ptr<T[]> |
201611L
|
(C++17) | P0497R0 |
| 对数组的 std::make_shared 支持 |
201707L
|
(C++20) | P0674R1 | |
__cpp_lib_shared_
ptr_weak_type
|
shared_ptr::weak_type |
201606L
|
(C++17) | P0163R0 |
__cpp_lib_shared_
timed_mutex
|
std::shared_timed_mutex |
201402L
|
(C++14) | N3891 |
__cpp_lib_shift
|
std::shift_left 和 std::shift_right |
201806L
|
(C++20) | P0769R2 |
| std::ranges::shift_left 和 std::ranges::shift_right |
202202L
|
(C++23) | P2440R1 | |
__cpp_lib_simd
|
<simd> : 数据并行类型 |
202411L
|
(C++26) |
P1928R15
P3430R3 P3441R2 P3287R3 P2933R4 |
__cpp_lib_simd_complex
|
支持交错复数数值于 std::datapar::simd |
202502L
|
(C++26) | P2663R7 |
__cpp_lib_smart_
ptr_for_overwrite
|
具有默认初始化的智能指针创建( std::allocate_shared_for_overwrite 、 std::make_shared_for_overwrite 、 std::make_unique_for_overwrite ) |
202002L
|
(C++20) |
P1020R1
P1973R1 |
__cpp_lib_smart_
ptr_owner_equality
|
允许将 std::weak_ptr 用作 无序关联容器 的键 |
202306L
|
(C++26) | P1901R2 |
__cpp_lib_source_
location
|
源代码信息捕获 ( std::source_location ) |
201907L
|
(C++20) | P1208R6 |
__cpp_lib_span
|
std::span |
202002L
|
(C++20) |
P0122R7
LWG3274 P1024R3 P1976R2 |
| 使 std::span 的部分功能独立化 |
202311L
|
(C++26) |
P2821R5
P2833R2 |
|
__cpp_lib_span_initializer_
list
|
从初始化列表构造 std::span |
202311L
|
(C++26) | P2447R6 |
__cpp_lib_spanstream
|
std::spanbuf , std::spanstream |
202106L
|
(C++23) | P0448R4 |
__cpp_lib_ssize
|
std::ssize 和无符号的 std::span::size |
201902L
|
(C++20) | P1227R2 |
__cpp_lib_sstream_
from_string_view
|
实现 std::stringstream 与 std::string_view 的交互操作 |
202306L
|
(C++26) | P2495R3 |
__cpp_lib_stacktrace
|
堆栈追踪库 |
202011L
|
(C++23) | P0881R7 |
__cpp_lib_start_
lifetime_as
|
显式生命周期管理 ( std::start_lifetime_as ) |
202207L
|
(C++23) | P2590R2 |
__cpp_lib_starts_
ends_with
|
字符串前缀与后缀检查(
starts_with()
和
ends_with()
用于
std::string
及
std::string_view
)
|
201711L
|
(C++20) | P0457R2 |
__cpp_lib_stdatomic_
h
|
用于C原子操作的兼容性头文件 |
202011L
|
(C++23) | P0943R6 |
__cpp_lib_string_
contains
|
contains()
用于
std::basic_string
和
std::basic_string_view
|
202011L
|
(C++23) | P1679R3 |
__cpp_lib_string_
resize_and_overwrite
|
std::basic_string::resize_and_overwrite |
202110L
|
(C++23) | P1072R10 |
__cpp_lib_string_
udls
|
字符串类型的用户定义字面量 |
201304L
|
(C++14) | N3642 |
__cpp_lib_string_
view
|
std::string_view |
201606L
|
(C++17) |
P0220R1
P0254R2 |
| ConstexprIterator |
201803L
|
(C++20) |
P0858R0
LWG3257 |
|
| 字符串连接 的 std::string 与 std::string_view 操作 |
202403L
|
(C++26) | P2591R5 | |
__cpp_lib_submdspan
|
std::submdspan |
202306L
|
(C++26) | P2630R4 |
| 填充式 mdspan 布局 |
202403L
|
P2642R6 | ||
__cpp_lib_syncbuf
|
同步缓冲输出流 ( std::syncbuf , std::osyncstream ) 及其操纵器 |
201803L
|
(C++20) |
P0053R7
P0753R2 |
__cpp_lib_text_encoding
|
std::text_encoding |
202306L
|
(C++26) | P1885R12 |
__cpp_lib_three_
way_comparison
|
三路比较 (库支持);向库中添加三路比较功能 |
201907L
|
(C++20) |
P0768R1
P1614R2 |
__cpp_lib_to_address
|
将指针转换为原始指针的工具( std::to_address ) |
201711L
|
(C++20) | P0653R2 |
__cpp_lib_to_array
|
std::to_array |
201907L
|
(C++20) | P0325R4 |
__cpp_lib_to_chars
|
基础字符串转换 ( std::to_chars , std::from_chars ) |
201611L
|
(C++17) |
P0067R5
P0682R1 LWG3137 |
| 测试 <charconv> 函数的成功或失败 |
202306L
|
(C++26) | P2497R0 | |
__cpp_lib_to_string
|
基于 std::to_string 重新定义 std::format |
202306L
|
(C++26) | P2587R3 |
__cpp_lib_to_underlying
|
std::to_underlying |
202102L
|
(C++23) | P1682R3 |
__cpp_lib_transformation_
trait_aliases
|
用于 转换特征 的别名模板 |
201304L
|
(C++14) | N3655 |
__cpp_lib_transparent_
operators
|
透明运算符函子 ( std::less<> 等) |
201210L
|
(C++14) | N3421 |
| 透明 std::owner_less ( std::owner_less<void> ) |
201510L
|
(C++17) | P0074R0 | |
__cpp_lib_trivially_
relocatable
|
平凡可重定位特性与操作 |
202502L
|
(C++26) | P2786R13 |
__cpp_lib_tuple_
element_t
|
std::tuple_element_t |
201402L
|
(C++14) | N3887 |
__cpp_lib_tuple_
like
|
std::tuple 与类元组对象( std::pair 、 std::array 、 std::subrange )的兼容性 |
202207L
|
(C++23) | P2165R4 |
| 为 std::complex 添加元组协议 |
202311L
|
(C++26) | P2819R2 | |
__cpp_lib_tuples_
by_type
|
通过类型访问元组 |
201304L
|
(C++14) | N3670 |
__cpp_lib_type_identity
|
std::type_identity |
201806L
|
(C++20) | P0887R1 |
__cpp_lib_type_trait_
variable_templates
|
类型特征变量模板 ( std::is_void_v 等) |
201510L
|
(C++17) | P0006R0 |
__cpp_lib_uncaught_
exceptions
|
std::uncaught_exceptions |
201411L
|
(C++17) | N4259 |
__cpp_lib_unordered_
map_try_emplace
|
std::unordered_map::try_emplace , std::unordered_map::insert_or_assign |
201411L
|
(C++17) | N4279 |
__cpp_lib_unreachable
|
std::unreachable |
202202L
|
(C++23) | P0627R6 |
__cpp_lib_unwrap_
ref
|
std::unwrap_ref_decay 和 std::unwrap_reference |
201811L
|
(C++20) |
P0318R1
LWG3348 |
__cpp_lib_variant
|
std::variant :C++17 的类型安全联合 |
201606L
|
(C++17) |
P0088R3
P0393R3 P0032R3 |
| std::visit 用于派生自 std::variant 的类 |
202102L
|
(C++23)
(DR17) |
P2162R2 | |
| 完全 constexpr std::variant |
202106L
|
(C++23)
(DR20) |
P2231R1 | |
| 成员函数 visit |
202306L
|
(C++26) | P2637R3 | |
__cpp_lib_void_t
|
std::void_t |
201411L
|
(C++17) | N3911 |
| 宏定义总数:282 | ||||
示例
常规用法
#ifdef __has_include // 检查 __has_include 是否存在 # if __has_include(<optional>) // 检查标准库 # include <optional> # elif __has_include(<experimental/optional>) // 检查实验版本 # include <experimental/optional> # elif __has_include(<boost/optional.hpp>) // 尝试外部库 # include <boost/optional.hpp> # else // 完全未找到 # error "Missing <optional>" # endif #endif #ifdef __has_cpp_attribute // 检查 __has_cpp_attribute 是否存在 # if __has_cpp_attribute(deprecated) // 检查属性 # define DEPRECATED(msg) [[deprecated(msg)]] # endif #endif #ifndef DEPRECATED # define DEPRECATED(msg) #endif DEPRECATED("foo() has been deprecated") void foo(); #if __cpp_constexpr >= 201304 // 检查特性的特定版本 # define CONSTEXPR constexpr #else # define CONSTEXPR inline #endif CONSTEXPR int bar(unsigned i) { #if __cpp_binary_literals // 检查特性是否存在 unsigned mask1 = 0b11000000; unsigned mask2 = 0b00000111; #else unsigned mask1 = 0xC0; unsigned mask2 = 0x07; #endif if (i & mask1) return 1; if (i & mask2) return 2; return 0; } int main() {}
编译器功能清单
以下(兼容C++11的)程序用于输出C++编译器特性与属性信息。 请注意, __has_cpp_attribute ( ) 的使用方式并不 符合规范 ,且依赖于gcc/clang的实现。
static constexpr struct choose_what_and_how_to_print { constexpr static int longest_macro_name { 45 }; constexpr static bool titles = 1; constexpr static bool counters = 1; constexpr static bool attributes = 1; constexpr static bool standard_values = 1; constexpr static bool compiler_specific = 1; constexpr static bool core_features = 1; constexpr static bool lib_features = 1; constexpr static bool supported_features = 1; constexpr static bool unsupported_features = 1; constexpr static bool sort_by_date = 0; constexpr static bool separate_year_month = 1; constexpr static bool separated_revisions = 1; constexpr static bool latest_revisions = 1; constexpr static bool cxx98 = 0; constexpr static bool cxx11 = 1; constexpr static bool cxx14 = 1; constexpr static bool cxx17 = 1; constexpr static bool cxx20 = 1; constexpr static bool cxx23 = 1; constexpr static bool cxx26 = 1; constexpr static bool cxx29 = 0; } print; #if __cplusplus < 201100 # error "需要 C++11 或更高版本" #endif #include <algorithm> #include <cstdio> #include <cstring> #include <utility> #include <vector> #ifdef __has_include # if __has_include(<version>) # include <version> # endif # if __has_include(<stdfloat>) # include <stdfloat> # endif #endif // 期望一个以6位十进制数字或'_'开头的字符串(若不支持) #define COMPILER_VALUE_INT(n) #n [0] == '_' ? 0 : \ (#n[5] - '0') + (#n[4] - '0') * 10 + (#n[3] - '0') * 100 + \ (#n[2] - '0') * 1000 + (#n[1] - '0') * 10000 + (#n[0] - '0') * 100000 #define COMPILER_FEATURE_ENTRY(expect, name) { #name, COMPILER_VALUE_INT(name), expect }, #if defined(__has_cpp_attribute) && defined(__GNUG__) # define COMPILER_ATTRIBUTE(expect, name) { #name, __has_cpp_attribute(name), expect }, #else # define COMPILER_ATTRIBUTE(expect, name) { #name, COMPILER_VALUE_INT(name), expect }, #endif #define COMPILER_SPECIFIC_STRING(value) #value #define COMPILER_SPECIFIC_ENTRY(name) { #name, COMPILER_SPECIFIC_STRING(name) }, class CompilerFeature { char const* name_; long data_; long std_; public: constexpr CompilerFeature(char const* name, long data, long std) : name_(name), data_(data), std_(std) {} constexpr CompilerFeature(CompilerFeature const&) = default; CompilerFeature& operator=(CompilerFeature const&) = default; bool operator<(CompilerFeature const& rhs) const { return std::strcmp(name_, rhs.name_) < 0; } bool operator==(CompilerFeature const& rhs) const { return std::strcmp(name_, rhs.name_) == 0; } constexpr bool supported() const { return data_ >= std_; } constexpr bool maybe() const { return data_ > 0; } constexpr char const* name() const { return name_; } constexpr long std() const { return std_; } constexpr long data() const { return data_; } void data(long x) { data_ = x; } }; // 非FTM宏,包括实现特定的宏: static /*constexpr*/ std::pair<const char*, const char*> compiler[] = { COMPILER_SPECIFIC_ENTRY(__cplusplus) COMPILER_SPECIFIC_ENTRY(__clang_major__) COMPILER_SPECIFIC_ENTRY(__clang_minor__) COMPILER_SPECIFIC_ENTRY(__clang_patchlevel__) COMPILER_SPECIFIC_ENTRY(__GNUG__) COMPILER_SPECIFIC_ENTRY(__GNUC_MINOR__) COMPILER_SPECIFIC_ENTRY(__GNUC_PATCHLEVEL__) // 可选的 <stdfloat> 定宽浮点类型 (C++23) COMPILER_SPECIFIC_ENTRY(__STDCPP_FLOAT16_T__) COMPILER_SPECIFIC_ENTRY(__STDCPP_FLOAT32_T__) COMPILER_SPECIFIC_ENTRY(__STDCPP_FLOAT64_T__) COMPILER_SPECIFIC_ENTRY(__STDCPP_FLOAT128_T__) COMPILER_SPECIFIC_ENTRY(__STDCPP_BFLOAT16_T__) // C23 => C++26 COMPILER_SPECIFIC_ENTRY(__STDC_ENDIAN_BIG__) COMPILER_SPECIFIC_ENTRY(__STDC_ENDIAN_LITTLE__) COMPILER_SPECIFIC_ENTRY(__STDC_ENDIAN_NATIVE__) COMPILER_SPECIFIC_ENTRY(__STDC_VERSION_STDBIT_H__) COMPILER_SPECIFIC_ENTRY(__STDC_VERSION_STDCKDINT_H__) // 添加您喜欢的实现特定宏... COMPILER_SPECIFIC_ENTRY(__STDCPP_DEFAULT_NEW_ALIGNMENT__) COMPILER_SPECIFIC_ENTRY(__STDCPP_THREADS__) COMPILER_SPECIFIC_ENTRY(__STDCPP_STRICT_POINTER_SAFETY__) COMPILER_SPECIFIC_ENTRY(__STDC_EMBED_NOT_FOUND__) COMPILER_SPECIFIC_ENTRY(__STDC_EMBED_FOUND__) COMPILER_SPECIFIC_ENTRY(__STDC_EMBED_EMPTY__) COMPILER_SPECIFIC_ENTRY(__STDC__) COMPILER_SPECIFIC_ENTRY(__STDC_VERSION__) COMPILER_SPECIFIC_ENTRY(__STDC_HOSTED__) COMPILER_SPECIFIC_ENTRY(__STDC_ISO_10646__) COMPILER_SPECIFIC_ENTRY(__STDC_MB_MIGHT_NEQ_WC__) COMPILER_SPECIFIC_ENTRY(__DATE__) COMPILER_SPECIFIC_ENTRY(__TIME__) }; static constexpr CompilerFeature cxx98_core[] = { COMPILER_FEATURE_ENTRY(199711L, __cpp_exceptions) COMPILER_FEATURE_ENTRY(199711L, __cpp_rtti) }; static constexpr CompilerFeature cxx11_core[] = { COMPILER_FEATURE_ENTRY(200704L, __cpp_alias_templates) COMPILER_FEATURE_ENTRY(200809L, __cpp_attributes) COMPILER_FEATURE_ENTRY(200704L, __cpp_constexpr) COMPILER_FEATURE_ENTRY(201711L, __cpp_constexpr_in_decltype) COMPILER_FEATURE_ENTRY(200707L, __cpp_decltype) COMPILER_FEATURE_ENTRY(200604L, __cpp_delegating_constructors) COMPILER_FEATURE_ENTRY(201511L, __cpp_inheriting_constructors) COMPILER_FEATURE_ENTRY(200806L, __cpp_initializer_lists) COMPILER_FEATURE_ENTRY(200907L, __cpp_lambdas) COMPILER_FEATURE_ENTRY(200809L, __cpp_nsdmi) COMPILER_FEATURE_ENTRY(200907L, __cpp_range_based_for) COMPILER_FEATURE_ENTRY(200710L, __cpp_raw_strings) COMPILER_FEATURE_ENTRY(200710L, __cpp_ref_qualifiers) COMPILER_FEATURE_ENTRY(200610L, __cpp_rvalue_references) COMPILER_FEATURE_ENTRY(200410L, __cpp_static_assert) COMPILER_FEATURE_ENTRY(200806L, __cpp_threadsafe_static_init) COMPILER_FEATURE_ENTRY(200704L, __cpp_unicode_characters) COMPILER_FEATURE_ENTRY(200710L, __cpp_unicode_literals) COMPILER_FEATURE_ENTRY(200809L, __cpp_user_defined_literals) COMPILER_FEATURE_ENTRY(200704L, __cpp_variadic_templates) }; static constexpr CompilerFeature cxx14_core[] = { COMPILER_FEATURE_ENTRY(201304L, __cpp_aggregate_nsdmi) COMPILER_FEATURE_ENTRY(201304L, __cpp_binary_literals) COMPILER_FEATURE_ENTRY(201304L, __cpp_constexpr) COMPILER_FEATURE_ENTRY(201304L, __cpp_decltype_auto) COMPILER_FEATURE_ENTRY(201304L, __cpp_generic_lambdas) COMPILER_FEATURE_ENTRY(201304L, __cpp_init_captures) COMPILER_FEATURE_ENTRY(201304L, __cpp_return_type_deduction) COMPILER_FEATURE_ENTRY(201309L, __cpp_sized_deallocation) COMPILER_FEATURE_ENTRY(201304L, __cpp_variable_templates) }; static constexpr CompilerFeature cxx14_lib[] = { COMPILER_FEATURE_ENTRY(201304L, __cpp_lib_chrono_udls) COMPILER_FEATURE_ENTRY(201309L, __cpp_lib_complex_udls) COMPILER_FEATURE_ENTRY(201304L, __cpp_lib_exchange_function) COMPILER_FEATURE_ENTRY(201304L, __cpp_lib_generic_associative_lookup) COMPILER_FEATURE_ENTRY(201304L, __cpp_lib_integer_sequence) COMPILER_FEATURE_ENTRY(201304L, __cpp_lib_integral_constant_callable) COMPILER_FEATURE_ENTRY(201402L, __cpp_lib_is_final) COMPILER_FEATURE_ENTRY(201309L, __cpp_lib_is_null_pointer) COMPILER_FEATURE_ENTRY(201402L, __cpp_lib_make_reverse_iterator) COMPILER_FEATURE_ENTRY(201304L, __cpp_lib_make_unique) COMPILER_FEATURE_ENTRY(201304L, __cpp_lib_null_iterators) COMPILER_FEATURE_ENTRY(201304L, __cpp_lib_quoted_string_io) COMPILER_FEATURE_ENTRY(201210L, __cpp_lib_result_of_sfinae) COMPILER_FEATURE_ENTRY(201304L, __cpp_lib_robust_nonmodifying_seq_ops) COMPILER_FEATURE_ENTRY(201402L, __cpp_lib_shared_timed_mutex) COMPILER_FEATURE_ENTRY(201304L, __cpp_lib_string_udls) COMPILER_FEATURE_ENTRY(201304L, __cpp_lib_transformation_trait_aliases) COMPILER_FEATURE_ENTRY(201210L, __cpp_lib_transparent_operators) COMPILER_FEATURE_ENTRY(201402L, __cpp_lib_tuple_element_t) COMPILER_FEATURE_ENTRY(201304L, __cpp_lib_tuples_by_type) }; static constexpr CompilerFeature cxx17_core[] = { COMPILER_FEATURE_ENTRY(201603L, __cpp_aggregate_bases) COMPILER_FEATURE_ENTRY(201606L, __cpp_aligned_new) COMPILER_FEATURE_ENTRY(201603L, __cpp_capture_star_this) COMPILER_FEATURE_ENTRY(201603L, __cpp_constexpr) COMPILER_FEATURE_ENTRY(201703L, __cpp_deduction_guides) COMPILER_FEATURE_ENTRY(201411L, __cpp_enumerator_attributes) COMPILER_FEATURE_ENTRY(201603L, __cpp_fold_expressions) COMPILER_FEATURE_ENTRY(201606L, __cpp_guaranteed_copy_elision) COMPILER_FEATURE_ENTRY(201603L, __cpp_hex_float) COMPILER_FEATURE_ENTRY(201606L, __cpp_if_constexpr) COMPILER_FEATURE_ENTRY(201606L, __cpp_inline_variables) COMPILER_FEATURE_ENTRY(201411L, __cpp_namespace_attributes) COMPILER_FEATURE_ENTRY(201510L, __cpp_noexcept_function_type) COMPILER_FEATURE_ENTRY(201411L, __cpp_nontype_template_args) COMPILER_FEATURE_ENTRY(201606L, __cpp_nontype_template_parameter_auto) COMPILER_FEATURE_ENTRY(201603L, __cpp_range_based_for) COMPILER_FEATURE_ENTRY(201411L, __cpp_static_assert) COMPILER_FEATURE_ENTRY(201606L, __cpp_structured_bindings) COMPILER_FEATURE_ENTRY(201611L, __cpp_template_template_args) COMPILER_FEATURE_ENTRY(201611L, __cpp_variadic_using) }; static constexpr CompilerFeature cxx17_lib[] = { COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_addressof_constexpr) COMPILER_FEATURE_ENTRY(201411L, __cpp_lib_allocator_traits_is_always_equal) COMPILER_FEATURE_ENTRY(201606L, __cpp_lib_any) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_apply) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_array_constexpr) COMPILER_FEATURE_ENTRY(201510L, __cpp_lib_as_const) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_atomic_is_always_lock_free) COMPILER_FEATURE_ENTRY(201505L, __cpp_lib_bool_constant) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_boyer_moore_searcher) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_byte) COMPILER_FEATURE_ENTRY(201611L, __cpp_lib_chrono) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_clamp) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_enable_shared_from_this) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_execution) COMPILER_FEATURE_ENTRY(201703L, __cpp_lib_filesystem) COMPILER_FEATURE_ENTRY(201606L, __cpp_lib_gcd_lcm) COMPILER_FEATURE_ENTRY(201703L, __cpp_lib_hardware_interference_size) COMPILER_FEATURE_ENTRY(201606L, __cpp_lib_has_unique_object_representations) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_hypot) COMPILER_FEATURE_ENTRY(201505L, __cpp_lib_incomplete_container_elements) COMPILER_FEATURE_ENTRY(201411L, __cpp_lib_invoke) COMPILER_FEATURE_ENTRY(201703L, __cpp_lib_is_aggregate) COMPILER_FEATURE_ENTRY(201703L, __cpp_lib_is_invocable) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_is_swappable) COMPILER_FEATURE_ENTRY(201606L, __cpp_lib_launder) COMPILER_FEATURE_ENTRY(201510L, __cpp_lib_logical_traits) COMPILER_FEATURE_ENTRY(201606L, __cpp_lib_make_from_tuple) COMPILER_FEATURE_ENTRY(201411L, __cpp_lib_map_try_emplace) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_math_special_functions) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_memory_resource) COMPILER_FEATURE_ENTRY(201606L, __cpp_lib_node_extract) COMPILER_FEATURE_ENTRY(201411L, __cpp_lib_nonmember_container_access) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_not_fn) COMPILER_FEATURE_ENTRY(201606L, __cpp_lib_optional) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_parallel_algorithm) COMPILER_FEATURE_ENTRY(201606L, __cpp_lib_raw_memory_algorithms) COMPILER_FEATURE_ENTRY(201603L, __cpp_lib_sample) COMPILER_FEATURE_ENTRY(201703L, __cpp_lib_scoped_lock) COMPILER_FEATURE_ENTRY(201505L, __cpp_lib_shared_mutex) COMPILER_FEATURE_ENTRY(201611L, __cpp_lib_shared_ptr_arrays) COMPILER_FEATURE_ENTRY(201606L, __cpp_lib_shared_ptr_weak_type) COMPILER_FEATURE_ENTRY(201606L, __cpp_lib_string_view) COMPILER_FEATURE_ENTRY(201611L, __cpp_lib_to_chars) COMPILER_FEATURE_ENTRY(201510L, __cpp_lib_transparent_operators) COMPILER_FEATURE_ENTRY(201510L, __cpp_lib_type_trait_variable_templates) COMPILER_FEATURE_ENTRY(201411L, __cpp_lib_uncaught_exceptions) COMPILER_FEATURE_ENTRY(201411L, __cpp_lib_unordered_map_try_emplace) COMPILER_FEATURE_ENTRY(202102L, __cpp_lib_variant) COMPILER_FEATURE_ENTRY(201411L, __cpp_lib_void_t) }; static constexpr CompilerFeature cxx20_core[] = { COMPILER_FEATURE_ENTRY(201902L, __cpp_aggregate_paren_init) COMPILER_FEATURE_ENTRY(202207L, __cpp_char8_t) COMPILER_FEATURE_ENTRY(202002L, __cpp_concepts) COMPILER_FEATURE_ENTRY(201806L, __cpp_conditional_explicit) COMPILER_FEATURE_ENTRY(202211L, __cpp_consteval) COMPILER_FEATURE_ENTRY(202002L, __cpp_constexpr) COMPILER_FEATURE_ENTRY(201907L, __cpp_constexpr_dynamic_alloc) COMPILER_FEATURE_ENTRY(201907L, __cpp_constinit) COMPILER_FEATURE_ENTRY(201907L, __cpp_deduction_guides) COMPILER_FEATURE_ENTRY(201707L, __cpp_designated_initializers) COMPILER_FEATURE_ENTRY(201707L, __cpp_generic_lambdas) COMPILER_FEATURE_ENTRY(201902L, __cpp_impl_coroutine) COMPILER_FEATURE_ENTRY(201806L, __cpp_impl_destroying_delete) COMPILER_FEATURE_ENTRY(201907L, __cpp_impl_three_way_comparison) COMPILER_FEATURE_ENTRY(201803L, __cpp_init_captures) COMPILER_FEATURE_ENTRY(201907L, __cpp_modules) COMPILER_FEATURE_ENTRY(201911L, __cpp_nontype_template_args) COMPILER_FEATURE_ENTRY(201907L, __cpp_using_enum) }; static constexpr CompilerFeature cxx20_lib[] = { COMPILER_FEATURE_ENTRY(201811L, __cpp_lib_array_constexpr) COMPILER_FEATURE_ENTRY(201811L, __cpp_lib_assume_aligned) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_atomic_flag_test) COMPILER_FEATURE_ENTRY(201711L, __cpp_lib_atomic_float) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_atomic_lock_free_type_aliases) COMPILER_FEATURE_ENTRY(201806L, __cpp_lib_atomic_ref) COMPILER_FEATURE_ENTRY(201711L, __cpp_lib_atomic_shared_ptr) COMPILER_FEATURE_ENTRY(201911L, __cpp_lib_atomic_value_initialization) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_atomic_wait) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_barrier) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_bind_front) COMPILER_FEATURE_ENTRY(201806L, __cpp_lib_bit_cast) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_bitops) COMPILER_FEATURE_ENTRY(201902L, __cpp_lib_bounded_array_traits) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_char8_t) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_chrono) COMPILER_FEATURE_ENTRY(202002L, __cpp_lib_concepts) COMPILER_FEATURE_ENTRY(201806L, __cpp_lib_constexpr_algorithms) COMPILER_FEATURE_ENTRY(201711L, __cpp_lib_constexpr_complex) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_constexpr_dynamic_alloc) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_constexpr_functional) COMPILER_FEATURE_ENTRY(201811L, __cpp_lib_constexpr_iterator) COMPILER_FEATURE_ENTRY(201811L, __cpp_lib_constexpr_memory) COMPILER_FEATURE_ENTRY(201911L, __cpp_lib_constexpr_numeric) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_constexpr_string) COMPILER_FEATURE_ENTRY(201811L, __cpp_lib_constexpr_string_view) COMPILER_FEATURE_ENTRY(201811L, __cpp_lib_constexpr_tuple) COMPILER_FEATURE_ENTRY(201811L, __cpp_lib_constexpr_utility) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_constexpr_vector) COMPILER_FEATURE_ENTRY(201902L, __cpp_lib_coroutine) COMPILER_FEATURE_ENTRY(201806L, __cpp_lib_destroying_delete) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_endian) COMPILER_FEATURE_ENTRY(202002L, __cpp_lib_erase_if) COMPILER_FEATURE_ENTRY(201902L, __cpp_lib_execution) COMPILER_FEATURE_ENTRY(202110L, __cpp_lib_format) COMPILER_FEATURE_ENTRY(201811L, __cpp_lib_generic_unordered_lookup) COMPILER_FEATURE_ENTRY(202002L, __cpp_lib_int_pow2) COMPILER_FEATURE_ENTRY(202002L, __cpp_lib_integer_comparison_functions) COMPILER_FEATURE_ENTRY(201902L, __cpp_lib_interpolate) COMPILER_FEATURE_ENTRY(201811L, __cpp_lib_is_constant_evaluated) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_is_layout_compatible) COMPILER_FEATURE_ENTRY(201806L, __cpp_lib_is_nothrow_convertible) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_is_pointer_interconvertible) COMPILER_FEATURE_ENTRY(201911L, __cpp_lib_jthread) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_latch) COMPILER_FEATURE_ENTRY(201806L, __cpp_lib_list_remove_return_type) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_math_constants) COMPILER_FEATURE_ENTRY(202106L, __cpp_lib_optional) COMPILER_FEATURE_ENTRY(201902L, __cpp_lib_polymorphic_allocator) COMPILER_FEATURE_ENTRY(202110L, __cpp_lib_ranges) COMPILER_FEATURE_ENTRY(201711L, __cpp_lib_remove_cvref) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_semaphore) COMPILER_FEATURE_ENTRY(201707L, __cpp_lib_shared_ptr_arrays) COMPILER_FEATURE_ENTRY(201806L, __cpp_lib_shift) COMPILER_FEATURE_ENTRY(202002L, __cpp_lib_smart_ptr_for_overwrite) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_source_location) COMPILER_FEATURE_ENTRY(202002L, __cpp_lib_span) COMPILER_FEATURE_ENTRY(201902L, __cpp_lib_ssize) COMPILER_FEATURE_ENTRY(201711L, __cpp_lib_starts_ends_with) COMPILER_FEATURE_ENTRY(201803L, __cpp_lib_string_view) COMPILER_FEATURE_ENTRY(201803L, __cpp_lib_syncbuf) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_three_way_comparison) COMPILER_FEATURE_ENTRY(201711L, __cpp_lib_to_address) COMPILER_FEATURE_ENTRY(201907L, __cpp_lib_to_array) COMPILER_FEATURE_ENTRY(201806L, __cpp_lib_type_identity) COMPILER_FEATURE_ENTRY(201811L, __cpp_lib_unwrap_ref) COMPILER_FEATURE_ENTRY(202106L, __cpp_lib_variant) }; static constexpr CompilerFeature cxx23_core[] = { COMPILER_FEATURE_ENTRY(202110L, __cpp_auto_cast) COMPILER_FEATURE_ENTRY(202211L, __cpp_constexpr) COMPILER_FEATURE_ENTRY(202110L, __cpp_explicit_this_parameter) COMPILER_FEATURE_ENTRY(202106L, __cpp_if_consteval) COMPILER_FEATURE_ENTRY(202207L, __cpp_implicit_move) COMPILER_FEATURE_ENTRY(202211L, __cpp_multidimensional_subscript) COMPILER_FEATURE_ENTRY(202207L, __cpp_named_character_escapes) COMPILER_FEATURE_ENTRY(202211L, __cpp_range_based_for) COMPILER_FEATURE_ENTRY(202011L, __cpp_size_t_suffix) COMPILER_FEATURE_ENTRY(202207L, __cpp_static_call_operator) }; static constexpr CompilerFeature cxx23_lib[] = { COMPILER_FEATURE_ENTRY(202106L, __cpp_lib_adaptor_iterator_pair_constructor) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_algorithm_iterator_requirements) COMPILER_FEATURE_ENTRY(202302L, __cpp_lib_allocate_at_least) COMPILER_FEATURE_ENTRY(202110L, __cpp_lib_associative_heterogeneous_erasure) COMPILER_FEATURE_ENTRY(202302L, __cpp_lib_barrier) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_bind_back) COMPILER_FEATURE_ENTRY(202110L, __cpp_lib_byteswap) COMPILER_FEATURE_ENTRY(202302L, __cpp_lib_common_reference) COMPILER_FEATURE_ENTRY(202302L, __cpp_lib_common_reference_wrapper) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_concepts) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_constexpr_bitset) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_constexpr_charconv) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_constexpr_cmath) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_constexpr_memory) COMPILER_FEATURE_ENTRY(202106L, __cpp_lib_constexpr_typeinfo) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_containers_ranges) COMPILER_FEATURE_ENTRY(202211L, __cpp_lib_expected) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_flat_map) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_flat_set) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_format) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_format_ranges) COMPILER_FEATURE_ENTRY(202302L, __cpp_lib_formatters) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_forward_like) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_generator) COMPILER_FEATURE_ENTRY(202106L, __cpp_lib_invoke_r) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_ios_noreplace) COMPILER_FEATURE_ENTRY(202302L, __cpp_lib_is_implicit_lifetime) COMPILER_FEATURE_ENTRY(202011L, __cpp_lib_is_scoped_enum) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_mdspan) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_modules) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_move_iterator_concept) COMPILER_FEATURE_ENTRY(202110L, __cpp_lib_move_only_function) COMPILER_FEATURE_ENTRY(202110L, __cpp_lib_optional) COMPILER_FEATURE_ENTRY(202106L, __cpp_lib_out_ptr) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_print) COMPILER_FEATURE_ENTRY(202302L, __cpp_lib_ranges) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_ranges_as_const) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_ranges_as_rvalue) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_ranges_cartesian_product) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_ranges_chunk) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_ranges_chunk_by) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_ranges_contains) COMPILER_FEATURE_ENTRY(202302L, __cpp_lib_ranges_enumerate) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_ranges_find_last) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_ranges_fold) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_ranges_iota) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_ranges_join_with) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_ranges_repeat) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_ranges_slide) COMPILER_FEATURE_ENTRY(202106L, __cpp_lib_ranges_starts_ends_with) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_ranges_stride) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_ranges_to_container) COMPILER_FEATURE_ENTRY(202110L, __cpp_lib_ranges_zip) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_reference_from_temporary) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_shift) COMPILER_FEATURE_ENTRY(202106L, __cpp_lib_spanstream) COMPILER_FEATURE_ENTRY(202011L, __cpp_lib_stacktrace) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_start_lifetime_as) COMPILER_FEATURE_ENTRY(202011L, __cpp_lib_stdatomic_h) COMPILER_FEATURE_ENTRY(202011L, __cpp_lib_string_contains) COMPILER_FEATURE_ENTRY(202110L, __cpp_lib_string_resize_and_overwrite) COMPILER_FEATURE_ENTRY(202102L, __cpp_lib_to_underlying) COMPILER_FEATURE_ENTRY(202207L, __cpp_lib_tuple_like) COMPILER_FEATURE_ENTRY(202202L, __cpp_lib_unreachable) }; static constexpr CompilerFeature cxx26_core[] = { //< 继续填充 COMPILER_FEATURE_ENTRY(202406L, __cpp_constexpr) COMPILER_FEATURE_ENTRY(202411L, __cpp_constexpr_exceptions) COMPILER_FEATURE_ENTRY(202502L, __cpp_contracts) COMPILER_FEATURE_ENTRY(202403L, __cpp_deleted_function) COMPILER_FEATURE_ENTRY(202406L, __cpp_fold_expressions) COMPILER_FEATURE_ENTRY(202311L, __cpp_pack_indexing) COMPILER_FEATURE_ENTRY(202306L, __cpp_placeholder_variables) COMPILER_FEATURE_ENTRY(202502L, __cpp_pp_embed) COMPILER_FEATURE_ENTRY(202306L, __cpp_static_assert) COMPILER_FEATURE_ENTRY(202411L, __cpp_structured_bindings) COMPILER_FEATURE_ENTRY(202502L, __cpp_template_parameters) COMPILER_FEATURE_ENTRY(202502L, __cpp_trivial_relocatability) COMPILER_FEATURE_ENTRY(202502L, __cpp_trivial_union) COMPILER_FEATURE_ENTRY(202403L, __cpp_variadic_friend) }; static constexpr CompilerFeature cxx26_lib[] = { //< 继续填充 COMPILER_FEATURE_ENTRY(202403L, __cpp_lib_algorithm_default_value_type) COMPILER_FEATURE_ENTRY(202411L, __cpp_lib_aligned_accessor) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_associative_heterogeneous_insertion) COMPILER_FEATURE_ENTRY(202403L, __cpp_lib_atomic_min_max) COMPILER_FEATURE_ENTRY(202411L, __cpp_lib_atomic_ref) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_bind_back) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_bind_front) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_bitset) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_chrono) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_constexpr_algorithms) COMPILER_FEATURE_ENTRY(202411L, __cpp_lib_constexpr_atomic) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_constexpr_cmath) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_constexpr_complex) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_deque) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_exceptions) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_flat_map) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_flat_set) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_forward_list) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_inplace_vector) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_list) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_map) COMPILER_FEATURE_ENTRY(202406L, __cpp_lib_constexpr_new) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_queue) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_set) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_stack) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_unordered_map) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_constexpr_unordered_set) COMPILER_FEATURE_ENTRY(202411L, __cpp_lib_constrained_equality) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_contracts) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_copyable_function) COMPILER_FEATURE_ENTRY(202403L, __cpp_lib_debugging) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_format) COMPILER_FEATURE_ENTRY(202403L, __cpp_lib_format_path) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_format_uchar) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_freestanding_algorithm) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_freestanding_array) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_char_traits) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_charconv) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_cstdlib) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_freestanding_cstring) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_cwchar) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_errc) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_freestanding_execution) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_freestanding_expected) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_feature_test_macros) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_functional) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_iterator) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_freestanding_mdspan) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_freestanding_memory) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_freestanding_numeric) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_operator_new) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_freestanding_optional) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_freestanding_random) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_ranges) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_ratio) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_freestanding_string_view) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_tuple) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_freestanding_utility) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_freestanding_variant) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_fstream_native_handle) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_function_ref) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_array) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_basic_string) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_basic_string_view) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_bitset) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_deque) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_expected) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_forward_list) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_inplace_vector) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_list) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_mdspan) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_optional) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_span) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_valarray) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hardened_vector) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_hazard_pointer) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_hive) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_indirect) COMPILER_FEATURE_ENTRY(202406L, __cpp_lib_inplace_vector) COMPILER_FEATURE_ENTRY(202411L, __cpp_lib_is_sufficiently_aligned) COMPILER_FEATURE_ENTRY(202406L, __cpp_lib_is_virtual_base_of) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_is_within_lifetime) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_linalg) COMPILER_FEATURE_ENTRY(202406L, __cpp_lib_mdspan) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_not_fn) COMPILER_FEATURE_ENTRY(202406L, __cpp_lib_optional_range_support) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_out_ptr) COMPILER_FEATURE_ENTRY(202406L, __cpp_lib_philox_engine) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_polymorphic) COMPILER_FEATURE_ENTRY(202403L, __cpp_lib_print) COMPILER_FEATURE_ENTRY(202406L, __cpp_lib_ranges) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_ranges_as_const) COMPILER_FEATURE_ENTRY(202411L, __cpp_lib_ranges_cache_latest) COMPILER_FEATURE_ENTRY(202403L, __cpp_lib_ranges_concat) COMPILER_FEATURE_ENTRY(202403L, __cpp_lib_ranges_generate_random) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_ranges_reserve_hint) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_ranges_to_input) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_ratio) COMPILER_FEATURE_ENTRY(202411L, __cpp_lib_raw_memory_algorithms) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_rcu) COMPILER_FEATURE_ENTRY(202403L, __cpp_lib_reference_wrapper) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_saturation_arithmetic) COMPILER_FEATURE_ENTRY(202406L, __cpp_lib_senders) COMPILER_FEATURE_ENTRY(202411L, __cpp_lib_simd) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_simd_complex) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_smart_ptr_owner_equality) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_span) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_span_initializer_list) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_sstream_from_string_view) COMPILER_FEATURE_ENTRY(202403L, __cpp_lib_string_view) COMPILER_FEATURE_ENTRY(202403L, __cpp_lib_submdspan) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_text_encoding) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_to_chars) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_to_string) COMPILER_FEATURE_ENTRY(202502L, __cpp_lib_trivially_relocatable) COMPILER_FEATURE_ENTRY(202311L, __cpp_lib_tuple_like) COMPILER_FEATURE_ENTRY(202306L, __cpp_lib_variant) }; static constexpr CompilerFeature cxx29_core[] = { //< 继续填充 COMPILER_FEATURE_ENTRY(202604L, __cpp_core_TODO) }; static constexpr CompilerFeature cxx29_lib[] = { //< 继续填充 COMPILER_FEATURE_ENTRY(202604L, __cpp_lib_TODO) }; static constexpr CompilerFeature attributes[] = { COMPILER_ATTRIBUTE(202207L, assume) COMPILER_ATTRIBUTE(200809L, carries_dependency) COMPILER_ATTRIBUTE(201309L, deprecated) COMPILER_ATTRIBUTE(201603L, fallthrough) COMPILER_ATTRIBUTE(202403L, indeterminate) COMPILER_ATTRIBUTE(201803L, likely) COMPILER_ATTRIBUTE(201603L, maybe_unused) COMPILER_ATTRIBUTE(201803L, no_unique_address) COMPILER_ATTRIBUTE(201907L, nodiscard) COMPILER_ATTRIBUTE(200809L, noreturn) COMPILER_ATTRIBUTE(201803L, unlikely) }; inline void show_compiler_specific_info() { std::printf("其他宏:\n"); for (auto co : compiler) if (std::strcmp(co.first, co.second)) std::printf("%*s %s\n", -print.longest_macro_name, co.first, co.second); } inline void print_compiler_feature(const CompilerFeature& x) { if (not ((print.supported_features and x.maybe()) or (print.unsupported_features and not x.maybe()))) return; auto print_year_month = [](long n) { return std::printf("%ld%s%02ld", n / 100, print.separate_year_month ? "-" : "", n % 100); }; std::printf("%*s ", -print.longest_macro_name, x.name()); x.maybe() ? print_year_month(x.data()) : std::printf("------%s", print.separate_year_month ? "-" : ""); if (print.standard_values) std::printf(" %c ", (x.supported() ? (x.data() > x.std() ? '>' : '=') : '<')), print_year_month(x.std()); std::puts(""); } template<class Container> inline void show(char const* const title, Container const& co) { if (print.titles) { std::printf("%-s (", title); if (print.counters) { std::printf("%zd/", std::count_if(std::begin(co), std::end(co), [](CompilerFeature x) { return x.supported(); })); } std::printf("%td)\n", std::distance(std::begin(co), std::end(co))); } if (print.sort_by_date) { std::vector<CompilerFeature> v(std::begin(co), std::end(co)); std::stable_sort(v.begin(), v.end(), [](CompilerFeature const& lhs, CompilerFeature const& rhs) { return lhs.data() < rhs.data(); }); std::for_each(v.cbegin(), v.cend(), print_compiler_feature); } else std::for_each(std::begin(co), std::end(co), print_compiler_feature); std::puts(""); } inline void show_latest() { auto latest_rev = []() -> int { return print.cxx29 ? 29 : print.cxx26 ? 26 : print.cxx23 ? 23 : print.cxx20 ? 20 : print.cxx17 ? 17 : print.cxx14 ? 14 : print.cxx11 ? 11 : 98; }; std::vector<CompilerFeature> latest; auto add = [&latest](CompilerFeature x) { auto i = std::lower_bound(latest.begin(), latest.end(), x); if (i == latest.end() or not (*i == x)) latest.insert(i, x); else if (i->data() < x.data()) i->data(x.data()); }; char text[64]; latest.reserve(512); // max 宏 if (print.core_features) { // 保持反向修订插入顺序! if (print.cxx29) std::for_each(std::begin(cxx29_core), std::end(cxx29_core), add); if (print.cxx26) std::for_each(std::begin(cxx26_core), std::end(cxx26_core), add); if (print.cxx23) std::for_each(std::begin(cxx23_core), std::end(cxx23_core), add); if (print.cxx20) std::for_each(std::begin(cxx20_core), std::end(cxx20_core), add); if (print.cxx17) std::for_each(std::begin(cxx17_core), std::end(cxx17_core), add); if (print.cxx14) std::for_each(std::begin(cxx14_core), std::end(cxx14_core), add); if (print.cxx11) std::for_each(std::begin(cxx11_core), std::end(cxx11_core), add); if (print.cxx98) std::for_each(std::begin(cxx98_core), std::end(cxx98_core), add); std::snprintf(text, sizeof text, "截至C++%02i版本的所有核心宏", latest_rev()); show(text, latest); } latest.clear(); if (print.lib_features) { // 保留反向修订插入顺序! if (print.cxx29) std::for_each(std::begin(cxx29_lib), std::end(cxx29_lib), add); if (print.cxx26) std::for_each(std::begin(cxx26_lib), std::end(cxx26_lib), add); if (print.cxx23) std::for_each(std::begin(cxx23_lib), std::end(cxx23_lib), add); if (print.cxx20) std::for_each(std::begin(cxx20_lib), std::end(cxx20_lib), add); if (print.cxx17) std::for_each(std::begin(cxx17_lib), std::end(cxx17_lib), add); if (print.cxx14) std::for_each(std::begin(cxx14_lib), std::end(cxx14_lib), add); std::snprintf(text, sizeof text, "ALL LIB MACROS UP TO C++%02i", latest_rev()); show(text, latest); } } int main() { if (print.separated_revisions) { if (print.cxx98 and print.core_features) show("C++98 CORE", cxx98_core); if (print.cxx11 and print.core_features) show("C++11 CORE", cxx11_core); if (print.cxx14 and print.core_features) show("C++14 CORE", cxx14_core); if (print.cxx14 and print.lib_features ) show("C++14 库" , cxx14_lib); if (print.cxx17 and print.core_features) show("C++17 核心", cxx17_core); if (print.cxx17 and print.lib_features ) show("C++17 库" , cxx17_lib); if (print.cxx20 and print.core_features) show("C++20 核心", cxx20_core); if (print.cxx20 and print.lib_features ) show("C++20 库" , cxx20_lib); if (print.cxx23 and print.core_features) show("C++23 核心", cxx23_core); if (print.cxx23 and print.lib_features ) show("C++23 库" , cxx23_lib); if (print.cxx26 and print.core_features) show("C++26 核心", cxx26_core); if (print.cxx26 and print.lib_features ) show("C++26 库" , cxx26_lib); if (print.cxx29 and print.core_features) show("C++29 CORE", cxx29_core); if (print.cxx29 and print.lib_features ) show("C++29 LIB" , cxx29_lib); } if (print.latest_revisions) show_latest(); if (print.attributes) show("ATTRIBUTES", attributes); if (print.compiler_specific) show_compiler_specific_info(); }
可能的输出:
C++11 核心特性 (20/20) __cpp_alias_templates 2007-04 = 2007-04 __cpp_attributes 2008-09 = 2008-09 __cpp_constexpr 2022-11 > 2007-04 __cpp_constexpr_in_decltype 2017-11 = 2017-11 ... 已截断 ... C++14 核心特性 (9/9) __cpp_aggregate_nsdmi 2013-04 = 2013-04 __cpp_binary_literals 2013-04 = 2013-04 __cpp_constexpr 2022-11 > 2013-04 ... 已截断 ... C++14 标准库 (20/20) __cpp_lib_chrono_udls 2013-04 = 2013-04 __cpp_lib_complex_udls 2013-09 = 2013-09 __cpp_lib_exchange_function 2013-04 = 2013-04 ... 已截断 ... ... 已截断 ... C++23 标准库 (43/64) __cpp_lib_adaptor_iterator_pair_constructor 2021-06 = 2021-06 __cpp_lib_algorithm_iterator_requirements ------- < 2022-07 __cpp_lib_allocate_at_least ------- < 2023-02 __cpp_lib_associative_heterogeneous_erasure ------- < 2021-10 __cpp_lib_barrier 2019-07 < 2023-02 ... 已截断 ... 截至 C++26 的所有核心宏 (60/76) __cpp_aggregate_bases 2016-03 = 2016-03 __cpp_aggregate_nsdmi 2013-04 = 2013-04 __cpp_aggregate_paren_init 2019-02 = 2019-02 __cpp_alias_templates 2007-04 = 2007-04 ... 已截断 ... 截至 C++26 的所有标准库宏 (158/282) __cpp_lib_adaptor_iterator_pair_constructor 2021-06 = 2021-06 __cpp_lib_addressof_constexpr 2016-03 = 2016-03 __cpp_lib_algorithm_iterator_requirements ------- < 2022-07 __cpp_lib_allocate_at_least ------- < 2023-02 __cpp_lib_allocator_traits_is_always_equal 2014-11 = 2014-11 ... 已截断 ... 属性 (9/11) assume 2022-07 = 2022-07 carries_dependency ------- < 2008-09 deprecated 2013-09 = 2013-09 fallthrough 2016-03 = 2016-03 ... 已截断 ... 其他宏: __cplusplus 202302L __GNUG__ 14 __GNUC_MINOR__ 2 __GNUC_PATCHLEVEL__ 0 __STDCPP_FLOAT16_T__ 1 __STDCPP_FLOAT32_T__ 1 ... 已截断 ...
缺陷报告
以下行为变更缺陷报告被追溯应用于先前发布的C++标准。
| DR | 适用范围 | 发布时的行为 | 正确行为 |
|---|---|---|---|
| P2552R3 | C++20 |
__has_cpp_attribute
必须为标准属性展开为非零值
|
可展开为 0 |
另请参阅
| 库功能测试宏 (C++20) | 定义于头文件 <version> |
| 预定义宏符号 | |
| 宏符号索引 | |
外部链接
| 1. | 功能测试建议官方文档 |
| 2. | 输出编译器功能的源代码 |