C++23

{{Short description|Computer programming language}}

{{Update|date=March 2024}}

{{C++ language revisions}}

C++23, formally ISO/IEC 14882:2024,{{cite web|url=https://www.iso.org/standard/83626.html|title=ISO/IEC 14882:2024 Programming languages — C++|website=iso.org}} is the current open standard for the C++ programming language that follows C++20. The final draft of this version is N4950.{{Cite web|title=Working Draft, Standard for Programming Language C++|url=https://open-std.org/JTC1/SC22/WG21/docs/papers/2023/n4950.pdf|date=2023-05-10 |publisher=ISO/IEC |website=Open Standards |url-status=live |archive-url=https://web.archive.org/web/20240216145252/https://open-std.org/jtc1/sc22/wg21/docs/papers/2023/n4950.pdf |archive-date= Feb 16, 2024 }}{{cite web | url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/n4951.html |website=Open Standards | date=2023-05-10 | title=N4951 Editors' Report: Programming Languages - C++ | url-status=live | archive-url=https://web.archive.org/web/20230605040956/https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/n4951.html | archive-date=2023-06-05}}

In February 2020, at the final meeting for C++20 in Prague, an overall plan for C++23 was adopted:{{Cite web|url=http://open-std.org/JTC1/SC22/WG21/docs/papers/2019/n4817.pdf |website=Open Standards |title=N4817: 2020 Prague Meeting Invitation and Information|last=Dusíková|first=Hana|date=2019-11-06 |url-status=live|archive-url=https://web.archive.org/web/20191229102449/http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/n4817.pdf |archive-date=2019-12-29 |access-date=2020-02-13}}{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0592r4.html|title=To boldly suggest an overall plan for C++23|last=Voutilainen|first=Ville|date=2019-11-25|website=Open Standards|url-status=live|archive-url=https://web.archive.org/web/20191224230450/http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0592r4.html |archive-date=2019-12-24 |access-date=2020-02-13}} planned features for C++23 were library support for coroutines, a modular standard library, executors, and networking.

The first WG21 meeting focused on C++23 was intended to take place in Varna in early June 2020, but was cancelled due to the COVID-19 pandemic,{{Cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2145r0.html|title=P2145R0: Evolving C++ Remotely|website=Open Standards |date=2020-04-20 |first1=Bryce Adelstein |last1=Lelbach |first2=Titus |last2=Winters |first3=Fabio |last3=Fracassi |first4=Billy |last4=Baker |first5=Nevin |last5=Liber |first6=JF |last6=Bastien |first7=David |last7=Stone |first8=Botond |last8=Ballo |first9=Erich |last9=Keane |first10=Tom |last10=Honermann |url-status=live |archive-url=https://web.archive.org/web/20240212040242/https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2145r0.html |archive-date= Feb 12, 2024 }}{{Cite web|title=Business Plan and Convener's Report: ISO/IEC JTC1/SC22/WG21 (C++)|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/n4862.pdf|first=Herb|last=Sutter|author-link=Herb Sutter|date=29 July 2020}} as was the November 2020 meeting in New York{{Cite web|url=https://isocpp.org/std/meetings-and-participation/upcoming-meetings|title=Upcoming Meetings, Past Meetings : Standard C++|website=isocpp.org}} and the February 2021 meeting in Kona, Hawaii. All meetings until November 2022 were virtual while the November 2022 meeting until the final meeting in February 2023 was hybrid. The standard was technically finalized by WG21 at the hybrid meeting in Issaquah in February 2023.{{Cite web|url=https://herbsutter.com/2023/02/13/c23-pandemic-edition-is-complete-trip-report-winter-iso-c-standards-meeting-issaquah-wa-usa/|title=C++23 "Pandemic Edition" is complete (Trip report: Winter ISO C++ standards meeting, Issaquah, WA, USA)|website=herbsutter.com|date=13 February 2023 }}

Modern "Hello, world" Example

After many library changes applied to the working draft, the new "Hello, world" program will be: [https://en.cppreference.com/w/cpp/io/println]

import std;

int main() {

std::println("Hello, world!");

}

Features

Changes that have been accepted into C++23 include:

= Language =

  • explicit this object parameter{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0847r7.html|title=Deducing this|date=2021-07-12|author1=Gašper Ažman|author2=Sy Brand|author3=Ben Deane|author4=Barry Revzin

}}

  • if consteval{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1938r3.html|title=if consteval|date=2021-03-22|author1=Barry Revzin|author2=Richard Smith|author3=Andrew Sutton|author4=Daveed Vandevoorde}}
  • multidimensional subscript operator{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2128r6.pdf|title=Multidimensional subscript operator|date=2021-09-14|author1=Mark Hoemmen|author2=Daisy Hollman|author3=Corentin Jabot|author4=Isabella Muerte|author5=Christian Trott

}}

  • static call and subscript operators and static lambdas{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1169r4.html|title=static operator()|date=2022-04-08}}{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2589r1.pdf|title=static operator[]|date=2022-11-11}}
  • simplifying implicit move{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2266r3.html|title=Simpler implicit move|date=2022-03-23}}
  • auto(x) and auto{x}{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0849r8.html|title=auto(x): decay-copy in the language|date=2021-07-12|author=Zhihao Yuan

}}

  • new preprocessor directives:
  • #elifdef and #elifndef{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2334r1.pdf|title=Add support for preprocessing directives elifdef and elifndef|date=2021-04-30|author=Melanie Blower

}}

  • #warning{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2437r1.pdf|title=Support for #warning|date=2022-01-13|author=Aaron Ballman}}
  • extending the lifetime of some temporaries in range-based for loop{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2718r0.html|title=Wording for P2644R1 Fix for Range-based for Loop|date=2022-11-11}}
  • new standard attribute assume(expression){{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1774r8.pdf|title=Portable assumptions|date=2022-04-22}}
  • class template argument deduction from inherited constructors{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2582r1.pdf|title=Wording for class template argument deduction from inherited constructors|date=2022-05-20|author=Timur Doumler}}
  • labels at the end of the compound statement{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2324r2.pdf|title=Labels at the end of compound statements (C compatibility)|date=2022-01-13}}
  • alias declarations in init-statements{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2360r0.html|title=Extend init-statement to allow alias-declaration|date=2021-04-13|author=Jens Maurer

}}

  • literal suffixes for std::size_t and the corresponding signed type{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0330r8.html|title=Literal Suffix for (signed) size_t|author1=JeanHeyd Meneide|author2=Rein Halbersma|date=2019-11-24}}
  • extended floating-point types with literals (conditionally supported){{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1467r9.html|title=

Extended floating-point types and standard names|date=2022-04-22}}

  • optional () from nullary lambda expressions{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1102r2.html|title=P1102R2: Down with ()!|author=Alex Christensen|author2=JF Bastien|date=2020-12-11}}
  • attributes on lambda expressions{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2173r1.pdf|title=Attributes on Lambda-Expressions}}
  • constexpr changes:
  • non-literal variables, labels, and gotos in constexpr functions{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2242r3.html|title=Non-literal variables (and labels and gotos) in constexpr functions|date=2021-07-12|author=Ville Voutilainen

}}

  • allowing static and thread_local variables that are usable in constant expressions in constexpr functions{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2647r1.html|title=Permitting static constexpr variables in constexpr functions|date=2022-11-07}}
  • constexpr function does not need its return type and parameter types to be literal type
  • it is now possible to write a constexpr function for which no invocation satisfies the requirements of a core constant expression{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2448r2.html|title=Relaxing some constexpr restrictions|date=2022-01-27}}
  • narrowing contextual conversions to bool in static_assert and if constexpr{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1401r5.html|title=Narrowing contextual conversions to bool|date=2021-04-12|author=Andrzej Krzemieński}}
  • trimming whitespaces before line splicing{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2223r2.pdf|title=Trimming whitespaces before line splicing|date=2021-04-13|author=Corentin Jabot}}
  • make declaration order layout mandated{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1847r4.pdf|title=Make declaration order layout mandated|date=2021-04-02|author1=Pal Balog}}
  • delimited escape sequences{{cite web|url= https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2290r3.pdf|title=Delimited escape sequences |date=2022-02-25}}
  • named universal character escapes{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2071r2.html|title=Named universal character escapes|date=2022-03-25}}
  • text encoding changes:
  • support for UTF-8 as a portable source file encoding{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2295r6.pdf|title=Support for UTF-8 as a portable source file encoding|date=2022-07-01}}
  • consistent character literal encoding{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2316r2.pdf|title=Consistent character literal encoding|date=2021-09-14|author=Corentin Jabot

}}

  • character sets and encodings{{Cite web|url=https://isocpp.org/files/papers/P2314R4.html|title=Character sets and encodings|date=2021-09-21|author=Jens Maurer

}}

