名稱空間
變體
操作

C++23 編譯器支援

來自 cppreference.com

* - 將滑鼠懸停在標有星號 * 的單元格上可檢視額外的彈出式註釋。
DRnn - “DR”後的數字 nn 表示該缺陷報告(Defect Report)所適用的 C++ 修訂版本,例如 DR20 → C++20。

[編輯] C++23 核心語言特性

C++23 特性

 
提案

 
GCC
Clang
MSVC
Apple Clang
EDG eccp
Intel C++
Nvidia HPC C++ (前 PGI)*
Nvidia nvcc
Cray
字面量字尾 用於 (有符號) size_t (FTM)* P0330R8 11 13 19.43* 13.1.6* 6.5 2022.2 23.9
使 lambdas() 更可選 P1102R2 11 13 19.44* 13.1.6* 6.3 2022.2 22.5
if consteval (FTM)* P1938R3 12 14 19.44* 14.0.0* 6.3 2022.2 24.1
移除垃圾回收支援 P2186R2 12 不適用 19.30* 不適用 不適用
static_assertconstexpr if 中的收窄上下文轉換 P1401R5 9 13 (部分)*
14
14.0.0* 2022.2 20.7
行拼接前去除空白字元 P2223R2 6.7 2022.2
強制規定宣告順序佈局 P1847R4 2022.2
移除混合寬字串字面量連線 P2201R1
顯式物件成員函式 (推導 this) (FTM)* P0847R7 14 18
19*
19.32*
(部分)*
19.43*
6.3 22.5
auto(x)auto{x} (FTM)* P0849R8 12 15 14.0.3* 6.4 2022.2 23.3
#elifdef#elifndef P2334R1 12 13 19.40* 13.1.6* 6.5 2022.2 23.9
constexpr 函式中的非字面量變數(以及標籤和 goto)(FTM)* P2242R3 12 15 19.43* 14.0.3* 6.3 2022.2 22.5
一致的字元字面量編碼 P2316R2 19.30* 2022.2
字元集和編碼 P2314R4 10 2022.2
擴充套件初始化語句(for 迴圈)以允許別名宣告 P2360R0 12 14 14.0.0* 2022.2
多維下標運算子 (FTM)* P2128R6 12 15 19.42* 14.0.3* 2022.2
lambda 上的屬性 P2173R1 9 13 19.44* 13.1.6* 6.6 2022.2 22.5
#warning P2437R1 是* 15.0.0* 6.5 2023.2
移除不可編碼的寬字元字面量和多字元寬字元字面量 P2362R3 13 14 15.0.0* 6.7 2023.2
複合語句末尾的標籤 P2324R2 13 16 16.0.0* 6.5 2023.2 23.9
帶分隔符的轉義序列 P2290R3 13 15 15.0.0* 6.7 2023.2
命名通用字元轉義 (FTM)* P2071R2 13 15 15.0.0* 6.7 2023.2
放寬某些 constexpr 限制 (FTM)* P2448R2 13 17 (部分)
19
2024.0 (部分)
更簡單的隱式移動   (FTM)* P2266R3 13 13 6.7 2022.2
static operator() (FTM)* P1169R4 13 16 19.44* 16.0.0* 6.7 2023.2
可選擴充套件浮點型別的要求 P1467R9 13 不適用 6.4
從繼承的建構函式中推導類模板引數 P2582R1 14
屬性 [[assume]] P1774R8 13 19
支援 UTF-8 作為可移植原始檔編碼 P2295R6 13* 15* 19.0 (Update 2)** 15.0.0* 2023.2
static operator[] (FTM)* P2589R1 13 16 19.44* 16.0.0* 6.7 2023.2
允許在 constexpr 函式中使用 static constexpr 變數 (FTM)* P2647R1 13 16 16.0.0* 2023.2
延長基於範圍的 for 迴圈初始化器中臨時物件的生命週期 (FTM)* P2644R1
P2718R0
CWG2659
15 19
DR11:更改 lambda 尾部返回型別的範圍 P2036R3
P2579R0
17 2023.2
DR20:有意義的匯出 P2615R1 15 17 (部分)
DR20: consteval 需要向上級傳播 (FTM)* P2564R3 14 17 16.0.0* 6.7 2024.0
DR98:使用 Unicode 標準附件 31 的 C++ 識別符號語法 P1949R7 12 14 14.0.0* 6.4 2022.2
DR11:允許重複的屬性 P2156R1 11 13 13.1.6* 6.5 23.9
DR20:調整特性測試宏 __cpp_concepts 的值 P2493R0 12 19.32* 6.4 23.3
DR98:放寬 wchar_t 的要求以符合現有實踐 P2460R2 15.0.0* 不適用 2023.2
DR11:常量表達式中使用未知指標和引用 P2280R4 14 20*
DR20:您正在尋找的相等運算子 P2468R2 13 16 16.0.0* 2023.2
DR20: char8_t 相容性和可移植性修復 (FTM)* P2513R4 13 16 19.34* 16.0.0* 2023.2
DR98/11:澄清診斷指令的報告,並允許在模板上下文中對非值依賴表示式進行 static_assert CWG2518 13 17 16.0*
(部分)*
19.40*
 

