C++17 的编译器支持
来自cppreference.com
< cpp | compiler support
C++17 核心语言功能特性
C++17 功能特性 |
提案 |
GCC |
Clang |
MSVC |
Apple Clang |
EDG eccp |
Intel C++ |
IBM XLC++ |
Sun/Oracle C++ |
Embarcadero C++ Builder |
Cray |
Nvidia HPC C++ (前 Portland Group/PGI) |
Nvidia nvcc |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
直接列表初始化的新 auto 规则 | N3922 | 5 | 3.8 | 19.0 (2015)* | 是 | 4.10.1 | 17.0 | 10.3 | 17.7 | |||||
无消息的 static_assert | N3928 | 6 | 2.5 | 19.10* | 是 | 4.12 | 18.0 | 10.3 | 17.7 | |||||
模板模板形参中的 typename
|
N4051 | 5 | 3.5 | 19.0 (2015)* | 是 | 4.10.1 | 17.0 | 10.3 | 17.7 | |||||
移除三标符 | N4086 | 5 | 3.5 | 16.0* | 是 | 5.0 | 19.0.1 | 10.3 | ||||||
嵌套命名空间定义 | N4230 | 6 | 3.6 | 19.0 (Update 3)* | 是 | 4.12 | 17.0 | 10.3 | 17.7 | |||||
命名空间和枚举项的属性 | N4266 | 4.9 (部分)* 6 |
3.6 | 19.0 (2015)* | 是 | 4.11 | 17.0 | 10.3 | 17.7 | |||||
u8 字符字面量
|
N4267 | 6 | 3.6 | 19.0 (2015)* | 是 | 4.11 | 17.0 | 10.3 | 17.7 | |||||
允许所有非类型模板实参的常量求值 | N4268 | 6 | 3.6 | 19.12* | 是 | 5.0 | 19.0.1 | 10.3 | ||||||
折叠表达式 | N4295 | 6 | 3.6 | 19.12* | 是 | 4.14 | 19.0 | 10.3 | 18.1 | |||||
一元折叠表达式和空形参包 | P0036R0 | 6 | 3.9 | 19.12* | 是 | 4.14 | 10.3 | |||||||
移除 register 关键字的已弃用用法 | P0001R1 | 7 | 3.8 | 19.11* | 是 | 4.13 | 18.0 | 10.3 | 17.7 | |||||
移除已弃用的 operator++(bool)
|
P0002R1 | 7 | 3.8 | 19.11* | 是 | 4.13 | 18.0 | 10.3 | 17.7 | |||||
令异常规定为类型系统的一部分 | P0012R1 | 7 | 4 | 19.12* | 是 | 4.14 | 19.0 | 10.3 | ||||||
有基类的类的聚合初始化 | P0017R1 | 7 | 3.9 | 19.14* | 是 | 5.0 | 19.0.1 | 10.3 | ||||||
预处理器条件中的 __has_include | P0061R1 | 5 | 是 | 19.11* | 是 | 4.13 | 18.0 | 10.3 | 17.7 | |||||
DR :继承构造函数的新规定 (DR1941 等) | P0136R1 | 7 | 3.9 | 19.14* | 是 | 6.1 | 10.3 | 19.1 | ||||||
*this 的 lambda 捕获
|
P0018R3 | 7 | 3.9 | 19.11* | 是 | 4.14 | 19.0 | 10.3 | 18.1 | |||||
枚举的直接列表初始化 | P0138R2 | 7 | 3.9 | 19.11* | 是 | 4.14 | 18.0 | 10.3 | ||||||
constexpr lambda 表达式 | P0170R1 | 7 | 5 | 19.11* | 是 | 4.14 | 19.0 | 10.3 | 18.1 | |||||
基于范围 for 的相异 begin 和 end 类型 | P0184R0 | 6 | 3.9 | 19.10* | 是 | 4.12 | 18.0 | 10.3 | 17.7 | |||||
[[fallthrough]] 属性
|
P0188R1 | 7 | 3.9 | 19.10* | 是 | 4.13 | 18.0 | 10.3 | 17.7 | |||||
[[nodiscard]] 属性
|
P0189R1 | 7 | 3.9 | 19.11* | 是 | 4.13 | 18.0 | 10.3 | 17.7 | |||||
[[maybe_unused]] 属性
|
P0212R1 | 7 | 3.9 | 19.11* | 是 | 4.13 | 18.0 | 10.3 | 17.7 | |||||
十六进制浮点字面量 | P0245R1 | 3.0 | 是 | 19.11* | 是 | 4.13 | 18.0 | 10.3 | 17.7 | |||||
使用属性命名空间而不重复 | P0028R4 | 7 | 3.9 | 19.11* | 是 | 4.13 | 18.0 | 10.3 | 17.7 | |||||
过对齐数据的动态内存分配 | P0035R4 | 7 | 4 | 19.12* |
10.0.0* |
4.14 | 10.3 | |||||||
类模板实参推导 | P0091R3 | 7 | 5 | 19.14* | 是 | 5.0 | 19.0.1 | 10.3 | 19.1 | |||||
具有 auto 类型的非类型模板形参
|
P0127R2 | 7 | 4 | 19.14* | 是 | 5.0 | 19.0.1 | 10.3 | 19.1 | |||||
受保证的复制消除 | P0135R1 | 7 | 4 | 19.13* | 是 | 5.0 | 19.0.1 | 10.3 | 19.1 | |||||
替换含引用成员的类对象 | P0137R1 | 7 | 6 | 19.14* | 是 | 5.0 | 10.3 | |||||||
更严格的表达式求值顺序 | P0145R3 | 7 | 4 | 19.14* | 是 | 5.0 | 19.0.1 | 10.3 | ||||||
结构化绑定 | P0217R3 | 7 | 4 | 19.11* | 是 | 4.14 | 19.0 | 10.3 | 18.1 | |||||
忽略未知属性 | P0283R2 | 是 | 3.9 | 19.11* | 是 | 4.13 | 18.0 | 10.3 | 17.7 | |||||
constexpr if 语句 | P0292R2 | 7 | 3.9 | 19.11* | 是 | 4.14 | 19.0 | 10.3 | 18.1 | |||||
if 和 switch 的初始化语句 | P0305R1 | 7 | 3.9 | 19.11* | 是 | 4.14 | 18.0 | 10.3 | 18.1 | |||||
inline 变量 | P0386R2 | 7 | 3.9 | 19.12* | 是 | 4.14 | 19.0 | 10.3 | 18.1 | |||||
移除动态异常说明 | P0003R5 | 7 | 4 | 19.10* | 是 | 4.14 | 19.0 | 10.3 | ||||||
using 声明中的包展开 | P0195R2 | 7 | 4 | 19.14* | 是 | 5.0 | 10.3 | |||||||
DR :模板模板实参的匹配排除了兼容的模板 | P0522R0 | 7 | 4 | 19.12* | 是 | 5.0 | 19.0.1 | 10.3 | ||||||
C++17 功能特性 |
提案 |
GCC |
Clang |
MSVC |
Apple Clang |
EDG eccp |
Intel C++ |
IBM XLC++ |
Sun/Oracle C++ |
Embarcadero C++ Builder |
Cray |
Nvidia HPC C++ |
Nvidia nvcc |
C++17 库功能特性
C++17 功能特性 |
提案 |
GCC libstdc++ |
Clang libc++ |
MSVC STL |
Apple Clang |
Intel 并行 STL |
Sun/Oracle C++ 标准库 |
Embarcadero C++ Builder 标准库 |
Cray C++ 标准库 |
|
---|---|---|---|---|---|---|---|---|---|---|
std::void_t | N3911 | 6 | 3.6 | 19.0 (2015)* | 是 | N/A | 10.3 | |||
std::uncaught_exceptions() | N4259 | 6 | 3.7 | 19.0 (2015)* | 是 | N/A | 10.3 | |||
std::size() 、 std::empty() 与 std::data() | N4280 | 6 | 3.6 | 19.0 (2015)* | 是 | N/A | 10.3 | |||
改进 std::pair 与 std::tuple | N4387 | 6 | 4 | 19.0 (Update 2)* | 是 | N/A | 10.3 | |||
std::bool_constant | N4389 | 6 | 3.7 | 19.0 (2015)* | 是 | N/A | 10.3 | |||
std::shared_mutex (无时限) | N4508 | 6 | 3.7 | 19.0 (Update 2)* | 是 | N/A | 10.3 | |||
类型特性变量模板 | P0006R0 | 7 | 3.8 | 19.0 (Update 2)* | 是 | N/A | 10.3 | |||
逻辑运算符类型特性 | P0013R1 | 6 | 3.8 | 19.0 (Update 2)* | 是 | N/A | 10.3 | |||
标准化并行 TS | P0024R2 | 9* | 19.14* | 18.0* | ||||||
std::clamp() | P0025R0 | 7 | 3.9 | 19.0 (Update 3)* |
10.0.0* |
N/A | 10.3 | |||
硬件干涉大小 | P0154R1 | 19.11* | N/A | |||||||
(nothrow-)swappable 特性 | P0185R1 | 7 | 3.9 | 19.0 (Update 3)* |
10.0.0* |
N/A | 10.3 | |||
文件系统库 | P0218R1 | 8 | 7 | 19.14* |
11.0.0* |
N/A | 10.3 | |||
std::string_view | N3921 P0220R1 |
7 | 4 | 19.10* |
10.0.0* |
N/A | 10.3 | |||
std::any | P0220R1 | 7 | 4 | 19.10* |
10.0.0* |
N/A | 10.3 | |||
std::optional | P0220R1 | 7 | 4 | 19.10* |
10.0.0* |
N/A | 10.3 | |||
多态内存资源 | P0220R1 | 9 | 19.13* | N/A | 10.3 | |||||
数学特殊函数 | P0226R1 | 7 | 19.14* | N/A | 10.3 | |||||
C++17 应指代 C11 而非 C99 | P0063R3 | 9 | 7 | 19.0 (2015)* (部分)* |
N/A | 10.3 | ||||
接合 map 与 set | P0083R3 | 7 | 8 | 19.12* |
10.0.0* |
N/A | ||||
std::variant | P0088R3 | 7 | 4 | 19.10* |
10.0.0* |
N/A | 10.3 | |||
std::make_from_tuple() | P0209R2 | 7 | 3.9 | 19.10* | 是 | N/A | 10.3 | |||
std::has_unique_object_representations | P0258R2 | 7 | 6 | 19.11* | 是 | N/A | 10.3 | |||
std::gcd() 与 std::lcm() | P0295R0 | 7 | 4 | 19.11* | 是 | N/A | 10.3 | |||
std::not_fn | P0005R4 P0358R1 |
7 | 3.9 | 19.12* | N/A | 10.3 | ||||
初等字符串转换 | P0067R5 | 8 (无浮点) | 7 (无浮点) | 19.14* (无浮点)* 19.24* |
N/A | |||||
有数组支持的 std::shared_ptr 与 std::weak_ptr | P0414R2 | 7 | 11 | 19.12* | N/A | 10.3 | ||||
std::scoped_lock | P0156R2 | 7 | 5 | 19.11* | 是 | N/A | 10.3 | |||
std::byte | P0298R3 | 7 | 5 | 19.11* | 是 | N/A | 10.3 |
| ||
std::is_aggregate | LWG2911 | 7 | 5 | 19.15* | 是 | N/A | 10.3 | |||
C++17 功能特性 |
提案 |
GCC libstdc++ |
Clang libc++ |
MSVC STL |
Apple Clang |
Intel 并行 STL |
Sun/Oracle C++ 标准库 |
Embarcadero C++ Builder 标准库 |
Cray C++ 标准库 |