= Library =

== Standard Library Module Support ==

  • standard library modules std and std.compat{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2465r3.pdf|title=Standard Library Modules std and std.compat}}

== Coroutine Library Support ==

  • synchronous coroutine std::generator for ranges{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2502r2.pdf|title=(std::generator: Synchronous Coroutine Generator for Ranges)}}

== General Utilities Support ==

  • result type std::expected{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0323r12.html|title=std::expected|date=2022-01-07|author1=Vicente Botet|author2=JF Bastien|author3=Jonathan Wakely}}
  • monadic operations for std::optional{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0798r6.html|title=Monadic operations for std::optional|date=2021-04-27|author=Sy Brand

}} and std::expected{{Cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2505r5.html|title=P2505R5 Monadic Functions for std::expected|date=2022-09-28|author=Jeff Garland

}}

  • utility function std::to_underlying to get the underlying value of enum{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1682r3.html|title=std::to_underlying for enumerations|date=2021-01-22|author=JeanHeyd Meneide}}
  • move-only callable wrapper std::move_only_function{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0288r9.html|title=move_only_function|date=2021-07-09|author1=Matt Calabrese|author2=Ryan McDougall

}}

  • std::forward_like{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2445r1.pdf|title=std::forward_like|date=2022-05-13|author=Gašper Ažman}}
  • std::invoke_r{{cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2136r3.html|title=invoke_r|date=2020-04-29|author=Zhihao Yuan

}}

  • std::bind_back
  • std::byteswap{{Cite web|url=https://isocpp.org/files/papers/P1272R4.html|title=Byteswapping for fun&&nuf|date=2021-09-17|author1=Isabella Muerte|author2=Corentin Jabot

}}

  • std::unreachable: a function to mark unreachable code{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0627r6.pdf|title=Function to mark unreachable code|date=2021-10-15|author1=Melissa Mears|author2=Jens Maurer}}
  • made std::tuple compatible with other tuple-like objects{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2165r4.pdf|title=Compatibility between tuple, pair and tuple-like objects|date=2022-07-15|author=Corentin Jabot}}
  • std::basic_common_reference specialization for std::reference_wrapper yielding reference types{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2655r3.html|title=common_reference_t of reference_wrapper Should Be a Reference Type|date=2023-02-07|author1=Hui Xie|author2=S. Levent Yilmaz|author3=Tim Song}}
  • adding default arguments for std::pair's forwarding constructor{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2718r0.html|title=Wording for P2644R1 Fix for Range-based for Loop|date=2022-11-11}}