C++23 特性
 

提案
GCC
Clang
MSVC
Apple Clang
EDG eccp
Intel C++
Nvidia HPC C++ (前 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)* P0943R6 12 15 19.31* 14.0.3*
std::is_scoped_enum (FTM)* P1048R1 11 12 19.30* 13.0.0*
std::basic_string::contains(), std::basic_string_view::contains() (FTM)* P1679R3 11 12 19.30* 13.0.0*
std::to_underlying (FTM)* P1682R3 11 13 19.30* 13.1.6*
放寬 time_point<>::clock 的要求 P2212R2 不適用 不適用 不適用 不適用
在 Allocator 介面中提供大小反饋 (FTM)* P0401R6 15 19.30* 14.0.3*
<spanstream>: 基於 std::span 的字串流緩衝區 (FTM)* P0448R4 12 19.31*
std::out_ptr(), std::inout_ptr() (FTM)* P1132R8 14 19 19.30*
constexpr type_info::operator==() (FTM)* P1328R1 12 17 19.33**
19.34*
15.0.0*
std::stackstd::queue 的迭代器對建構函式 (FTM)* P1425R4 12 14 19.31* 14.0.3*
容器推導指南中分配器的非推導上下文 P1518R2 12* 13* 19.31** 13.1.6**
ranges::starts_with()ranges::ends_with() (FTM)* P1659R3 17 (部分)*
18
19.31* 16.0.0*
禁止從 nullptr 構造 std::basic_stringstd::basic_string_view P2166R1 12 13 19.30* 13.1.6*
std::invoke_r() (FTM)* P2136R3 12 17 19.31* 15.0.0*
std::basic_string_view 的 Range 建構函式 P1989R2 11 14 19.30* 14.0.3*
std::pair 的轉發建構函式的預設模板引數 P1951R1 14 14 19.30* 14.0.3*
移除垃圾回收和基於可達性的記憶體洩漏檢測(庫支援 P2186R2 12 14 19.30* 14.0.3*
zip: views::zip, views::zip_transform, views::adjacentviews::adjacent_transform (FTM)* P2321R2 13 15 (部分)* 19.33*(部分)***
19.37*
14.0.3*
關聯容器的異構擦除過載 (FTM)* P2077R3 19.32*
std::byteswap() (FTM)* P1272R4 12 14 19.31* 14.0.3*
列印 volatile T* P1147R1 11.3 14 19.31* 14.0.3*
basic_string::resize_and_overwrite() (FTM)* P1072R10 12 14 19.31* 14.0.3*
std::optional 的單子操作 (FTM)* P0798R8 12 14 19.32* 14.0.3*
std::move_only_function (FTM)* P0288R9 12 19.32*
std::exchange 新增條件 noexcept 規範 P2401R0 12 14 19.25* 14.0.3*
要求 std::spanstd::basic_string_viewTriviallyCopyable P2251R1
澄清“C 標頭檔案”的狀態 P2340R1
<expected> (FTM)* P0323R12
P2549R1
12 16 19.33* 15.0.0*
<cmath><cstdlib> 的 constexpr (FTM)* P0533R9 4.6 (部分)*
std::unreachable() (FTM)* P0627R6 12 15 19.32* 14.0.3*
棄用 std::aligned_storagestd::aligned_union P1413R3 13 16 19.33*
std::reference_constructs_from_temporarystd::reference_converts_from_temporary (FTM)* P2255R2 13 (部分)*
14
19
constexpr std::unique_ptr (FTM)* P2273R3 12 16 19.33* 15.0.0*
使用 ranges::to(),帶標籤建構函式,插入和賦值成員函式從範圍構造容器和字串 (FTM)* (FTM)* P1206R7 14 (部分)* 17 19.34* 15.0.0*
使用者定義範圍介面卡的管道支援 (ranges::range_adaptor_closure, std::bind_back) (FTM)* (FTM)* P2387R3 13 (部分)*
14
19 19.34*
ranges::iota(), ranges::shift_left()ranges::shift_right() (FTM)* (FTM)* P2440R1 13 (部分)* 19.34*
views::join_with (FTM)* P2441R2 13 19.34*
views::chunkviews::slide (FTM)* (FTM)* P2442R1 13 19.33*
views::chunk_by (FTM)* P2443R1 13 18 19.33* 16.0.0*
std::mdspan: 非擁有多維陣列引用 (FTM)* P0009R18
P2599R2
P2604R0
P2613R1
P2763R1
17 (部分)*
18
19.39* 15.0.0*
<flat_map> (FTM)* P0429R9 15 20
<flat_set> (FTM)* P1222R4 15
ranges::find_last(), ranges::find_last_if(), 和 ranges::find_last_if_not() (FTM)* P1223R5 13 19 19.36*
獨立庫:簡單的 <utility><ranges><iterator> P1642R11 13* 不適用
views::stride (FTM)* P1899R3 13 19.34*
std::tuple 和類 tuple 物件之間的相容性 (FTM)* P2165R4 14 2.9 (部分)* 19.36* (部分)*
19.37*
部分*
糾正常量迭代器、哨兵和範圍。views::as_const (FTM)* P2278R4 13 19.35* (部分)*
19.36*
格式化範圍 (FTM)* P2286R8 16 19.37*(部分)*
19.39*(部分)*
19.41*(部分)*
19.42*
15.0.0*
改進預設容器格式化 (FTM)* P2585R1 16 (部分)*
17
19.42* 15.0.0*
格式化輸出庫 <print> (FTM)* P2093R14
P2539R4
14 17 (部分)*
18
19.37* 15.0.0**
16.0.0*
格式化格式化 std::thread::idstd::stacktrace (FTM)* P2693R1 14 17 (部分)* 19.38* 15.0.0*
constexpr 用於 std::to_chars()std::from_chars() 的整數過載 (FTM)* P2291R3 13 16 19.34* 15.0.0*
ranges::contains()ranges::contains_subrange() (FTM)* P2302R4 13 19 19.34* 16.0.0**
範圍摺疊演算法 (FTM)* P2322R6 13 19.35*
views::cartesian_product (FTM)* P2374R4
P2540R1
13 19.37*
為比較概念 (equality_comparable, totally_ordered, three_way_comparable) 新增只移動型別支援 (FTM)* P2404R3 19.36*
將範圍迭代器作為非範圍演算法的輸入 (FTM)* P2408R5 19.34*
constexpr std::bitset (FTM)* P2417R2 13 16 19.34* 15.0.0*
basic_string::substr() && P2438R2 16 19.34* 15.0.0*
views::as_rvalue (FTM)* P2446R2 13 16 19.34* 15.0.0*
標準庫模組   (FTM)* P2465R3 15* 17 (部分)* 19.35*
(部分)*
19.36*
std::forward_like() (FTM)* P2445R1 14 16 19.34* 15.0.0*
支援 std::fstream 的獨佔模式 (FTM)* P2467R1 12 18 19.36* 16.0.0*
views::repeat (FTM)* P2474R2 13 17 19.36* 15.0.0*
放寬範圍介面卡以允許僅移動型別   (FTM)* P2494R2 14 17 19.34* 15.0.0*
std::basic_string_view 範圍 建構函式 應該顯式 P2499R0 12.2 16 19.34* 15.0.0*
std::generator: 用於範圍的同步協程生成器 (FTM)* P2502R2
P2787R0
14 19.43*
std::apply 新增條件 noexcept 規範 P2517R1 10 18 19.34* 16.0.0*
顯式生命週期管理 (std::start_lifetime_as) (FTM)* P2590R2
P2679R2
澄清 chrono 型別本地化格式化中編碼的處理 (FTM)* P2419R2 15* 19.34**
std::move_iterator 不應總是 input_iterator (FTM)* P2520R0 12.3* 17* 19.34** 15.0.0*
顯式物件引數呼叫運算子更新推導指南 LWG3617 14 19.34*
static operator() 更新推導指南 P1169R4 13 16 19.39* 15.0.0*
擴充套件浮點型別的標準名稱和庫支援 P1467R9 13 19.37**
std::expected 的單子操作 (FTM)* P2505R5 13 17 19.36* 15.0.0*
views::enumerate (FTM)* P2164R9 13 19.37*
std::is_implicit_lifetime (FTM)* P2674R1 20
std::common_reference_t of std::reference_wrapper 應為引用型別 (FTM)* (FTM)* P2655R3 19.37*
禁止使用者特化 std::allocator_traits P2652R2 19 19.37*
棄用 std::numeric_limits::has_denorm P2614R2 18 19.37* 16.0.0*
使 views 的多引數建構函式 explicit P2711R1 17 (部分)* 19.36** 15.0.0*
DR20:Ranges 只是一點點放鬆   (FTM)* P2609R3 15 20 19.37*
DR20:暫存暫存迭代器以進行正確扁平化 P2770R0 14 18 19.37*
DR17: 派生自 std::variant 的類的 std::visit() (FTM)* P2162R2 11.3 13 19.20**
19.30*
13.1.6*
DR20:條件借用範圍 P2017R1 11 16 19.30*
DR20:修復輸入範圍介面卡std::counted_iterator P2259R1 12 19.30*(部分)*
19.31*
DR20:views::join 應該連線所有檢視的範圍 P2328R1 11.2 15 19.30* 14.0.3*
DR20: view 不要求 default_initializable (FTM)* P2325R3 11.3 16 19.30* 15.0.0*
DR20: 範圍介面卡物件按值繫結引數 P2281R1 11 14 19.29 (16.10)*
(部分)*
19.31*
14.0.3*
DR20: std::optionalstd::variantconstexpr (FTM)* (FTM)* P2231R1 11.3 (部分)*
12
13 (部分)*
19
19.31* 13.1.6* (部分)
DR20: views::lazy_split 和重新設計的 views::split P2210R2 12 16 19.31* 15.0.0*
DR20: 修復 ranges::istream_view P2432R1 12 16 19.31* 15.0.0*
DR20: 具有所有權的 view (FTM)* P2415R2 12 14 19.31* 14.0.3*
DR20: 修復 chrono 格式化程式中的區域設定處理  (FTM)* P2372R3
P2418R2
13 19.31*
DR20: 清理整數類型別 P2393R1 19.32*
DR20: 編譯時格式字串檢查;減少 std::format() 族二進位制程式碼大小 (FTM)* P2216R3 13 14 (部分)*
15
19.32* 14.0.3*
DR20: 為 std::format 新增對非 const 可格式化型別的支援 P2418R2 13 15 19.32* 14.0.3*
DR20: std::basic_format_string P2508R1 13 15 19.35* 14.0.3*
DR20: “毒丸”毒性太強  (FTM)* P2602R2 14 19 19.36*
DR20: std::format 填充字元允許 P2572R1 14 17 19.37*
DR20: 改進 std::format 的寬度估算 P2675R1 14 17 19.38*
DR20: std::barrier 的階段完成保證 (FTM)* P2588R3 19.28 (16.8)**
19.36*
 

C++23 特性
 

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