C++ 编译器支持情况表

来自cppreference.com
< cpp



以下各表给出各个编译器对新的 C++ 功能的支持情况。包括已经接受的修订版本以及大量技术规范:

目录

[编辑]注解

* - 在版本号上停留可以查看注记 * 查看其他注记
DRnn - 在 "DR" 后的数字 nn 表示应用该缺陷报告的目标 C++ 修订版本,例如 DR20 → C++20。

[编辑]C++26 功能特性

请注意这个列表可能随着 C++26/2c 标准草案的演进而修改。

[编辑] C++26 核心语言功能特性

C++26 功能特性

 
提案

 
GCC
Clang
MSVC
Apple Clang
EDG eccp
Intel C++
Nvidia HPC C++ (ex PGI)*
Nvidia nvcc
Cray
DR98: 从词法分析中删除未定义行为 P2621R33.3 16.0.0*
DR98: 使不可编码的字符串文本格式非良构 P1854R414 14 16.0.0*
不求值字符串P2361R614 17 (部分)*
18
16.0.0*
@$,和 ` 添加至基本字符集P2558R215 16.0.0*
constexpr 的从 void* 转换  (FTM)*P2738R114 17
DR20: 使标准属性可忽略 P2552R315
DR11: 花括号初始化的静态存储 P2752R314
用户生成的 static_assert 消息  (FTM)*P2741R314 17
没有名字的占位符变量  (FTM)*P2169R414 18
包索引  (FTM)*P2662R315 19
删除枚举被弃用的算术转换 P2864R214 18
DR11/20:模板形参初始化 P2308R19 18
不允许绑定返回的引用到临时量P2748R514 19
结构化绑定的属性  (FTM)*P0609R315 19
未初始化读取的错误行为,[[indeterminate]] 属性 P2795R5
= delete("reason");  (FTM)*P2573R215 19
可变参数友元  (FTM)*P2893R315 20
DR98:澄清聚合初始化中的括号消除规则 P3106R117
DR20:不允许模块声明为宏 P3034R115
DR11:平凡的无限循环不是未定义行为 P2809R314 19
constexpr 布置 new  (FTM)*  (FTM)*P2747R215 20
结构化绑定声明作为条件  (FTM)*P0963R315 6 (部分)*
涉及折叠表达式约束定序  (FTM)*P2963R319
删除指向不完整类型的指针应当非良构 P3144R215 19 6.7
结构化绑定可以引入  (FTM)*P1061R1021
constexpr结构化绑定constexpr 变量的引用 P2686R56.7
constexpr异常  (FTM)*P3068R6
牛津可变逗号 P3176R115 20
移除已弃用的数组比较 P2865R615 20
#embed  (FTM)*P1967R1415 19*
概念和可变模板模板参数  (FTM)*P2841R7
可平凡重定位性  (FTM)*P2786R13
平凡联合体  (FTM)*P3074R7
可观测检查点 P1494R5
契约  (FTM)*P2900R14
 

C++26 功能特性
 

提案
GCC
Clang
MSVC
Apple Clang
EDG eccp
Intel C++
Nvidia HPC C++ (ex PGI)*
Nvidia nvcc
Cray

[编辑] C++26 库功能特性

C++26 功能特性

 
提案

 
GCC libstdc++
Clang libc++
MSVC STL
Apple Clang*
测试 <charconv> 函数的成功或失败  (FTM)*P2497R014 18 16.0.0*
std::text_encoding:文本编码识别  (FTM)*P1885R12
P2862R1
14
使用 std::format 实现 std::to_stringstd::to_wstring 的算术类型重载  (FTM)*P2587R314
类型检查格式参数  (FTM)*P2757R315
格式化指针  (FTM)*P2510R314*17*19.40**
std::chrono 各值类型的散列支持  (FTM)*P2592R3
<rcu>读-复制-更新(RCU)  (FTM)*P2545R4
<hazard_pointer>风险指针  (FTM)*P2530R3
免遭 ADL 的 std::projectedP2538R114*18*19.38**16.0.0*
constexpr 的稳定排序  (FTM)*P2562R115 21
成员 std::basic_format_arg::visit()  (FTM)*P2637R315 19
成员 std::variant::visit()  (FTM)*P2637R315 18
std::is_within_lifetime  (FTM)*P2641R4
使用既存的异构重载扩展关联容器  (FTM)*P2363R5
允许在无序关联容器中使用 std::weak_ptr 作为 key  (FTM)*P1901R2
从文件流获得本机句柄  (FTM)*P1759R614 18 16.0.0*
字符串流的 std::string_view 接口  (FTM)*P2495R319
std::bitsetstd::string_view 接口  (FTM)*P2697R118 16.0.0*
使 <cmath><complex>constexpr  (FTM)*  (FTM)*P1383R24.6 (部分)*
为 <ratio> 添加新的 2022 国际单位制(SI)前缀:std::quectostd::rontostd::ronnastd::quetta  (FTM)*P2734R014 17
std::function_ref:类型擦除的可调用引用  (FTM)*P0792R14
std::copyable_function  (FTM)*P2548R6
使用 NTTP 可调用对象的 std::bind_frontstd::bind_backstd::not_fn  (FTM)*  (FTM)*  (FTM)*P2714R1
std::submdspan()  (FTM)*P2630R4
P3355R1
独立式语言:可选 ::operator newP2013R5不适用
独立的 std::char_traitsstd::errc<charconv><cstdlib><cstring><cwchar> 中的设施  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*P2338R4不适用
更多独立设施  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*P2198R7不适用
饱和算术  (FTM)*P0543R314 18 16.0.0*
<debugging>调试支持  (FTM)*P2546R5
P2810R4
<linalg>:基于 BLAS 的自由函数线性代数接口  (FTM)*P1673R13
P3050R2
P3222R0
使 assert() 宏用户友好 P2264R7
运行时格式化字符串  (FTM)*P2918R214 18 16.0.0*
通过初始化式列表构造 std::span  (FTM)*P2447R615 18 16.0.0*
std::span::at()  (FTM)*P2821R514 18 16.0.0*
std::complex 添加元组协议  (FTM)*P2819R215 19
std::generate_canonical 的新规范 P0952R219.42*
删除被弃用的类型别名 std::allocator::is_always_equalP2868R315 18 16.0.0*
删除 std::basic_string::reserve() 的无参重载 P2870R318 16.0.0*
删除被弃用的 Unicode 转换设施 (<codecvt>) P2871R318 16.0.0*
独立式:删除 std::strtok  (FTM)*P2937R014 19.40*
独立式库:使得部分类独立  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*P2407R514 19.42*
独立式库:std::inoutstd::expectedstd::span  (FTM)*  (FTM)*  (FTM)*  (FTM)*P2833R214 19.42*
DR23:std::basic_const_iterator 应该遵从其底层类型的可转换性  (FTM)*P2836R1
P2950R0
14 19.40*
DR20:std::make_format_args 只接受左值引用而不是转发引用 P2905R214 18 19.40*16.0.0*
DR20:修复格式化代码单元为整数  (FTM)*P2909R413.3 18 19.40*16.0.0*
views::concat  (FTM)*P2542R815
连接字符串字符串视图  (FTM)*P2591R515 19
算法启用列表初始化  (FTM)*P2248R8
P3217R0
15
std::ranges::generate_random  (FTM)*P1068R11
std::reference_wrapper比较,以及对 std::pairstd::tuplestd::optionalstd::variant 的比较的约束  (FTM)*  (FTM)*P2944R314 19 (部分)*
有填充 mdspan 布局  (FTM)*P2642R6
新的 std::spanstd::mdspan 以整数常量进行的 CTAD P3029R119
原子的最大值与最小值  (FTM)*P0493R5
std::formatter<std::filesystem::path>  (FTM)*P2845R8
std::println() 打印空行  (FTM)*P3142R014*19*19.41**
取消弃用 std::polymorphic_allocator::destroyP2875R415 19.41*
移除已弃用的 strstreamP2867R219
移除已弃用的 std::shared_ptr 原子访问 API P2869R4
移除 std::wstring_convertP2872R319
DR23:允许 std::print 的一种高效实现  (FTM)*P3107R5
P3235R3
19.43*
执行控制库  (FTM)*P2300R10
P3396R0
std::inplace_vector:具有固定容量的可动态调整大小向量  (FTM)*P0843R14
std::philox_engine:基于计数器的随机数引擎  (FTM)*P2075R6
std::optional 的范围支持  (FTM)*P3168R2
std::is_virtual_base_of:用于检测虚基类的类型特征  (FTM)*P2985R015 20
用于 std::mdspanstd::dims  (FTM)*P2389R219
DR11:std::ignore 的类型的正式规范 P2968R215 19 19.42*
DR20:移除可间接调用概念中对公共引用的要求  (FTM)*P2997R115 19 19.42*
弃用 std::is_trivialstd::is_trivial_vP3247R215 21
DR20:算法函数对象 P3136R114 19.39*14.0.3*
std::ranges::cache_latest_view  (FTM)*P3138R515
约束 std::expected相等运算符  (FTM)*P3379R015
std::aligned_accessor:使用过量对齐指针的 std::mdspan 访问器  (FTM)*P2897R721
std::is_sufficiently_aligned:检查指针的对齐前条件  (FTM)*P2897R721
std::atomic_ref::address()  (FTM)*P2835R7
DR11/20:std::atomicstd::atomic_ref 中的 cv 限定类型 P3323R119.44*
constexprstd::atomicstd::atomic_ref  (FTM)*P3309R3
constexpr特化内存算法  (FTM)*P3508R0
P3369R0
15
<stdbit.h><stdckdint.h>P3370R115
<simd>数据并行类型  (FTM)*  (FTM)*P1928R15
P3430R3
P3441R2
P3287R3
P2663R7
P2933R4
用于创建执行环境的工具 P3325R5
constexpr 的异常类型,例如 std::bad_allocstd::bad_cast 等  (FTM)*P3068R6
P3378R2
可平凡重定位特征和操作  (FTM)*P2786R13
无害化和弃用 std::memory_order::consumeP3475R1
std::monostate 放入 <utility>P0472R315 21 19.50*
std::indirect  (FTM)*P3019R14
std::polymorphic  (FTM)*P3019R14
更多 constexpr 容器和适配器:

std::dequestd::flat_mapstd::flat_multimapstd::flat_setstd::flat_multisetstd::forward_liststd::liststd::mapstd::multimapstd::queuestd::priority_queuestd::setstd::multisetstd::stackstd::unordered_mapstd::unordered_multimapstd::unordered_setstd::unordered_multiset
  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*

P3372R2
非平凡类型 std::inplace_vectorconstexpr  (FTM)*P3074R7
std::ranges::to_input_view  (FTM)*P3137R315
std::ranges::approximately_sized_rangestd::ranges::reserve_hint  (FTM)*P2846R6
<hive>:一种基于桶的重用已擦除元素内存位置的容器  (FTM)*P0447R28
<contracts>:契约违背处理支持  (FTM)*P2900R14
标准库加固  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*P3471R415 (部分)*19.44*(部分)*
独立式库:<algorithm><numeric><random>、(<execution><memory>)
  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*
P2976R1
DR20:将连续迭代器转换为指针 P3349R015
 

C++26 功能特性
 

提案
GCC libstdc++
Clang libc++
MSVC STL
Apple Clang*

[编辑]C++23 功能特性

[编辑] C++23 核心语言功能特性

C++23 功能特性

 
提案

 
GCC
Clang
MSVC
Apple Clang
EDG eccp
Intel C++
Nvidia HPC C++ (ex PGI)*
Nvidia nvcc
Cray
(有符号)size_t字面量后缀  (FTM)*P0330R811 13 19.43*13.1.6*6.5 2022.2 23.9
使更多 lambda() 可以被省略 P1102R211 13 19.44*13.1.6*6.3 2022.2 22.5
if consteval  (FTM)*P1938R312 14 19.44*14.0.0*6.3 2022.2 24.1
移除垃圾收集支持 P2186R212 不适用19.30*不适用不适用
允许在 static_assertconstexpr if 中进行窄化的上下文转换 P1401R59 13 (部分)*
14
14.0.0*2022.2 20.7
行拼接之前剔除空白 P2223R26.7 2022.2
使类布局更遵守声明顺序 P1847R42022.2
移除混合宽度字符串字面量拼接P2201R1
显式对象成员函数(推导 this)  (FTM)*P0847R714 18
19*
19.32*(部分)*
19.43*
6.3 22.5
auto(x)auto{x}  (FTM)*P0849R812 15 14.0.3*6.4 2022.2 23.3
#elifdef#elifndefP2334R112 13 19.40*13.1.6*6.5 2022.2 23.9
constexpr 函数中的非字面类型变量(以及句标与 goto)  (FTM)*P2242R312 15 19.43*14.0.3*6.3 2022.2 22.5
一致的字符字面量编码 P2316R219.30*2022.2
字符集与编码P2314R410 2022.2
扩展(for 循环 的)初始化语句以允许别名声明P2360R012 14 14.0.0*2022.2
多维数组下标运算符  (FTM)*P2128R612 15 19.42*14.0.3*2022.2
lambda 上的属性 P2173R19 13 19.44*13.1.6*6.6 2022.2 22.5
#warningP2437R1是*15.0.0*6.5 2023.2
移除不可编码的宽字符字面量和多字符宽字符字面量 P2362R313 14 15.0.0*6.7 2023.2
复合语句末尾的标签 P2324R213 16 16.0.0*6.5 2023.2 23.9
划线的转义序列P2290R313 15 15.0.0*6.7 2023.2
命名的通用转义字符  (FTM)*P2071R213 15 15.0.0*6.7 2023.2
放松 constexpr 的限制  (FTM)*P2448R213 17 (部分)
19
2024.0 (部分)
简化的隐式移动  (FTM)*P2266R313 13 6.7 2022.2
static operator()  (FTM)*P1169R413 16 19.44*16.0.0*6.7 2023.2
可选的扩展浮点数类型要求 P1467R913 不适用6.4
从继承的构造函数中推导出类模板参数 P2582R114
[[assume]] 属性 P1774R813 19
支持 UTF-8 作为一种可移植的源文件编码P2295R613*15*19.0 (Update 2)**15.0.0*2023.2
static operator[]  (FTM)*P2589R113 16 19.44*16.0.0*6.7 2023.2
允许 constexpr 函数中的 staticconstexpr 变量  (FTM)*P2647R113 16 16.0.0*2023.2
延长范围 for 循环初始化器中临时变量的生命  (FTM)*P2644R1
P2718R0
CWG2659
15 19
DR11:更改 lambda 尾随返回类型的作用域 P2036R3
P2579R0
17 2023.2
DR20:有意义的导出 P2615R115 17 (部分)
DR20:consteval 需要向上传播  (FTM)*P2564R314 17 16.0.0*6.7 2024.0
DR98:C++ 标识符语法使用 Unicode 标准附录 31 P1949R712 14 14.0.0*6.4 2022.2
DR11:允许重复属性P2156R111 13 13.1.6*6.5 23.9
DR20:调整功能特性测试宏 __cpp_concepts 的值 P2493R012 19.32*6.4 23.3
DR98:放宽 wchar_t 的要求以符合现有实践 P2460R215.0.0*不适用2023.2
DR11:在常量表达式中使用未知的指针和引用 P2280R414 20*
DR20:放宽相等性运算的重写规则 P2468R213 16 16.0.0*2023.2
DR20:char8_t 兼容性和可移植性修复  (FTM)*P2513R413 16 19.34*16.0.0*2023.2
DR98/11:澄清诊断指令报告的内容并允许 static_assert 模板上下文中使用非值依赖性表达式 CWG251813 17 16.0*(部分)*
19.40*
 

C++23 功能特性
 

提案
GCC
Clang
MSVC
Apple Clang
EDG eccp
Intel C++
Nvidia HPC C++ (ex PGI)*
Nvidia nvcc
Cray

[编辑] C++23 库功能特性

C++23 功能特性

 
提案

 
GCC libstdc++
Clang libc++
MSVC STL
Apple Clang*
栈踪迹库  (FTM)*P0881R7
P2301R1
12 (部分)*
14*
19.34*
<stdatomic.h>  (FTM)*P0943R612 15 19.31*14.0.3*
std::is_scoped_enum  (FTM)*P1048R111 12 19.30*13.0.0*
std::basic_string::contains(), std::basic_string_view::contains()  (FTM)*P1679R311 12 19.30*13.0.0*
std::to_underlying  (FTM)*P1682R311 13 19.30*13.1.6*
放松 time_point<>::clock 的要求 P2212R2不适用不适用不适用不适用
在分配器接口中提供大小反馈  (FTM)*P0401R615 19.30*14.0.3*
<spanstream>:以 std::span 为基础的字符串流  (FTM)*P0448R412 19.31*
std::out_ptr()std::inout_ptr()  (FTM)*P1132R814 19 19.30*
constexprtype_info::operator==()  (FTM)*P1328R112 17 19.33**
19.34*
15.0.0*
std::stackstd::queue 的迭代器对构造函数  (FTM)*P1425R412 14 19.31*14.0.3*
容器推导指引中分配器的非推导语境 P1518R212*13*19.31**13.1.6**
ranges::starts_with()ranges::ends_with()  (FTM)*P1659R317 (部分)*
18
19.31*16.0.0*
禁止 basic_stringbasic_string_viewnullptr 构造 P2166R112 13 19.30*13.1.6*
std::invoke_r()  (FTM)*P2136R312 17 19.31*15.0.0*
std::basic_string_view 的范围构造函数P1989R211 14 19.30*14.0.3*
std::pair 的转发构造函数的默认模板实参 P1951R114 14 19.30*14.0.3*
移除垃圾收集与基于可达性的泄漏检测(库支持P2186R212 14 19.30*14.0.3*
zip: views::zip, views::zip_transform, views::adjacent, 和 views::adjacent_transform  (FTM)*P2321R213 15 (部分)*19.33*(部分)***
19.37*
14.0.3*
关联容器的异质擦除重载  (FTM)*P2077R319.32*
std::byteswap()  (FTM)*P1272R412 14 19.31*14.0.3*
打印volatile T*P1147R111.3 14 19.31*14.0.3*
basic_string::resize_and_overwrite()  (FTM)*P1072R1012 14 19.31*14.0.3*
std::optional 的单子操作  (FTM)*P0798R812 14 19.32*14.0.3*
std::move_only_function  (FTM)*P0288R912 19.32*
std::exchange 添加条件性 noexcept 说明 P2401R012 14 19.25*14.0.3*
要求 std::spanstd::basic_string_view可平凡复制(TriviallyCopyable) P2251R1
澄清“C 头文件”的状况 P2340R1
<expected>  (FTM)*P0323R12
P2549R1
12 16 19.33*15.0.0*
constexpr 的 <cmath><cstdlib>  (FTM)*P0533R94.6 (部分)*
std::unreachable()  (FTM)*P0627R612 15 19.32*14.0.3*
弃用 std::aligned_storagestd::aligned_unionP1413R313 16 19.33*
std::reference_constructs_from_temporary & std::reference_converts_from_temporary  (FTM)*P2255R213 (部分)*
14
21 (部分)*
constexprstd::unique_ptr  (FTM)*P2273R312 16 19.33*15.0.0*
ranges::to(),带标签构造函数,insert 和 assign 成员函数从范围来构造容器和字符串  (FTM)*  (FTM)*P1206R714 (部分)*
15
17 19.34*15.0.0*
用户定义适配器范围的管道支持(ranges::range_adaptor_closure, std::bind_back)  (FTM)*  (FTM)*P2387R313 (部分)*
14
19 19.34*
ranges::iota()ranges::shift_left()ranges::shift_right()  (FTM)*  (FTM)*P2440R113 (部分)*19.34*
views::join_with  (FTM)*P2441R213 19.34*
views::chunkviews::slide  (FTM)*  (FTM)*P2442R113 19.33*
views::chunk_by  (FTM)*P2443R113 18 19.33*16.0.0*
std::mdspan:非所有者的多维数组引用  (FTM)*P0009R18
P2599R2
P2604R0
P2613R1
P2763R1
17 (部分)
18*
19.39*15.0.0*
<flat_map>  (FTM)*P0429R915 20
<flat_set>  (FTM)*P1222R415 21
ranges::find_last()ranges::find_last_if(),和 ranges::find_last_if_not()  (FTM)*P1223R513 19 19.36*
独立式库:简单的 <utility><ranges><iterator>P1642R1113*不适用
views::stride  (FTM)*P1899R313 19.34*
比较 std::tuple 和 tuple-like 对象  (FTM)*P2165R414 2.9 (部分)*19.36* (部分)*
19.37*
部分*
矫正常量迭代器、哨位和范围。 views::as_const  (FTM)*P2278R413 19.35*(部分)*
19.36*
格式化范围  (FTM)*P2286R815 (部分)
15.2*
16 19.37*(部分)*
19.39*(部分)*
19.41*(部分)*
19.42*
15.0.0*
改进容器的默认格式化  (FTM)*P2585R115 16 (部分)*
17
19.42*15.0.0*
格式化输出库 <print>  (FTM)*P2093R14
P2539R4
14 17 (部分)
18*
19.37*15.0.0**
格式化std::thread::idstd::stacktrace  (FTM)*P2693R114 17 (部分)*19.38*15.0.0*
constexprstd::to_chars()std::from_chars() 对整数的重载  (FTM)*P2291R313 16 19.34*15.0.0*
ranges::contains()ranges::contains_subrange()  (FTM)*P2302R413 18 (部分)*
19
19.34*16.0.0**
范围折叠算法  (FTM)*P2322R613 19.35*
views::cartesian_product  (FTM)*P2374R4
P2540R1
13 19.37*
对仅移动类型添加可比较概念 (equality_comparabletotally_orderedthree_way_comparable) 的支持  (FTM)*P2404R319.36*
非范围算法输入范围迭代器  (FTM)*P2408R519.34*
constexprstd::bitset  (FTM)*P2417R213 16 19.34*15.0.0*
basic_string::substr()&&P2438R216 19.34*15.0.0*
views::as_rvalue  (FTM)*P2446R213 16 19.34*15.0.0*
标准库模块  (FTM)*P2465R315*17 (部分)*19.35*(部分)*
19.36*
std::forward_like()  (FTM)*P2445R114 16 19.34*15.0.0*
std::fstream 添加独占模式  (FTM)*P2467R112 18 19.36*16.0.0*
views::repeat  (FTM)*P2474R213 17 19.36*15.0.0*
放宽范围适配器对只移动类型的要求  (FTM)*P2494R214 17 19.34*15.0.0*
std::basic_string_view 范围构造函数 应为 explicit P2499R012.2 16 19.34*15.0.0*
std::generator:范围同步协程生成器  (FTM)*P2502R2
P2787R0
14 19.43*
std::apply 添加条件 noexcept 说明 P2517R110 18 19.34*16.0.0*
显式生命周期管理 (std::start_lifetime_as)  (FTM)*P2590R2
P2679R2
明确 chrono 类型本地化格式中编码的处理方法  (FTM)*P2419R215*19.34**
std::move_iterator 不应该总为 input_iterator  (FTM)*P2520R012.3*17*19.34**15.0.0*
显式对象实参函数调用运算符 的推导指引更新 LWG361714 19.34*
static operator() 的推导指引更新 P1169R413 16 19.39*15.0.0*
扩展浮点数类型的标准名字以及库支持 P1467R913 19.37**
std::expected 的单子操作  (FTM)*P2505R513 17 19.36*15.0.0*
views::enumerate  (FTM)*P2164R913 19.37*
std::is_implicit_lifetime  (FTM)*P2674R120
std::reference_wrapperstd::common_reference_t 应该为引用类型  (FTM)*  (FTM)*P2655R319.37*
禁止用户特化 std::allocator_traitsP2652R219 19.37*
弃用 std::numeric_limits::has_denormP2614R218 19.37*16.0.0*
view 创造 explicit 的多参构造函数 P2711R117 (部分)*19.36**15.0.0*
DR20:稍微放松 range 的要求  (FTM)*P2609R315 20 19.37*
DR20:储存储存迭代器以实现适当的扁平化 P2770R014 18 19.37*
DR17:std::variant 的派生类的 std::visit()  (FTM)*P2162R211.3 13 19.20**
19.30*
13.1.6*
DR20:条件性借用范围 P2017R111 16 19.30*
DR20:修复输入范围适配器std::counted_iteratorP2259R112 19.30*(部分)*
19.31*
DR20: views::join 应结合所有范围 P2328R111.2 15 19.30*14.0.3*
DR20:view 不要求 default_initializable  (FTM)*P2325R311.3 16 19.30*15.0.0*
DR20:范围适配器对象按值绑定实参 P2281R111 14 19.29 (16.10)*(部分)*
19.31*
14.0.3*
DR20:std::optionalstd::variantconstexpr  (FTM)*  (FTM)*P2231R111.3 (部分)*
12
13 (部分)*
19
19.31*13.1.6* (部分)
DR20: views::lazy_split 与重新设计的 views::splitP2210R212 16 19.31*15.0.0*
DR20:修复 ranges::istream_viewP2432R112 16 19.31*15.0.0*
DR20:带所有权的 view  (FTM)*P2415R212 14 19.31*14.0.3*
DR20:修复 chrono 格式化器中的本地环境支持  (FTM)*P2372R3
P2418R2
13 19.31*
DR20:清理整数类类型 P2393R119.32*
DR20:编译时格式字符串检查;减小 std::format() 族函数二进制代码大小  (FTM)*P2216R313 14 (部分)*
15
19.32*14.0.3*
DR20:为 std::format 添加不可 const 格式化类型的支持 P2418R213 15 19.32*14.0.3*
DR20:std::basic_format_stringP2508R113 15 19.35*14.0.3*
DR20:放松对定制点对象的限制  (FTM)*P2602R214 19 19.36*
DR20:std::format 补齐填充字符 P2572R114 17 19.37*
DR20:改进 std::format 的宽度估计 P2675R114 17 19.38*
DR20:std::barrier 的阶段完成保证  (FTM)*P2588R319.28 (16.8)**
19.36*
 

C++23 功能特性
 

提案
GCC libstdc++
Clang libc++
MSVC STL
Apple Clang*

[编辑]C++20 功能特性

[编辑]C++20 核心语言功能特性

C++20 功能特性

 
提案

 
GCC
Clang
MSVC
Apple Clang
EDG eccp
Intel C++
Nvidia HPC C++ (ex PGI)*
Nvidia nvcc
Cray
允许 lambda 捕获[=, this]P0409R28 6 19.22*10.0.0*5.1 2021.1 20.7 12.0 11.0
__VA_OPT__P0306R4
P1042R1
8 (部分)*
10 (部分)*
12
9 19.25*11.0.3*5.1 2021.1 20.7 12.0 11.0
指派初始化器  (FTM)*P0329R44.7 (部分)*
8
3.0 (部分)*
10
19.21*(部分)*5.1 2021.1 20.7 12.0 11.0
泛型 lambda 的模板形参列表  (FTM)*P0428R28 9 19.22*11.0.0*5.1 2021.1 20.7 12.0 11.0
位域的默认成员初始化器P0683R18 6 19.25*10.0.0*5.1 2021.1 20.7 12.0 11.0
类模板实参推导中的 intializer_list 构造函数 P0702R18 6 19.14*5.0 2021.1 20.7 12.0 11.0
const& 限定的成员指针 P0704R18 6 19.0 (2015)*10.0.0*5.1 2021.1 20.7 12.0 11.0
概念  (FTM)*P0734R05*
10
10 19.23*(部分)*
19.30*
12.0.0* (部分) 6.1 2023.1*20.11 12.0 11.0
不求值语境中的 lambdaP0315R49 13 (部分)*
14 (部分)*
17
19.28 (16.8)*13.1.6* (部分) 6.2 2023.1 (部分)
2024.0
20.7 12.0
三路比较运算符  (FTM)*P0515R310 8 (部分)
10
19.20*12.0.0*5.1 2021.1 20.7 12.0 11.0
DR11:简化隐式 lambda 捕获 P0588R18 19.24*5.1 2021.1 20.7 12.0
基于范围的 for 的初始化语句P0614R19 8 19.25*11.0.0*6.0 2021.7 20.11 12.0 11.0
可默认构造与可赋值的无状态 lambdaP0624R29 8 19.22*10.0.1*5.1 2021.1 20.7 12.0 11.0
预置特殊成员函数的类型不匹配 P0641R29 (部分)*8 19.0 (2015)*(部分)*10.0.1*5.1 2021.1 20.7 12.0 11.0
特化中的访问检查 P0692R18 (部分)
14
19.26*14.0.0*5.1 2021.1 20.7 12.0
ADL 与不可见的函数模板 P0846R09 9 19.21*11.0.3*5.1 2021.1 20.7 12.0 11.0
DR11:指定 constexpr 函数定义何时为常量求值所需要  (FTM)*P0859R05.2 (部分)*
9
8 19.27* (部分)*
19.31**
11.0.0*(部分) 12.0 11.0
属性 [[likely]][[unlikely]]P0479R59 12 19.26*13.0.0*5.1 2021.7 20.7 12.0
使 typename 更可选 P0634R39 16 19.29 (16.10)*16.0.0*5.1 2023.1 20.7 12.0
lambda 初始化捕获中的包展开  (FTM)*P0780R29 9 19.22*11.0.3*6.1 2021.7 20.11 12.0 11.0
属性 [[no_unique_address]]P0840R29 9 19.28 (16.9)**11.0.3*5.1 2021.1 20.7 12.0 11.0
条件性平凡的特殊成员函数  (FTM)*P0848R310 16 19.28 (16.8)*6.1 2021.7 20.11 12.0
DR17:放松结构化绑定定制点查找规则 P0961R18 8 19.20*10.0.1*5.1 2021.1 20.7 12.0 11.0
DR11:放松范围 for 循环定制点查找规则 P0962R18 8 19.25*11.0.0*5.1 2021.1 20.7 12.0 11.0
DR17:允许到可访问成员的结构化绑定 P0969R08 8 19.20*10.0.1*5.1 2021.1 20.7 12.0 11.0
销毁的 operator delete  (FTM)*P0722R39 6 19.27*10.0.0*6.1 2023.1 20.11 12.0 11.0
常量模板形参中的类类型 P0732R29 12 (部分) 19.26* (部分)*
19.28 (16.9)*
13.0.0* (部分) 6.2 2023.1 (部分) 21.3 12.0
弃用经由 [=] 隐式捕获thisP0806R29 7 19.22*10.0.1*5.1 20.7 12.0 11.0
explicit(bool)  (FTM)*P0892R29 9 19.24*11.0.3*5.1 2021.1 20.7 12.0 11.0
集成功能特性测试宏P0941R25 3.4 19.15* (部分)
19.20*
5.0 2021.1 20.7 12.0 11.0
禁止有用户声明构造函数的聚合体 P1008R19 8 19.20*10.0.1*5.1 2021.1 20.7 12.0 11.0
constexpr虚函数  (FTM)*P1064R09 9 19.28 (16.9)*11.0.3*5.1 2021.1 20.7 12.0 11.0
比较的一致性改进 P1120R010 8 (部分)
10
19.22*12.0.0*5.1 2023.1 20.7 12.0 11.0
char8_t  (FTM)*P0482R69 *19.22*10.0.0*5.1 2021.1 20.7 12.0 11.0
std::is_constant_evaluated()  (FTM)*P0595R29 9 19.25*11.0.3*5.1 19.1 21.1 12.0 11.0
constexpr 函数中的 try-catchP1002R19 8 19.25*10.0.1*5.1 2023.1 20.7 12.0 11.0
立即函数consteval)  (FTM)*P1073R310 (部分)*
11
11 (部分)
14 (部分)*
17
19.28 (16.8)*
(部分)*

19.29 (16.10)*
11.0.3* (部分)
15.0.0*
5.1 2021.1 20.7 12.0
嵌套内联命名空间P1094R29 8 19.27*10.0.1*5.1 2021.1 20.7 12.0 11.0
有约束声明的另一种方式 P1141R210 10 19.26* (部分)
19.28 (16.9)*
12.0.5*6.1 2023.1 20.11 12.0 11.0
有符号整数为补码 P1236R19 9 11.0.3*不适用2023.1*是*12.0 11.0
常量表达式中的 dynamic_cast 及多态 typeidP1327R110 9 19.28 (16.9)*11.0.3*5.1 2021.1 20.7 12.0 11.0
constexpr 内更改联合体的活跃成员  (FTM)*P1330R09 9 19.10*11.0.3*5.1 2021.1 20.7 12.0 11.0
协程  (FTM)*  (FTM)*P0912R5
LWG3393
10 8 (部分)
17 (部分)*
19.0 (2015)* (部分)
19.10**
19.28 (16.8)*
10.0.1* (部分) 5.1 2021.1 23.3*12.0 (host code only)
括号形式的聚合体初始化  (FTM)*P0960R310 16 19.28 (16.8)*16.0.0*5.1 2021.1 20.7 12.0
DR11:new 表达式中的数组大小推导 P1009R211 9 19.27*11.0.3*5.1 2021.1 20.7 12.0 11.0
模块  (FTM)*P1103R311 (部分) 8 (部分) 19.0 (2015)* (部分)
19.10**
19.28 (16.8)*
10.0.1* (部分) 2023.1 (部分)
更强的 Unicode 要求 P1041R4
P1139R2
10 19.0 (2015)**
19.26**
不适用2023.1*12.0 11.0
<=> != ==P1185R210 10 19.22*12.0.0*5.1 2021.1 20.7 12.0 11.0
DR11:拥有不同异常说明的显式默认化函数 P1286R210 9 19.28 (16.8)*11.0.3*5.1 2021.1 20.7 12.0 11.0
结构化绑定的 lambda 捕获与存储类说明符 P1091R3
P1381R1
10 8 (部分)
16
19.11**
19.24**
16.0.0*5.1 2021.1 20.7 12.0
容许转换到未知边界数组 P0388R410 14 19.27*14.0.0*6.0 2021.5 20.11 12.0
constexpr 容器操作  (FTM)*P0784R710 10 19.28 (16.9)*12.0.0*6.0 2021.5 20.11 12.0 11.0
弃用 volatile 的某些用法 P1152R410 10 19.27*12.0.0*6.0 2021.5 20.11 12.0 11.0
constinit  (FTM)*P1143R210 10 19.29 (16.10)*12.0.0*6.1 2021.7 20.11 12.0 11.0
弃用下标中的逗号运算符P1161R310 9 19.25*11.0.3*6.0 2021.7 20.11 12.0 11.0
带消息的 [[nodiscard]]P1301R410 9 19.25*11.0.3*6.0 2021.5 20.11 12.0 11.0
constexpr 函数中的平凡默认初始化 P1331R210 10 19.27*12.0.0*6.1 2021.7 20.11 12.0 11.0
constexpr 函数中的不求值 asm 声明 P1668R110 10 19.28 (16.9)*12.0.0*6.1 2021.7 20.11 12.0 11.0
using enum  (FTM)*P1099R511 13 19.24*13.1.6*6.3 2023.1 22.5 12.0
对指定的比较类别合成三路比较P1186R311 10 19.24*12.0.0*6.0 2021.5 20.11 12.0 11.0
DR17:构造函数的 [[nodiscard]]P1771R110 9 19.24*11.0.3*6.0 2021.5 20.11 12.0 11.0
别名模板的类模板实参推导  (FTM)*P1814R010 19 19.27*6.5 23.9 12.0
聚合类的类模板实参推导  (FTM)*P1816R0
P2082R1
10*
11*
17 19.27*6.3 2023.1 (部分)*
2024.1
23.3 12.0
DR11:更多局部对象与右值引用的隐式移动P1825R011*13 19.24*13.1.6*6.0 2021.5 20.11 12.0
允许默认化按值比较 P1946R010 10 19.25*12.0.0*6.1 2021.7 20.11 12.0 11.0
移除 std::weak_equalitystd::strong_equalityP1959R010 10 19.25*12.0.0*6.1 2021.7 20.11 12.0 11.0
常量模板形参的不一致  (FTM)*P1907R110 (部分)
11
18 (部分)*19.26*13.1.6* (部分) 6.2 2023.1 (部分) 21.3 12.0
DR98:伪析构函数终结对象生存期 P0593R611 11 12.0.5*不适用2023.1*12.0 11.0
DR11:应认为从 T*bool 的转换为窄化 P1957R210*
11*
11 19.27*12.0.5*6.1 12.0 11.0
 

C++20 功能特性
 

提案
GCC
Clang
MSVC
Apple Clang
EDG eccp
Intel C++
Nvidia HPC C++ (ex PGI)*
Nvidia nvcc
Cray

[编辑]C++20 库功能特性

C++20 功能特性

 
提案

 
GCC libstdc++
Clang libc++
MSVC STL
Apple Clang*
std::endian  (FTM)*P0463R18 7 19.22*10.0.0*
扩展 std::make_shared() 以支持数组  (FTM)*P0674R112 15 19.27*14.0.3*
原子浮点数类型  (FTM)*P0020R610 18 19.22*16.0.0*
同步缓冲std::basic_osyncstream)  (FTM)*P0053R711 18 19.29 (16.10)*
<algorithm><utility>constexpr  (FTM)*P0202R310 8 (部分)
12
19.26*10.0.1* (部分)
13.0.0*
<complex> 的更多 constexpr  (FTM)*P0415R19 7 (部分)
16
19.27*10.0.0* (部分)
15.0.0*
使 std::memory_order 为有作用域枚举 P0439R09 9 19.25*11.0.3*
字符串前缀后缀检查:string(_view) ::starts_with / ends_with  (FTM)*P0457R29 6 19.21*10.0.0*
operator<=> 的库支持 <compare>  (FTM)*P0768R110 7 (部分)
12 (部分)*
17
19.20* (部分)
19.28 (16.9)*
13.0.0*
std::remove_cvref  (FTM)*P0550R29 6 19.20*10.0.0*
标准库中的 [[nodiscard]]P0600R19 7 (部分)
16
19.13* (部分)
19.22*
10.0.0* (部分)
15.0.0*
数值算法使用 std::moveP0616R09 12 19.23*13.0.0*
转换指针为裸指针的工具  (FTM)*P0653R28 6 19.22*
原子 std::shared_ptrstd::weak_ptr  (FTM)*P0718R212 19.27*
std::span  (FTM)*P0122R710 7 19.26*10.0.0*
日历时区  (FTM)*P0355R711 (部分)*
13 (部分)*
14
7 (部分)
19 (部分)*
19.29 (16.10)*10.0.0* (部分)
<version>P0754R29 7 19.22*10.0.0*
比较无序容器 P0809R016.0*
常量表达式迭代器(ConstexprIterator) 要求  (FTM)*  (FTM)*P0858R09 12 19.11*13.0.0*
std::basic_string::reserve() 不应收缩 P0966R111 8 19.25*10.0.1*
带填充位的原子比较交换P0528R313 19.28 (16.8)*
std::atomic_ref  (FTM)*P0019R810 19 19.28 (16.8)*
关联容器的 contains() 成员函数,如 std::map::contains()P0458R29 13 19.21*13.1.6*
DR11:逐片构造的受保证复制消除 P0475R19 19.29 (16.10)*
std::bit_cast()  (FTM)*P0476R211 14 19.27*14.0.3*
2 的整数次幂运算

std::bit_ceil()std::bit_floor()std::bit_width()std::has_single_bit()  (FTM)*

P0556R3
P1956R1
9*
10*
9*
12*
19.25**
19.27**
19.28 (16.8)*
11.0.3**
13.0.0**
改进擦除式算法的返回值  (FTM)*P0646R19 10 19.21*12.0.0*
std::destroying_delete_t  (FTM)*P0722R39 9 19.27*11.0.3*
std::is_convertible  (FTM)*P0758R19 9 19.23*11.0.3*
添加 std::shift_left/right<algorithm>  (FTM)*P0769R210 12 19.21*13.0.0*
std::swap()swap 相关函数的 constexpr P0879R010 13 19.26*13.1.6*
std::type_identity  (FTM)*P0887R19 8 19.21*10.0.1*
概念库  (FTM)*P0898R310 13 19.23*13.1.6*
std::arrayconstexpr比较运算符P1023R010 8 19.27*10.0.1*
std::unwrap_ref_decaystd::unwrap_reference  (FTM)*P0318R19 8 19.21*10.0.1*
std::bind_front()  (FTM)*P0356R59 13 19.25*13.1.6*
不完整类型的 std::reference_wrapperP0357R39 8 19.26*10.0.1*
修正 operator>>(basic_istream&, CharT*)P0487R111 8 19.23*10.0.1*
char8_t 的库支持  (FTM)*P0482R69 8 (部分)
16
19.22*10.0.1* (部分)
15.0.0*
实现使用分配器构造工具函数P0591R49 16 19.29 (16.10)*15.0.0*
DR17:std::variantstd::optional 应传播复制/移动平凡性 P0602R48.3 8 19.11*10.0.1*
DR17:理智的 std::variant 转换构造函数 P0608R310 9 19.29 (16.10)**
19.42**
11.0.3*
std::function 的移动构造函数应为 noexceptP0771R17.2 6 19.22*
唯一范围提案  (FTM)*P0896R410 13 (部分)
15*
19.29 (16.10)*14.0.3*
无序关联容器的异质查找  (FTM)*P0919R3
P1690R1
11 12 19.23**
19.25**
13.0.0*
<chrono>zero()min()max() 应为 noexceptP0972R09 8 19.14*10.0.1*
std::pointer_traits 中的 constexpr  (FTM)*P1006R19 8 19.26*10.0.1*
std::assume_aligned()  (FTM)*P1007R39*
11
15 19.28 (16.9)*14.0.3*
使用默认初始化的智能指针创建(如 make_unique_for_overwrite)  (FTM)*P1020R1
P1973R1
11*
12*
16 19.28 (16.9)*15.0.0*
杂项 constexpr 小部分  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*P1032R110 13 19.28 (16.8)*13.1.6*
移除 std::span 的比较运算符 P1085R210 8 19.26*10.0.1*
使 operator+(basic_string) 的有状态分配器传播更加一致 P1165R110 15 19.26*14.0.3*
一致容器擦除,如 std::erase(std::vector)std::erase_if(std::map)  (FTM)*P1209R0
P1115R3
9*
10*
8*
11*
19.25**
19.27**
10.0.1**
12.0.5**
标准库头文件单元 P1502R111 19.29 (16.10)*
polymorphic_allocator<> 作为词汇类型  (FTM)*P0339R69 16 19.28 (16.9)*15.0.0*
std::execution::unseq  (FTM)*P1001R29 17 19.28 (16.8)*
std::lerp()std::midpoint()  (FTM)*P0811R39 9 19.23* (部分)
19.28 (16.8)*
11.0.3*
std::span 的实用性增强 P1024R310 9*
14
19.26*11.0.3*
DR17:使 std::create_directory() 自发 P1164R18.3 12 19.20*13.0.0*
std::ssize()std::span 的无符号长度  (FTM)*P1227R210 9 19.25*11.0.3*
有界无界数组特征  (FTM)*P1357R19 9 19.25*11.0.3*
std::to_array()  (FTM)*P0325R410 10 19.25*12.0.0*
std::basic_stringbuf 缓冲的有效访问 P0408R711 17 19.29 (16.10)*15.0.0*
布局兼容性指针可互转换性特征  (FTM)*  (FTM)*P0466R512 19.29 (16.10)**
位操作std::

rotl()rotr()countl_zero()countl_one()countr_zero()countr_one()popcount()  (FTM)*

P0553R49 9 19.25**
19.28 (16.8)*
11.0.3*
数学常数  (FTM)*P0631R810 11 19.25*12.0.5*
文本格式化  (FTM)*P0645R1013 14**
17
19.29 (16.10)*15.0.0*
std::stop_tokenstd::jthread  (FTM)*P0660R1010 17 (部分)*
20*
19.28 (16.9)*
constexprstd::allocator 及相关工具  (FTM)*P0784R710 12 19.29 (16.10)*13.0.0*
constexprstd::string  (FTM)*P0426R1
P1032R1
P0980R1
12 15 19.29 (16.10)*
19.30**
14.0.3*
constexprstd::vector  (FTM)*P1004R212 15 19.29 (16.10)*
19.30**
14.0.3*
输入范围适配器P1035R710 16 19.29 (16.10)*15.0.0*
constexprstd::invoke() 及相关工具 P1065R210 12 19.28 (16.8)*13.0.0*
原子等待与提醒、std::counting_semaphorestd::latchstd::barrier  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*P1135R611 11 19.28 (16.9)*13.1.6*
std::source_location  (FTM)*P1208R611 15* (部分)
16
19.29 (16.10)*15.0.0*
添加 <=> 到标准库 P1614R210 14* (部分)
17* (部分)
19
19.29 (16.10)*13.1.6* (部分)
std::atomicstd::atomic_flagconstexpr 默认构造函数  (FTM)*P0883R210 13 19.26*13.1.6*
数值算法constexpr  (FTM)*P1645R110 12 19.26*13.0.0*
安全整数比较  (FTM)*P0586R210 13 19.27*13.1.6*
 

C++20 功能特性
 

提案
GCC libstdc++
Clang libc++
MSVC STL
Apple Clang*

[编辑]旧标准

[编辑]参阅

功能特性测试(C++20) 一组预处理器宏,用于测试与 C++ 语言和库功能特性的对应关系
编译器支持C 文档
close