== Compile-time Support ==

  • constexpr support for:
  • std::type_info::operator=={{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1328r1.html|title=Making std::type_info::operator== constexpr|date=2021-05-01|author=Peter Dimov

}}

  • std::bitset{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2417r2.pdf|title=A more constexpr bitset|date=2022-06-25|author=Daniil Goncharov}}
  • std::unique_ptr{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2273r3.pdf|title=Making std::unique_ptr constexpr|date=2021-11-06|author=Andreas Fertig}}
  • for some functions{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0533r9.pdf|title=constexpr for and |date=2021-11-12|author1=Edward J. Rosten|author2=Oliver J. Rosten}}
  • for integral overloads of std::to_chars and std::from_chars{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2291r3.pdf|title=Add Constexpr Modifiers to Functions to_chars and from_chars for Integral Types in Header|date=2021-09-18|author1=Daniil Goncharov|author2=Alexander Karaev}}
  • metaprogramming utilities:
  • type traits std::is_scoped_enum,{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1048r1.pdf|title=A proposal for a type trait to detect scoped enumerations|date=2020-10-12|author=Juan Alday}} std::is_implicit_lifetime,{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2674r1.pdf|title=A trait for implicit lifetime types|date=2022-11-11|author1=Timur Doumler|author2=Vittorio Romeo}} std::reference_constructs_from_temporary, and std::reference_converts_from_temporary.{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2255r2.html|title=A type trait to detect reference binding to temporary|date=2021-10-13|author=Tim Song}}
  • adding move-only types support for comparison concepts{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2404r3.pdf|title=Move-only types for equality_comparable_with, totally_ordered_with, and three_way_comparable_with|date=2022-07-02|author=Justin Bassett}}

== Iterators, Ranges, and Algorithm Support ==

  • new range conversion function std::ranges::to{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1206r7.pdf|title=Conversions from ranges to containers|date=2022-01-21|author1=Corentin Jabot|author2=Eric Niebler|author3=Casey Carter}}
  • new constrained ranges algorithm:
  • std::ranges::starts_with
  • std::ranges::ends_with{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1659r3.html|title=starts_with and ends_with|date=2021-02-19|author=Christopher Di Bella

}}

  • std::ranges::contains
  • std::ranges::contains_subrange{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2302r4.html|title=std::ranges::contains|date=2021-04-16|author=Christopher Di Bella}}
  • std::ranges::find_last and other variants{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1223r5.pdf|title=find_last|date=2022-06-17|author=Zach Laine}}
  • rangified versions of iota, shift_left, and shift_right{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2440r1.html|title=ranges::iota, ranges::shift_left, and ranges::shift_right|date=2021-12-05|author=Tim Song}}
  • range fold algorithms{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2322r6.html|title=ranges::fold|date=2022-04-22|author=Barry Revzin}}
  • new std::ranges::range_adaptor_closure, a helper for defining user-defined range adaptor closures{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2387r3.html|title=Pipe support for user-defined range adaptors|date=2021-12-17|author=Barry Revzin}}
  • new range adaptors:
  • std::views::zip and other variants
  • std::views::adjacent and other variants{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2321r2.html|title=zip|date=2021-06-11|author=Tim Song

}}

  • std::views::join_with{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2441r2.html|title=views::join_with|date=2022-01-28|author=Barry Revzin}}
  • std::views::slide
  • std::views::chunk{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2442r1.html|title=Windowing range adaptors: views::chunk and views::slide|date=2021-12-05|author=Tim Song}}
  • std::views::chunk_by{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2443r1.html|title=views::chunk_by|date=2021-11-19|author=Tim Song}}
  • std::views::as_rvalue{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2446r2.html|title=views::as_rvalue|date=2022-02-14|author=Barry Revzin}}
  • std::views::as_const
  • std::views::repeat{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2474r2.html|title=views::repeat|date=2022-07-13|author=Michał Dominiak}}
  • std::views::stride{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1899r3.html|title=stride_view|date=2022-07-08|author1=Christopher Di Bella|author2=Tim Song}}
  • std::views::cartesian_product{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2374r4.html|title=views::cartesian_product|date=2022-07-13|author1=Sy Brand|author2=Michał Dominiak}}
  • std::views::enumerate{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2164r9.pdf|title=views::enumerate|date=2022-12-07|author=Corentin Jabot}}
  • rectifying constant iterators, sentinels, and ranges, that is, std::ranges::cbegin and other similar utilities returning constant iterators should be fully guaranteed even for shallow-const views (such as std::span){{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2278r4.html|title=cbegin should always return a constant iterator|date=2022-06-17|author=Barry Revzin}}
  • ranges iterators as inputs to non-ranges algorithms{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2408r5.html|title=Ranges iterators as inputs to non-Ranges algorithms|date=2022-04-22|author=David Olsen}}
  • relaxing range adaptors to allow for move only types{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2494r2.html|title=Relaxing range adaptors to allow for move only types|date=2022-07-13|author=Michał Dominiak}}
  • making multi-param constructors of some views explicit{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2711r1.html|title=Making multi-param constructors of views explicit|date=2022-11-12|author=Ville Voutilainen}}

