In February 2020, at the final meeting for C++20 in Prague, an overall plan for C++23 was adopted:[4][5] 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,[6][7] as was the November 2020 meeting in New York[8][7] and the February 2021 meeting in Kona, Hawaii.[8] All meetings until November 2022 were virtual while the November 2022 meeting until the final meeting in February 2023 was hybrid.[8] The standard was technically finalized by WG21 at the hybrid meeting in Issaquah in February 2023.[9]
Modern "Hello, world" Example
After many library changes applied to the working draft, the new "Hello, world" program will be: [1]
for integral overloads of std::to_chars and std::from_chars[59]
metaprogramming utilities:
type traits std::is_scoped_enum,[60]std::is_implicit_lifetime,[61]std::reference_constructs_from_temporary, and std::reference_converts_from_temporary.[62]
adding move-only types support for comparison concepts[63]
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)[75]
ranges iterators as inputs to non-ranges algorithms[80]
relaxing range adaptors to allow for move only types[81]
making multi-param constructors of some views explicit[82]
Memory Management Support
std::out_ptr and std::inout_ptr for C interoperability[83]
std::allocate_at_least and std::allocator::allocate_at_least[84]
explicit lifetime management function std::start_lifetime_as for implicit-lifetime types[85]
disallowing user specialization of std::allocator_traits[86]
String and Text Processing Support
new member functions and changes in string types:
std::basic_string_view::contains and std::basic_string::contains[87]
disabling construction from nullptr for std::basic_string and std::basic_string_view[88]
explicit range constructor for std::basic_string_view[89]
improving width estimation[131] and fill character allowances of std::format[132]
use of forwarding references in format arguments to allow non-const-formattable types[133]
fully constexprstd::variant and std::optional[134]
supporting types derived from std::variant in std::visit[135]
Removed features and deprecation
Removed features:
Garbage Collection Support and (strict) Pointer Safety[136] (meaning only relaxed pointer safety is to be relied upon[137]). 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.[138] 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.
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.[144]
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.[145]
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.
November 2020
The following were added after the virtual WG21 meeting of 9 November 2020, where they were approved by straw polls:[146]
Literal suffixes for std::size_t and the corresponding signed type
A member function contains for std::basic_string and std::basic_string_view, to check whether or not the string contains a given substring or character
A stacktrace library (<stacktrace>), based on Boost.Stacktrace
A type trait std::is_scoped_enum
The header <stdatomic.h>, for interoperability with C atomics
February 2021
After the virtual WG21 meeting of 22 February 2021, following features are added where they were approved by straw polls:[147]
Use of forwarding references in format arguments to allow std::generator-like types.
Addition of type alias std::pmr::stacktrace which is equivalent to std::basic_stacktrace<std::pmr::polymorphic_allocator>.[153]
Changes in ranges library:
Refined definition of a view.
Replacing function template std::ranges::istream_view with alias templates std::ranges::istream_view, std::ranges::wistream_view, and customization point object std::views::istream.
zip range adaptor family:
zip_view
zip_transform_view
adjacent_view (and std::views::pairwise being equivalent to std::views::adjacent<2>)
adjacent_transform_view (and std::views::pairwise_transform being equivalent to std::views::adjacent_transform<2>)
Heterogeneous erasure overloads for associative containers.
Every specialization of std::span and std::basic_string_view is trivially copyable.
Adding conditional noexcept specifications to std::exchange.[154]
Revamped specification and use of integer-class types.[155]
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."[156]
February 2022
After the virtual WG21 meeting of 7 February 2022, the following features are added where they were approved by straw polls:[157]
Allowed attributes on the function call operator of a lambda
Allowed the thispointer 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 <stdfloat>, their corresponding literal suffixes f16f32f64f128bf16or F16F32F64F128BF16 and added overloads to various standard library functions that take floats as arguments.
Added the [[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 char and unsignedchar 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.
flat_map and flat_set were added to the standard library.
Added the std::print and std::println functions for printing formatted text to stdout.
Provide the named modules std and 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 new algorithms: ranges::find_last, 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_charsconstexpr-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.
November 2022
After the hybrid WG21 meeting of 7 November 2022, the following features and defect reports are added where they were approved by straw polls:[159]
Allowed operator[] to be static.
Allowed static and thread_local variables to appear in constexpr functions if they are usable in constant expressions.
consteval propagates upwards, that is, certain existing constexpr functions become 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 for loop to cover the entire loop.
Reverted the deprecation of (all, not just bitwise) compound assignment to volatile variables.
Synchronize the output of std::print with the underlying stream if the native Unicode API is used.[160]
February 2023
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:[161]
^Lelbach, Bryce Adelstein; Winters, Titus; Fracassi, Fabio; Baker, Billy; Liber, Nevin; Bastien, JF; Stone, David; Ballo, Botond; Keane, Erich; Honermann, Tom (2020-04-20). "P2145R0: Evolving C++ Remotely". Open Standards. Archived from the original on Feb 12, 2024.