== Memory Management Support ==

  • std::out_ptr and std::inout_ptr for C interoperability{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1132r7.html|title=out_ptr - a scalable output pointer abstraction|date=2021-04-15|author1=JeanHeyd Meneide|author2=Todor Buyukliev|author3=Isabella Muerte}}
  • std::allocate_at_least and std::allocator::allocate_at_least{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0401r6.html|title=Providing size feedback in the Allocator interface|date=2021-01-22|author1=Jonathan Wakely|author2=Chris Kennelly}}
  • explicit lifetime management function std::start_lifetime_as for implicit-lifetime types{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2590r2.pdf|title=Explicit lifetime management|date=2022-07-15|author1=Timur Doumler|author2=Richard Smith}}
  • disallowing user specialization of std::allocator_traits{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2652r2.html|title=Disallow User Specialization of allocator_traits|date=2023-02-08|author=Pablo Halpern}}

== String and Text Processing Support ==

  • new member functions and changes in string types:
  • std::basic_string_view::contains and std::basic_string::contains{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1679r3.html|author1=Wim Leflere|author2=Paul Fee|title=string contains function|date=2020-06-13}}
  • disabling construction from nullptr for std::basic_string and std::basic_string_view{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2166r1.html|title=A Proposal to Prohibit std::basic_string and std::basic_string_view construction from nullptr.|date=2020-09-06|author=Yuriy Chernyshov

}}

  • explicit range constructor for std::basic_string_view{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1989r2.pdf|title=Range constructor forstd::string_view 2: Constrain Harder|date=2021-03-17|author=Corentin Jabot

}}

  • std::basic_string::resize_and_overwrite{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1072r10.html|title=basic_string::resize_and_overwrite|date=2021-09-14|author1=Chris Kennelly|author2=Mark Zeren

}}

  • rvalue reference overload of std::basic_string::substr for efficient slicing{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2438r2.html|title=std::string::substr() &&}}
  • formatting ranges, tuples, escaped presentation of characters and strings, std::thread::id, and stacktraces.{{cite web|url = https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2286r8.html|title = Formatting Ranges| date=16 May 2022 }}{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2585r1.html|title=Improve default container formatting|date=2022-07-15|author=Barry Revzin}}{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2693r1.pdf|title=Formatting thread::id and stacktrace|date=2023-02-09|author1=Corentin Jabot|author2=Victor Zverovich}}

== Diagnostic Support ==

  • stacktrace library{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0881r7.html|author1=Alexey Gorgurov|author2=Antony Polukhin|title=A Proposal to add stacktrace library|date=2020-09-16}}

== I/O Support ==

  • formatted output functions std::print and std::println from new header {{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2093r14.html|title=Formatted output}}
  • spanstream library (std::span-based string stream) from new header {{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0448r4.pdf|title=A strstream replacement using span as buffer|date=2021-02-26|author=Peter Sommerlad}}
  • a support for exclusive mode in std::fstreams{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2467r1.html|title=Support exclusive mode for fstreams}}
  • std::basic_ostream::operator<<(const volatile void*){{Cite web|url=https://isocpp.org/files/papers/P1147R1.html|title=Printing volatile Pointers|date=2021-09-25|author=Bryce Adelstein Lelbach

}}

== Containers Support ==

  • multidimensional-span std::mdspan{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0009r18.html|title=MDSPAN|date=13 July 2022 }}{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2599r2.pdf|title=index_type & size_type in mdspan}}{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2604r0.html|title=mdspan: rename pointer and contiguous|date=15 June 2022 }}{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2613r1.html|title=Add the missing empty to mdspan}}
  • constructability and assignability of containers from other compatible ranges
  • flat set and flat map container adapters{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p0429r9.pdf|title=A Standard flat_map}}{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1222r4.pdf|title=A Standard flat_set}}
  • non-deduction context for allocators in container deduction guides{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1518r2.html|title=Stop overconstraining allocators in container deduction guides|date=2021-03-14|author1=Arthur O'Dwyer|author2=Mike Spertus}}
  • heterogeneous erasure overloads for associative containers{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2077r2.html|title=Heterogeneous erasure overloads for associative containers|date=2020-12-15|author1=Konstantin Boyarinov|author2=Sergey Vinogradov|author3=Ruslan Arutyunyan

}}

  • allowing iterator pair construction in stack and queue{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1425r4.pdf|title=Iterators pair constructors for stack and queue|date=2021-03-05|author=Corentin Jabot

}}

  • requiring std::span and std::basic_string_view to be trivially copyable{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2251r1.pdf|title=Require span & basic_string_view to be TriviallyCopyable|date=2021-03-19|author=Nevin Liber

}}

== C-Compatibility Support ==

  • new header {{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0943r6.html|title=P0943R6: Support C atomics in C++|author=Hans-J. Boehm|date=2020-10-23}}

= Language defect reports =

  • C++ identifier syntax using Unicode Standard Annex 31{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1949r7.html|title=C++ Identifier Syntax using Unicode Standard Annex 31|date=2021-04-12|author1=Steve Downey|author2=Zach Laine|author3=Tom Honermann|author4=Peter Bindels|author5=Jens Maurer}}
  • allowing duplicate attributes{{cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2156r1.pdf|title=Allow Duplicate Attributes|date=2020-07-02|author=Erich Keane}}
  • changing scope of lambda trailing return type{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2036r3.html|title=Change scope of lambda trailing-return-type|date=2021-09-14|author=Barry Revzin}}
  • making overloaded comparison operators less breaking change{{Cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2468r2.html|title=The Equality Operator You Are Looking For|date=2022-01-13}}
  • undeprecating volatile compound assignments{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2327r1.pdf|title=De-deprecating volatile compound operations}}{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2710r0.html#2654|title=Core Language Working Group NB comment resolutions for the November, 2022 meeting : 2654. Un-deprecation of compound volatile assignments}}
  • fixing the compatibility and portability of char8_t{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2513r3.html|title=char8_t Compatibility and Portability Fix|date=2022-06-17}}
  • relaxing requirements on wchar_t to match existing practices{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2460r2.pdf|title=Relax requirements on wchar_t to match existing practices|date=2022-07-15}}
  • allowing some pointers and references of this or unknown origin in constant expressions{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2280r4.html|title=Using unknown pointers and references in constant expressions|date=8 April 2022 }}
  • introduction of immediate-escalating functions promoted to immediate functions{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2564r3.html|title=consteval needs to propagate up|date=2022-11-11}}
  • allowing static_assert(false) in uninstantiated template contexts

= Library defect reports =

  • changes in ranges library:
  • conditionally borrowed ranges{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2017r1.html|title=Conditionally borrowed ranges|date=2020-02-19|author=Barry Revzin}}
  • repairing input range adaptors and std::counted_iterator{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2259r1.html|title=Repairing input range adaptors and counted_iterator|date=2021-01-12|author=Tim Song}}
  • relaxing the constraint on std::ranges::join_view{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2328r1.html|title=join_view should join all views of ranges|date=2021-05-06|author=Tim Song

}}

  • renamed std::ranges::split_view to std::ranges::lazy_split_view and new split_view{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2210r2.html|title=Superior String Splitting|date=2021-03-05|author=Barry Revzin

}}

  • removed std::default_initializable constraint from concept std::ranges::view{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2325r3.html|title=Views should not be required to be default constructible|date=2021-05-14|author=Barry Revzin

}}

  • view with ownership and new std::ranges::owning_view{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2415r1.html|title=What is a view?|date=2021-08-15|author1=Barry Revzin|author2=Tim Song

}}

  • fixed std::ranges::istream_view{{Cite web|url=https://isocpp.org/files/papers/P2432R1.pdf|title=Fix istream_view|date=2021-09-24|author=Nicolai Josuttis

}}

  • changes in text formatting library:
  • std::basic_format_string{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2508r1.html|title=Expose std::basic-format-string|date=2022-01-18|author=Barry Revzin}}
  • compile-time format string checks
  • reducing binary code size of std::format_to{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2216r3.html|title=std::format improvements|date=2021-02-05|author=Victor Zverovich

}}

  • fixing locale handling in chrono formatters{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2372r3.html|title=Fixing locale handling in chrono formatters|date=2021-09-11|author1=Victor Zverovich|author2=Corentin Jabot

}}

  • improving width estimation{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2675r1.pdf|title=format's width estimation is too approximate and not forward compatible|date=2022-12-02|author=Corentin Jabot}} and fill character allowances of std::format{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2572r1.html|title=std::format() fill character allowances|date=2023-02-08|author=Tom Honermann}}
  • use of forwarding references in format arguments to allow non-const-formattable types{{Cite web|url=https://isocpp.org/files/papers/P2418R2.html|title=Add support for std::generator-like types to std::format|date=2021-09-24|author=Victor Zverovich

}}

  • fully constexpr std::variant and std::optional{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2231r1.html|title=Missing constexpr in std::optional and std::variant|date=2021-02-11|author=Barry Revzin

}}

  • supporting types derived from std::variant in std::visit{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2162r2.html|title=Inheriting from std::variant|date=2020-10-30|author=Barry Revzin}}

= Removed features and deprecation =

Removed features:

  • Garbage Collection Support and (strict) Pointer Safety{{Cite web |title=std::pointer_safety - cppreference.com |url=https://en.cppreference.com/w/cpp/memory/gc/pointer_safety |access-date=2024-12-09 |website=en.cppreference.com}} (meaning only relaxed pointer safety is to be relied upon{{Cite web |title=[basic.stc.dynamic.safety] |url=https://timsong-cpp.github.io/cppwp/n4868/basic.stc.dynamic.safety#4 |access-date=2024-12-09 |website=timsong-cpp.github.io}}). This minimal garbage collection support (and pointer safety, needed for it), was added to C++11 but no compilers have ever supported it so the support was removed in C++23.{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2186r2.html|title=Removing Garbage Collection Support|date=2021-04-16|author1=JF Bastien|author2=Alisdair Meredith

    }} However, that doesn't mean many GC implementations haven't been used, and continue to be used with C++, such as Boehm GC (and it can also just be used for leak detection in leak detection, when in debug mode), and such GC is often implemented in C++, for other languages to use.

    • Mixed wide-string literal concatenation.{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2201r1.html|title=Mixed string literal concatenation|date=2021-04-12|author=Jens Maurer}}
    • Non-encodable wide character literals and multicharacter wide character literals.{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2362r3.pdf|title=Remove non-encodable wide character literals and multicharacter wide character literals}}

    Deprecated features:

    • std::aligned_storage and std::aligned_union{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1413r3.pdf|title=Deprecate std::aligned_storage and std::aligned_union|date=2021-11-22|author=CJ Johnson}}
    • std::numeric_limits::has_denorm{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2614r2.pdf|title=Deprecate numeric_limits::has_denorm|date=2022-11-08|author=Matthias Kretz}}

    Reverted deprecated features:

    • Use of comma operator in subscript expressions was no longer deprecated but the semantics has been changed to support overloadable n-adic operator[].
    • C headers (The corresponding <*.h> headers for compatibility with C)

Published as Technical Specifications

  • Concurrency TS v2{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/n4956.pdf|title=Programming Languages — Technical specification for C++ extensions for concurrency 2}}{{explain |reason=What does "Published as Technical Specifications" mean? |date=August 2024}}

Compiler support

  • Clang progressively added partial C++23 support from 2021 in version 13 through to version 18 in 2024, available through the option -std=c++23.{{cite web | url=https://clang.llvm.org/cxx_status.html#cxx23 | title=C++ Support in Clang }}
  • GCC added partial, experimental C++23 support in 2021 in version 11 through the option -std=c++2b or -std=c++23 It also has an option to enable GNU extensions in addition to the experimental C++23 support, -std=gnu++2b.{{cite web | url=https://gcc.gnu.org/projects/cxx-status.html | title=C++ Standards Support in GCC - GNU Project }}

History

In the absence of face-to-face WG21 meetings, the following changes were applied after several virtual WG21 meetings, where they were approved by straw polls.

The following were added after the virtual WG21 meeting of 9 November 2020, where they were approved by straw polls:{{Cite web|title=WG21 2020-11 Virtual Meeting: Minutes of Meeting|date=2020-11-19|first=Nina|last=Ranns|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/n4877.pdf}}

  • Literal suffixes for std::size_t and the corresponding signed type
  • A member function {{cpp|contains}} for {{cpp|std::basic_string}} and {{cpp|std::basic_string_view}}, to check whether or not the string contains a given substring or character
  • A stacktrace library ({{cpp|}}), based on Boost.Stacktrace
  • A type trait {{cpp|std::is_scoped_enum}}
  • The header {{cpp|}}, for interoperability with C atomics

After the virtual WG21 meeting of 22 February 2021, following features are added where they were approved by straw polls:{{Cite web|title=WG21 2021-02 Virtual Meeting: Minutes of Meeting|date=2021-02-22|first=Nina|last=Ranns|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/n4877.pdf}}

  • Removing unnecessary empty parameter list {{cpp|()}} from lambda expressions.
  • Repairing input range adaptors and {{cpp|counted_iterator}}.
  • Relax the requirements for {{cpp|time_point::clock}}.{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2212r2.html|title=Relax Requirements for time_point::clock|date=2020-10-22|author1=Alexey Dmitriev|author2=Howard Hinnant}}
  • {{cpp|std::visit}} for classes that are derived from {{cpp|std::variant}}.
  • {{Proper name|Locks lock lockables}}.{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2160r1.html|title=Locks lock lockables|date=2020-11-13|author=Tim Song}}
  • Conditionally borrowed ranges.
  • {{cpp|std::to_underlying}}.

After the summer 2021 ISO C++ standards plenary virtual meeting of June 2021, new features and defect reports were approved by straw polls:{{Cite web|title=WG21 2021-06 Virtual Meeting Minutes of Meeting|date=2021-06-07|first=Nina|last=Ranns|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/n4891.pdf}}

  • Consteval if ({{cpp|1=if consteval}}).
  • Narrowing contextual conversions to {{cpp|1=bool}}.
  • Allowing duplicate attributes.
  • {{cpp|std::span}}-based string-stream ({{cpp|}}).
  • {{cpp|std::out_ptr()}} and {{cpp|std::inout_ptr()}}.
  • constexpr for {{cpp|std::optional}}, {{cpp|std::variant}}, and {{cpp|1=std::type_info::operator==}}.
  • Iterators pair constructors for {{cpp|std::stack}} (stack) and {{cpp|std::queue}} (queue).
  • Few changes of the ranges library:
  • Generalized {{cpp|starts_with}} and {{cpp|ends_with}} for arbitrary ranges.
  • Renamed {{cpp|split_view}} to {{cpp|lazy_split_view}} and new {{cpp|split_view}}.
  • Relaxing the constraint on {{cpp|join_view}}.
  • Removing {{cpp|default_initializable}} constraint from concept {{cpp|view}}.
  • Range constructor for {{cpp|std::basic_string_view}}.
  • Prohibiting {{cpp|std::basic_string}} and {{cpp|std::basic_string_view}} construction from nullptr.
  • {{cpp|std::invoke_r}}.
  • Improvements on {{cpp|std::format}}.
  • Adding default arguments for {{cpp|std::pair}}'s forwarding constructor.

After the autumn 2021 ISO C++ standards plenary virtual meeting of October 2021, new features and defect reports were approved by straw polls:{{Cite web|title=WG21 2021-10 Virtual Meeting Minutes of Meeting|date=2021-10-04|first=Nina|last=Ranns|url=https://isocpp.org/files/papers/N4898.pdf}}

  • Non-literal variables, labels, and gotos in {{cpp|1=constexpr}} functions, but still ill-formed to evaluate them at compile-time.
  • Explicit this (computer programming) object parameter.
  • Changes on character sets and encodings.
  • New preprocessors: {{cpp|#elifdef}} and {{cpp|#elifndef}}. Both directives were added to C23 (C language update) and GCC 12.{{cite web |title=GCC 12 Adds Support For New #elifdef #elifndef Directives |url=https://www.phoronix.com/news/GCC-12-elifdef-elifndef |website=phoronix |archive-url=https://web.archive.org/web/20221227050002/https://www.phoronix.com/news/GCC-12-elifdef-elifndef |archive-date=December 27, 2022 |date=May 12, 2021 |url-status=live}}
  • Allowing alias declarations in init-statement.
  • Overloading multidimensional subscript operator (e.g. {{cpp|arr[1, 2]}}).
  • Decay copy in language: {{cpp|1=auto(x)}} or {{cpp|1=auto{{(}}x{{)}}}}.
  • Changes in text formatting library:
  • Fixing locale handling in chrono formatters.
  • Use of forwarding references in format arguments to allow {{cpp|std::generator}}-like types.
  • Addition of type alias {{cpp|std::pmr::stacktrace}} which is equivalent to {{cpp|std::basic_stacktrace}}.{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2301r1.html|title=Add a pmr alias for std::stacktrace|date=2021-06-14|author=Steve Downey

}}

  • Changes in ranges library:
  • Refined definition of a view.
  • Replacing function template {{cpp|std::ranges::istream_view}} with alias templates {{cpp|std::ranges::istream_view}}, {{cpp|std::ranges::wistream_view}}, and customization point object {{cpp|std::views::istream}}.
  • {{cpp|zip}} range adaptor family:
  • {{cpp|zip_view}}
  • {{cpp|zip_transform_view}}
  • {{cpp|adjacent_view}} (and {{cpp|std::views::pairwise}} being equivalent to {{cpp|std::views::adjacent<2>}})
  • {{cpp|adjacent_transform_view}} (and {{cpp|std::views::pairwise_transform}} being equivalent to {{cpp|std::views::adjacent_transform<2>}})
  • {{cpp|std::move_only_function}}.
  • Monadic operations for {{cpp|std::optional}}.
  • Member function template {{cpp|std::basic_string::resize_and_overwrite}}.
  • Printing volatile (computer programming) pointers ({{cpp|1=volatile T* }}).
  • {{cpp|std::byteswap}}.
  • Heterogeneous erasure overloads for associative containers.
  • Every specialization of {{cpp|std::span}} and {{cpp|std::basic_string_view}} is trivially copyable.
  • Adding conditional {{cpp|1=noexcept}} specifications to {{cpp|std::exchange}}.{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2401r0.html|title=Add a conditional noexcept specification to std::exchange|date=2021-06-28|author=Giuseppe D'Angelo

}}

  • Revamped specification and use of integer-class types.{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2393r1.html|title=Cleaning up integer-class types|date=2021-08-06|author=Tim Song

}}

  • Clarify C headers. "The headers are not useful in code that is only required to be valid C++. Therefore, the C headers should be provided by the C++ standard library as a fully-supported, not deprecated part, but they should also be discouraged for use in code that is not polyglot interoperability code. [..] This proposal makes the C headers no longer deprecated, so there is no formal threat of future removal. The effective discouragement to use the C headers in pure C++ code is now spelled out explicitly as normative discouragement."{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2340r1.html|title=Clarifying the status of the "C headers"|date=2021-06-11|author=Thomas Köppe

}}

After the virtual WG21 meeting of 7 February 2022, the following features are added where they were approved by straw polls:{{Cite web|title=WG21 2022-02 Virtual Meeting: Minutes of Meeting|date=2022-02-07|first=Nina|last=Ranns|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4907.pdf}}

  • Allowed attributes on the function call operator of a lambda
  • {{cpp|std::expected}}
  • {{cpp|constexpr}} for cmath and cstdlib
  • Function to mark unreachable code
  • {{cpp|ranges::to}}
  • A type trait to detect reference binding to temporary
  • Making {{cpp|std::unique_ptr}} {{cpp|constexpr}}
  • Pipe support for user-defined range adaptors
  • {{cpp|ranges::iota}}, {{cpp|ranges::shift_left}} and {{cpp|ranges::shift_right}}
  • {{cpp|views::join_with}}
  • Windowing range adaptors: {{cpp|views::chunk}} and {{cpp|views::slide}}
  • {{cpp|views::chunk_by}}

After the virtual WG21 meeting of 25 July 2022, the following features and defect reports are added where they were approved by straw polls:{{Cite web|title=WG21 2022-07 Virtual Meeting: Minutes of Meeting|date=2022-08-09|first=Nina|last=Ranns|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4916.pdf}}

  • Made rewriting equality in expressions less of a breaking change.
  • Reverted the deprecation of bitwise assignment to {{cpp|volatile}} variables.
  • Added the {{cpp|#warning}} preprocessor directive.
  • Removed non-encodable wide character literals and multicharacter wide character literals.
  • Allowed labels to appear at the end of compound statements.
  • Added escape sequences delimited with curly braces for octal and hexadecimal numbers and universal character names.
  • Allowed {{cpp|constexpr}} functions to never be constant expressions.
  • Simplified some implicit move rules from C++20 and allowed implicit move when returning an rvalue reference.
  • Add a way to specify unicode characters by name. For example, {{cpp|U'\N{LATIN CAPITAL LETTER A WITH MACRON}' // Equivalent to U'\u0100'}}
  • Allowed operators in C and C++ and lambdas to be static (keyword).
  • Allowed the this pointer and references of unknown origin to appear in constant expressions.
  • Allowed implementations to define extended floating-point types in addition to the three standard floating-point types. Added the type aliases std::float16_t, std::float32_t, std::float64_t, std::float128_t, std::bfloat16_t for these extended types accessible through the header , their corresponding literal suffixes f16 f32 f64 f128 bf16or F16 F32 F64 F128 BF16 and added overloads to various standard library functions that take floats as arguments.
  • Added the {{cpp|assume(expression)}} attribute which allows the compiler to assume the provided expression is true to allow optimizations.
  • Made support for UTF-8 source files mandatory, providing a portable encoding for source files.
  • Allowed arrays of {{cpp|char}} and {{cpp|unsigned char}} to be initialized with UTF-8 string literals.
  • Removed the requirement that wchar_t can encode all characters of the extended character set, in effect allowing UTF-16 to be used for wide string literals.
  • Added std::mdspan, a multidimensional array view analogous to std::span.
  • {{cpp|flat_map}} and {{cpp|flat_set}} were added to the standard library.
  • Added the {{cpp|std::print}} and {{cpp|std::println}} functions for printing formatted text to stdout.
  • Provide the named modules {{cpp|std}} and {{cpp|std.compat}} for importing the standard library.
  • Added support for exclusive mode fstreams, analogous to the "x" flag in fopen.
  • Allowed std::format to handle ranges, tuples, and other containers.
  • Added std::forward_like.
  • Made std::string::substr use move semantics.
  • Added {{cpp|std::generator}} which implements a coroutine generator that models {{cpp|std::ranges::input_range}}
  • {{cpp|views::cartesian_product}}, {{cpp|views::repeat}}, {{cpp|views::stride}}, {{cpp|views::as_const}}, {{cpp|views::as_rvalue}}.
  • Added new algorithms: {{cpp|ranges::find_last}}, {{cpp|ranges::contains}}, and ranges fold algorithms.
  • Made std::tuple compatible with other tuple-like objects.
  • Explicit lifetime management for implicit-lifetime types.
  • Made std::bitset and integral overloads of std::to_chars and std::from_chars {{cpp|constexpr}}-compatible.
  • Adding move-only types support for comparison concepts.
  • Ranges iterators as inputs to non-ranges algorithms.
  • Relaxing range adaptors to allow for move-only types.

After the hybrid WG21 meeting of 7 November 2022, the following features and defect reports are added where they were approved by straw polls:{{Cite web|title=WG21 2022-11 Hybrid Meeting: Minutes of Meeting|date=2022-12-05|first=Nina|last=Ranns|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/n4933.pdf}}

  • Allowed {{cpp|operator[]}} to be {{cpp|1=static}}.
  • Allowed {{cpp|1=static}} and thread-local storage variables to appear in {{cpp|1=constexpr}} functions if they are usable in constant expressions.
  • consteval propagates upwards, that is, certain existing {{cpp|constexpr}} functions become {{cpp|consteval}} functions when those functions can already only be invoked during compile time.
  • Extended the lifetime of temporaries that appear in the for-range-initializer of a range-based {{cpp|for}} loop to cover the entire loop.
  • Reverted the deprecation of (all, not just bitwise) compound assignment to {{cpp|volatile}} variables.
  • Monadic functions for {{cpp|std::expected}}.
  • Synchronize the output of {{cpp|std::print}} with the underlying stream if the native Unicode API is used.{{Cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2539r4.html|title=Should the output of std::print to a terminal be synchronized with the underlying stream?|date=2022-11-08|author=Victor Zverovich}}

After the final hybrid WG21 meeting of 6-11 February 2023, the following features and defect reports are added where they were approved by straw polls:{{Cite web|title=WG21 2023-02 Hybrid Meeting: Minutes of Meeting|date=2023-03-06|first=Nina|last=Ranns|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/n4943.pdf}}

  • Referencing the Unicode Standard.{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2736r2.pdf|title=Referencing The Unicode Standard|date=2023-02-09|author=Corentin Jabot}}
  • Stashing stashing iterators for proper flattening.{{cite web|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2770r0.html|title=Stashing stashing iterators for proper flattening|date=2023-01-31|author1=Tim Song}}
  • views::enumerate
  • making multi-param constructors of views explicit
  • relaxing ranges just a smidge
  • escaping improvements in std::format
  • improving std::format's width estimation
  • std::format fill character allowances
  • formatting thread::id and stacktrace
  • A type trait std::is_implicit_lifetime
  • std::common_reference_t of std::reference_wrapper should be a reference type
  • disallowing user specialization of std::allocator_traits
  • std::pmr::generator
  • deprecating std::numeric_limits::has_denorm
  • std::barrier's phase completion guarantees

References