C++23
![]() | This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
|
C++ language revisions |
---|
C++23 is the name for the version of the International Organization for Standardization (ISO) and International Electrotechnical Commission (IEC) 14882 standard for the C++ programming language that follows C++20. The final draft of this version is N4950.[1][2]
In February 2020, at the final meeting for C++20 in Prague, an overall plan for C++23 was adopted:[3][4] 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,[5][6] as was the November 2020 meeting in New York[7][6] and the February 2021 meeting in Kona, Hawaii.[7] All meetings until November 2022 were virtual while the November 2022 meeting until the final meeting in February 2023 was hybrid.[7] The standard was technically finalized by WG21 at the hybrid meeting in Issaquah in February 2023.[8]
Modern "Hello, world" Example
After many library changes applied to the working draft, the new "Hello, world" program will be: [1]
<syntaxhighlight lang="cpp">
- include <print>
int main() {
std::println("Hello, world!");
} </syntaxhighlight>
Features
Changes that have been accepted into C++23 include:
Language
- explicit
this
object parameter[9] if consteval
[10]- multidimensional subscript operator[11]
- static call and subscript operators and static lambdas[12][13]
- simplifying implicit move[14]
auto(x)
andauto{x}
[15]- new preprocessor directives:
- extending the lifetime of some temporaries in range-based for loop[18]
- new standard attribute
[[assume(expression)]]
[19] - class template argument deduction from inherited constructors[20]
- labels at the end of the compound statement[21]
- alias declarations in init-statements[22]
- literal suffixes for
std::size_t
and the corresponding signed type[23] - extended floating-point types with literals (conditionally supported)[24]
- optional
()
from nullary lambda expressions[25] - attributes on lambda expressions[26]
constexpr
changes:- non-literal variables, labels, and
goto
s inconstexpr
functions[27] - allowing
static
andthread_local
variables that are usable in constant expressions inconstexpr
functions[28] 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[29]
- non-literal variables, labels, and
- narrowing contextual conversions to
bool
instatic_assert
andif constexpr
[30] - trimming whitespaces before line splicing[31]
- make declaration order layout mandated[32]
- delimited escape sequences[33]
- named universal character escapes[34]
- text encoding changes:
Library
Standard Library Module Support
- standard library modules
std
andstd.compat
[38]
Coroutine Library Support
- synchronous coroutine
std::generator
for ranges[39]
General Utilities Support
- result type
std::expected
[40] - monadic operations for
std::optional
[41] andstd::expected
[42] - utility function
std::to_underlying
to get the underlying value of enum[43] - move-only callable wrapper
std::move_only_function
[44] std::forward_like
[45]std::invoke_r
[46]std::bind_back
[47]std::byteswap
[48]std::unreachable
: a function to mark unreachable code[49]- made
std::tuple
compatible with other tuple-like objects[50] std::basic_common_reference
specialization forstd::reference_wrapper
yielding reference types[51]- adding default arguments for
std::pair
's forwarding constructor[52]
Compile-time Support
constexpr
support for:- metaprogramming utilities:
- adding move-only types support for comparison concepts[61]
Iterators, Ranges, and Algorithm Support
- new range conversion function
std::ranges::to
[62] - new constrained ranges algorithm:
- new
std::ranges::range_adaptor_closure
, a helper for defining user-defined range adaptor closures[47] - new range adaptors:
std::views::zip
and other variantsstd::views::adjacent
and other variants[68]std::views::join_with
[69]std::views::slide
std::views::chunk
[70]std::views::chunk_by
[71]std::views::as_rvalue
[72]std::views::as_const
[73]std::views::repeat
[74]std::views::stride
[75]std::views::cartesian_product
[76]std::views::enumerate
[77]
- 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 asstd::span
)[73] - ranges iterators as inputs to non-ranges algorithms[78]
- relaxing range adaptors to allow for move only types[79]
- making multi-param constructors of some views
explicit
[80]
Memory Management Support
std::out_ptr
andstd::inout_ptr
for C interoperability[81]std::allocate_at_least
andstd::allocator::allocate_at_least
[82]- explicit lifetime management function
std::start_lifetime_as
for implicit-lifetime types[83] - disallowing user specialization of
std::allocator_traits
[84]
String and Text Processing Support
- new member functions and changes in string types:
std::basic_string_view::contains
andstd::basic_string::contains
[85]- disabling construction from
nullptr
forstd::basic_string
andstd::basic_string_view
[86] - explicit range constructor for
std::basic_string_view
[87] std::basic_string::resize_and_overwrite
[88]- rvalue reference overload of
std::basic_string::substr
for efficient slicing[89]
- formatting ranges, tuples, escaped presentation of characters and strings,
std::thread::id
, and stacktraces.[90][91][92]
Diagnostic Support
- stacktrace library[93]
I/O Support
- formatted output functions
std::print
andstd::println
from new header<print>
[94] - spanstream library (
std::span
-based string stream) from new header<spanstream>
[95] - a support for exclusive mode in
std::fstream
s[96] std::basic_ostream::operator<<(const volatile void*)
[97]
Containers Support
- multidimensional-span
std::mdspan
[98][99][100][101] - constructability and assignability of containers from other compatible ranges[62]
- flat set and flat map container adapters[102][103]
- non-deduction context for allocators in container deduction guides[104]
- heterogeneous erasure overloads for associative containers[105]
- allowing iterator pair construction in stack and queue[106]
- requiring
std::span
andstd::basic_string_view
to be trivially copyable[107]
C-Compatibility Support
- new header
<stdatomic.h>
[108]
Language defect reports
- C++ identifier syntax using Unicode Standard Annex 31[109]
- allowing duplicate attributes[110]
- changing scope of lambda trailing return type[111]
- making overloaded comparison operators less breaking change[112]
- undeprecating volatile compound assignments[113][114]
- fixing the compatibility and portability of
char8_t
[115] - relaxing requirements on
wchar_t
to match existing practices[116] - allowing some pointers and references of
this
or unknown origin in constant expressions[117] - introduction of immediate-escalating functions promoted to immediate functions[118]
- allowing
static_assert(false)
in uninstantiated template contexts
Library defect reports
- changes in ranges library:
- conditionally borrowed ranges[119]
- repairing input range adaptors and
std::counted_iterator
[120] - relaxing the constraint on
std::ranges::join_view
[121] - renamed
std::ranges::split_view
tostd::ranges::lazy_split_view
and newsplit_view
[122] - removed
std::default_initializable
constraint from conceptstd::ranges::view
[123] - view with ownership and new
std::ranges::owning_view
[124] - fixed
std::ranges::istream_view
[125]
- changes in text formatting library:
std::basic_format_string
[126]- compile-time format string checks
- reducing binary code size of
std::format_to
[127] - fixing locale handling in chrono formatters[128]
- improving width estimation[129] and fill character allowances of
std::format
[130] - use of forwarding references in format arguments to allow non-const-formattable types[131]
- fully
constexpr
std::variant
andstd::optional
[132] - supporting types derived from
std::variant
instd::visit
[133]
Removed features and deprecation
Removed features:
- Garbage Collection Support and Reachability-Based Leak Detection. It was added to the standard since C++11 but no compilers support this feature until C++23.[134]
- Mixed wide string literal concatenation.[135]
- Non-encodable wide character literals and multicharacter wide character literals.[136]
Deprecated features:
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[139][further explanation needed]
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
. [140] - 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
. [141]
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:[142]
- Literal suffixes for
std::size_t
and the corresponding signed type - A member function <syntaxhighlight lang="cpp" inline="1">contains</syntaxhighlight> for <syntaxhighlight lang="cpp" inline="1">std::basic_string</syntaxhighlight> and <syntaxhighlight lang="cpp" inline="1">std::basic_string_view</syntaxhighlight>, to check whether or not the string contains a given substring or character
- A stacktrace library (<syntaxhighlight lang="cpp" inline="1"><stacktrace></syntaxhighlight>), based on Boost.Stacktrace
- A type trait <syntaxhighlight lang="cpp" inline="1">std::is_scoped_enum</syntaxhighlight>
- The header <syntaxhighlight lang="cpp" inline="1"><stdatomic.h></syntaxhighlight>, 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:[143]
- Removing unnecessary empty parameter list <syntaxhighlight lang="cpp" inline="1">()</syntaxhighlight> from lambda expressions.
- Repairing input range adaptors and <syntaxhighlight lang="cpp" inline="1">counted_iterator</syntaxhighlight>.
- Relax the requirements for <syntaxhighlight lang="cpp" inline="1">time_point::clock</syntaxhighlight>.[144]
- <syntaxhighlight lang="cpp" inline="1">std::visit</syntaxhighlight> for classes that are derived from <syntaxhighlight lang="cpp" inline="1">std::variant</syntaxhighlight>.
- Locks lock lockables.[145]
- Conditionally borrowed ranges.
- <syntaxhighlight lang="cpp" inline="1">std::to_underlying</syntaxhighlight>.
After the summer 2021 ISO C++ standards plenary virtual meeting of June 2021, new features and defect reports were approved by straw polls:[146]
- Consteval if (<syntaxhighlight lang="cpp" inline="1">if consteval</syntaxhighlight>).
- Narrowing contextual conversions to <syntaxhighlight lang="cpp" inline="1">bool</syntaxhighlight>.
- Allowing duplicate attributes.
- <syntaxhighlight lang="cpp" inline="1">std::span</syntaxhighlight>-based string-stream (<syntaxhighlight lang="cpp" inline="1"><spanstream></syntaxhighlight>).
- <syntaxhighlight lang="cpp" inline="1">std::out_ptr()</syntaxhighlight> and <syntaxhighlight lang="cpp" inline="1">std::inout_ptr()</syntaxhighlight>.
- <syntaxhighlight lang="cpp" class="" style="" inline="1">constexpr</syntaxhighlight> for <syntaxhighlight lang="cpp" inline="1">std::optional</syntaxhighlight>, <syntaxhighlight lang="cpp" inline="1">std::variant</syntaxhighlight>, and <syntaxhighlight lang="cpp" inline="1">std::type_info::operator==</syntaxhighlight>.
- Iterators pair constructors for <syntaxhighlight lang="cpp" inline="1">std::stack</syntaxhighlight> (stack) and <syntaxhighlight lang="cpp" inline="1">std::queue</syntaxhighlight> (queue).
- Few changes of the ranges library:
- Generalized <syntaxhighlight lang="cpp" inline="1">starts_with</syntaxhighlight> and <syntaxhighlight lang="cpp" inline="1">ends_with</syntaxhighlight> for arbitrary ranges.
- Renamed <syntaxhighlight lang="cpp" inline="1">split_view</syntaxhighlight> to <syntaxhighlight lang="cpp" inline="1">lazy_split_view</syntaxhighlight> and new <syntaxhighlight lang="cpp" inline="1">split_view</syntaxhighlight>.
- Relaxing the constraint on <syntaxhighlight lang="cpp" inline="1">join_view</syntaxhighlight>.
- Removing <syntaxhighlight lang="cpp" inline="1">default_initializable</syntaxhighlight> constraint from concept <syntaxhighlight lang="cpp" inline="1">view</syntaxhighlight>.
- Range constructor for <syntaxhighlight lang="cpp" inline="1">std::basic_string_view</syntaxhighlight>.
- Prohibiting <syntaxhighlight lang="cpp" inline="1">std::basic_string</syntaxhighlight> and <syntaxhighlight lang="cpp" inline="1">std::basic_string_view</syntaxhighlight> construction from <syntaxhighlight lang="cpp" class="" style="" inline="1">nullptr</syntaxhighlight>.
- <syntaxhighlight lang="cpp" inline="1">std::invoke_r</syntaxhighlight>.
- Improvements on <syntaxhighlight lang="cpp" inline="1">std::format</syntaxhighlight>.
- Adding default arguments for <syntaxhighlight lang="cpp" inline="1">std::pair</syntaxhighlight>'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:[147]
- Non-literal variables, labels, and gotos in <syntaxhighlight lang="cpp" inline="1">constexpr</syntaxhighlight> functions, but still ill-formed to evaluate them at compile-time.
- Explicit <syntaxhighlight lang="cpp" class="" style="" inline="1">this</syntaxhighlight> object parameter.
- Changes on character sets and encodings.
- New preprocessors: <syntaxhighlight lang="cpp" inline="1">#elifdef</syntaxhighlight> and <syntaxhighlight lang="cpp" inline="1">#elifndef</syntaxhighlight>. Both directives were added to C23 (C language update) and GCC 12.[148]
- Allowing alias declarations in init-statement.
- Overloading multidimensional subscript operator (e.g. <syntaxhighlight lang="cpp" inline="1">arr[1, 2]</syntaxhighlight>).
- Decay copy in language: <syntaxhighlight lang="cpp" inline="1">auto(x)</syntaxhighlight> or <syntaxhighlight lang="cpp" inline="1">auto{x}</syntaxhighlight>.
- Changes in text formatting library:
- Fixing locale handling in chrono formatters.
- Use of forwarding references in format arguments to allow <syntaxhighlight lang="cpp" inline="1">std::generator</syntaxhighlight>-like types.
- Addition of type alias <syntaxhighlight lang="cpp" inline="1">std::pmr::stacktrace</syntaxhighlight> which is equivalent to <syntaxhighlight lang="cpp" inline="1">std::basic_stacktrace<std::pmr::polymorphic_allocator></syntaxhighlight>.[149]
- Changes in ranges library:
- Refined definition of a view.
- Replacing function template <syntaxhighlight lang="cpp" inline="1">std::ranges::istream_view</syntaxhighlight> with alias templates <syntaxhighlight lang="cpp" inline="1">std::ranges::istream_view</syntaxhighlight>, <syntaxhighlight lang="cpp" inline="1">std::ranges::wistream_view</syntaxhighlight>, and customization point object <syntaxhighlight lang="cpp" inline="1">std::views::istream</syntaxhighlight>.
- <syntaxhighlight lang="cpp" inline="1">zip</syntaxhighlight> range adaptor family:
- <syntaxhighlight lang="cpp" inline="1">zip_view</syntaxhighlight>
- <syntaxhighlight lang="cpp" inline="1">zip_transform_view</syntaxhighlight>
- <syntaxhighlight lang="cpp" inline="1">adjacent_view</syntaxhighlight> (and <syntaxhighlight lang="cpp" inline="1">std::views::pairwise</syntaxhighlight> being equivalent to <syntaxhighlight lang="cpp" inline="1">std::views::adjacent<2></syntaxhighlight>)
- <syntaxhighlight lang="cpp" inline="1">adjacent_transform_view</syntaxhighlight> (and <syntaxhighlight lang="cpp" inline="1">std::views::pairwise_transform</syntaxhighlight> being equivalent to <syntaxhighlight lang="cpp" inline="1">std::views::adjacent_transform<2></syntaxhighlight>)
- <syntaxhighlight lang="cpp" inline="1">std::move_only_function</syntaxhighlight>.
- Monadic operations for <syntaxhighlight lang="cpp" inline="1">std::optional</syntaxhighlight>.
- Member function template <syntaxhighlight lang="cpp" inline="1">std::basic_string::resize_and_overwrite</syntaxhighlight>.
- Printing <syntaxhighlight lang="cpp" class="" style="" inline="1">volatile</syntaxhighlight> pointers (<syntaxhighlight lang="cpp" inline="1">volatile T*</syntaxhighlight>).
- <syntaxhighlight lang="cpp" inline="1">std::byteswap</syntaxhighlight>.
- Heterogeneous erasure overloads for associative containers.
- Every specialization of <syntaxhighlight lang="cpp" inline="1">std::span</syntaxhighlight> and <syntaxhighlight lang="cpp" inline="1">std::basic_string_view</syntaxhighlight> is trivially copyable.
- Adding conditional <syntaxhighlight lang="cpp" inline="1">noexcept</syntaxhighlight> specifications to <syntaxhighlight lang="cpp" inline="1">std::exchange</syntaxhighlight>.[150]
- Revamped specification and use of integer-class types.[151]
- 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."[152]
After the virtual WG21 meeting of 7 February 2022, the following features are added where they were approved by straw polls:[153]
- Allowed attributes on the function call operator of a lambda
- <syntaxhighlight lang="cpp" inline="1">std::expected</syntaxhighlight>
- <syntaxhighlight lang="cpp" inline="1">constexpr</syntaxhighlight> for
cmath
andcstdlib
- Function to mark unreachable code
- <syntaxhighlight lang="cpp" inline="1">ranges::to</syntaxhighlight>
- A type trait to detect reference binding to temporary
- Making <syntaxhighlight lang="cpp" inline="1">std::unique_ptr</syntaxhighlight> <syntaxhighlight lang="cpp" inline="1">constexpr</syntaxhighlight>
- Pipe support for user-defined range adaptors
- <syntaxhighlight lang="cpp" inline="1">ranges::iota</syntaxhighlight>, <syntaxhighlight lang="cpp" inline="1">ranges::shift_left</syntaxhighlight> and <syntaxhighlight lang="cpp" inline="1">ranges::shift_right</syntaxhighlight>
- <syntaxhighlight lang="cpp" inline="1">views::join_with</syntaxhighlight>
- Windowing range adaptors: <syntaxhighlight lang="cpp" inline="1">views::chunk</syntaxhighlight> and <syntaxhighlight lang="cpp" inline="1">views::slide</syntaxhighlight>
- <syntaxhighlight lang="cpp" inline="1">views::chunk_by</syntaxhighlight>
After the virtual WG21 meeting of 25 July 2022, the following features and defect reports are added where they were approved by straw polls:[154]
- Made rewriting equality in expressions less of a breaking change.
- Reverted the deprecation of bitwise assignment to <syntaxhighlight lang="cpp" inline="1">volatile</syntaxhighlight> variables.
- Added the <syntaxhighlight lang="cpp" inline="1">#warning</syntaxhighlight> 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 <syntaxhighlight lang="cpp" inline="1">constexpr</syntaxhighlight> 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, <syntaxhighlight lang="cpp" inline="1">U'\N{LATIN CAPITAL LETTER A WITH MACRON}' // Equivalent to U'\u0100'</syntaxhighlight>
- Allowed <syntaxhighlight lang="cpp" class="" style="" inline="1">operator()</syntaxhighlight> and lambdas to be <syntaxhighlight lang="cpp" class="" style="" inline="1">static</syntaxhighlight>.
- 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<stdfloat>
, their corresponding literal suffixesf16
f32
f64
f128
bf16
orF16
F32
F64
F128
BF16
and added overloads to various standard library functions that take floats as arguments. - Added the <syntaxhighlight lang="cpp" inline="1">assume(expression)</syntaxhighlight> 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 <syntaxhighlight lang="cpp" inline="1">char</syntaxhighlight> and <syntaxhighlight lang="cpp" inline="1">unsigned char</syntaxhighlight> to be initialized with UTF-8 string literals.
- Removed the requirement that <syntaxhighlight lang="cpp" class="" style="" inline="1">wchar_t</syntaxhighlight> 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 tostd::span
. - <syntaxhighlight lang="cpp" inline="1">flat_map</syntaxhighlight> and <syntaxhighlight lang="cpp" inline="1">flat_set</syntaxhighlight> were added to the standard library.
- Added the <syntaxhighlight lang="cpp" inline="1">std::print</syntaxhighlight> and <syntaxhighlight lang="cpp" inline="1">std::println</syntaxhighlight> functions for printing formatted text to stdout.
- Provide the named modules <syntaxhighlight lang="cpp" inline="1">std</syntaxhighlight> and <syntaxhighlight lang="cpp" inline="1">std.compat</syntaxhighlight> for importing the standard library.
- Added support for exclusive mode
fstreams
, analogous to the "x" flag infopen
. - Allowed
std::format
to handle ranges, tuples, and other containers. - Added
std::forward_like
. - Made
std::string::substr
use move semantics. - Added <syntaxhighlight lang="cpp" inline="1">std::generator</syntaxhighlight> which implements a coroutine generator that models <syntaxhighlight lang="cpp" inline="1">std::ranges::input_range</syntaxhighlight>
- <syntaxhighlight lang="cpp" inline="1">views::cartesian_product</syntaxhighlight>, <syntaxhighlight lang="cpp" inline="1">views::repeat</syntaxhighlight>, <syntaxhighlight lang="cpp" inline="1">views::stride</syntaxhighlight>, <syntaxhighlight lang="cpp" inline="1">views::as_const</syntaxhighlight>, <syntaxhighlight lang="cpp" inline="1">views::as_rvalue</syntaxhighlight>.
- Added new algorithms: <syntaxhighlight lang="cpp" inline="1">ranges::find_last</syntaxhighlight>, <syntaxhighlight lang="cpp" inline="1">ranges::contains</syntaxhighlight>, 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 ofstd::to_chars
andstd::from_chars
<syntaxhighlight lang="cpp" inline="1">constexpr</syntaxhighlight>-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:[155]
- Allowed <syntaxhighlight lang="cpp" inline="1">operator[]</syntaxhighlight> to be <syntaxhighlight lang="cpp" inline="1">static</syntaxhighlight>.
- Allowed <syntaxhighlight lang="cpp" inline="1">static</syntaxhighlight> and <syntaxhighlight lang="cpp" class="" style="" inline="1">thread_local</syntaxhighlight> variables to appear in <syntaxhighlight lang="cpp" inline="1">constexpr</syntaxhighlight> functions if they are usable in constant expressions.
- <syntaxhighlight lang="cpp" class="" style="" inline="1">consteval</syntaxhighlight> propagates upwards, that is, certain existing <syntaxhighlight lang="cpp" inline="1">constexpr</syntaxhighlight> functions become <syntaxhighlight lang="cpp" inline="1">consteval</syntaxhighlight> 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 <syntaxhighlight lang="cpp" inline="1">for</syntaxhighlight> loop to cover the entire loop.
- Reverted the deprecation of (all, not just bitwise) compound assignment to <syntaxhighlight lang="cpp" inline="1">volatile</syntaxhighlight> variables.
- Monadic functions for <syntaxhighlight lang="cpp" inline="1">std::expected</syntaxhighlight>.
- Synchronize the output of <syntaxhighlight lang="cpp" inline="1">std::print</syntaxhighlight> with the underlying stream if the native Unicode API is used.[156]
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:[157]
- Referencing the Unicode Standard.[158]
- Stashing stashing iterators for proper flattening.[159]
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
andstacktrace
- A type trait
std::is_implicit_lifetime
std::common_reference_t
ofstd::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
- ^ "Working Draft, Standard for Programming Language C++" (PDF). Open Standards. ISO/IEC. 2023-05-10. Archived (PDF) from the original on Feb 16, 2024.
- ^ "N4951 Editors' Report: Programming Languages - C++". Open Standards. 2023-05-10. Archived from the original on 2023-06-05.
- ^ Dusíková, Hana (2019-11-06). "N4817: 2020 Prague Meeting Invitation and Information" (PDF). Open Standards. Archived (PDF) from the original on 2019-12-29. Retrieved 2020-02-13.
- ^ Voutilainen, Ville (2019-11-25). "To boldly suggest an overall plan for C++23". Open Standards. Archived from the original on 2019-12-24. Retrieved 2020-02-13.
- ^ 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.
- ^ 6.0 6.1 Sutter, Herb (29 July 2020). "Business Plan and Convener's Report: ISO/IEC JTC1/SC22/WG21 (C++)" (PDF).
- ^ 7.0 7.1 7.2 "Upcoming Meetings, Past Meetings : Standard C++". isocpp.org.
- ^ "C++23 "Pandemic Edition" is complete (Trip report: Winter ISO C++ standards meeting, Issaquah, WA, USA)". herbsutter.com. 13 February 2023.
- ^ Gašper Ažman; Sy Brand; Ben Deane; Barry Revzin (2021-07-12). "Deducing this".
- ^ Barry Revzin; Richard Smith; Andrew Sutton; Daveed Vandevoorde (2021-03-22). "if consteval".
- ^ Mark Hoemmen; Daisy Hollman; Corentin Jabot; Isabella Muerte; Christian Trott (2021-09-14). "Multidimensional subscript operator" (PDF).
- ^ "static operator()". 2022-04-08.
- ^ "static operator[]" (PDF). 2022-11-11.
- ^ "Simpler implicit move". 2022-03-23.
- ^ Zhihao Yuan (2021-07-12). "auto(x): decay-copy in the language".
- ^ Melanie Blower (2021-04-30). "Add support for preprocessing directives elifdef and elifndef" (PDF).
- ^ Aaron Ballman (2022-01-13). "Support for #warning" (PDF).
- ^ "Wording for P2644R1 Fix for Range-based for Loop". 2022-11-11.
- ^ "Portable assumptions" (PDF). 2022-04-22.
- ^ Timur Doumler (2022-05-20). "Wording for class template argument deduction from inherited constructors" (PDF).
- ^ "Labels at the end of compound statements (C compatibility)" (PDF). 2022-01-13.
- ^ Jens Maurer (2021-04-13). "Extend init-statement to allow alias-declaration".
- ^ JeanHeyd Meneide; Rein Halbersma (2019-11-24). "Literal Suffix for (signed) size_t".
- ^ "Extended floating-point types and standard names". 2022-04-22.
- ^ Alex Christensen; JF Bastien (2020-12-11). "P1102R2: Down with ()!".
- ^ "Attributes on Lambda-Expressions" (PDF).
- ^ Ville Voutilainen (2021-07-12). "Non-literal variables (and labels and gotos) in constexpr functions".
- ^ "Permitting
static constexpr
variables inconstexpr
functions". 2022-11-07. - ^ "Relaxing some constexpr restrictions". 2022-01-27.
- ^ Andrzej Krzemieński (2021-04-12). "Narrowing contextual conversions to bool".
- ^ Corentin Jabot (2021-04-13). "Trimming whitespaces before line splicing" (PDF).
- ^ Pal Balog (2021-04-02). "Make declaration order layout mandated" (PDF).
- ^ "Delimited escape sequences" (PDF). 2022-02-25.
- ^ "Named universal character escapes". 2022-03-25.
- ^ "Support for UTF-8 as a portable source file encoding" (PDF). 2022-07-01.
- ^ Corentin Jabot (2021-09-14). "Consistent character literal encoding" (PDF).
- ^ Jens Maurer (2021-09-21). "Character sets and encodings".
- ^ "Standard Library Modules std and std.compat" (PDF).
- ^ "(std::generator: Synchronous Coroutine Generator for Ranges)" (PDF).
- ^ Vicente Botet; JF Bastien; Jonathan Wakely (2022-01-07). "std::expected".
- ^ Sy Brand (2021-04-27). "Monadic operations for std::optional".
- ^ Jeff Garland (2022-09-28). "P2505R5 Monadic Functions for
std::expected
". - ^ JeanHeyd Meneide (2021-01-22). "std::to_underlying for enumerations".
- ^ Matt Calabrese; Ryan McDougall (2021-07-09). "move_only_function".
- ^ Gašper Ažman (2022-05-13). "std::forward_like" (PDF).
- ^ Zhihao Yuan (2020-04-29). "invoke_r".
- ^ 47.0 47.1 Barry Revzin (2021-12-17). "Pipe support for user-defined range adaptors".
- ^ Isabella Muerte; Corentin Jabot (2021-09-17). "Byteswapping for fun&&nuf".
- ^ Melissa Mears; Jens Maurer (2021-10-15). "Function to mark unreachable code" (PDF).
- ^ Corentin Jabot (2022-07-15). "Compatibility between tuple, pair and tuple-like objects" (PDF).
- ^ Hui Xie; S. Levent Yilmaz; Tim Song (2023-02-07). "common_reference_t of reference_wrapper Should Be a Reference Type".
- ^ "Wording for P2644R1 Fix for Range-based for Loop". 2022-11-11.
- ^ Peter Dimov (2021-05-01). "Making std::type_info::operator== constexpr".
- ^ Daniil Goncharov (2022-06-25). "A more constexpr bitset" (PDF).
- ^ Andreas Fertig (2021-11-06). "Making std::unique_ptr constexpr" (PDF).
- ^ Edward J. Rosten; Oliver J. Rosten (2021-11-12). "constexpr for <cmath> and <cstdlib>" (PDF).
- ^ Daniil Goncharov; Alexander Karaev (2021-09-18). "Add Constexpr Modifiers to Functions to_chars and from_chars for Integral Types in <charconv> Header" (PDF).
- ^ Juan Alday (2020-10-12). "A proposal for a type trait to detect scoped enumerations" (PDF).
- ^ Timur Doumler; Vittorio Romeo (2022-11-11). "A trait for implicit lifetime types" (PDF).
- ^ Tim Song (2021-10-13). "A type trait to detect reference binding to temporary".
- ^ Justin Bassett (2022-07-02). "Move-only types for equality_comparable_with, totally_ordered_with, and three_way_comparable_with" (PDF).
- ^ 62.0 62.1 Corentin Jabot; Eric Niebler; Casey Carter (2022-01-21). "Conversions from ranges to containers" (PDF).
- ^ Christopher Di Bella (2021-02-19). "starts_with and ends_with".
- ^ Christopher Di Bella (2021-04-16). "std::ranges::contains".
- ^ Zach Laine (2022-06-17). "find_last" (PDF).
- ^ Tim Song (2021-12-05). "ranges::iota, ranges::shift_left, and ranges::shift_right".
- ^ Barry Revzin (2022-04-22). "ranges::fold".
- ^ Tim Song (2021-06-11). "zip".
- ^ Barry Revzin (2022-01-28). "views::join_with".
- ^ Tim Song (2021-12-05). "Windowing range adaptors: views::chunk and views::slide".
- ^ Tim Song (2021-11-19). "views::chunk_by".
- ^ Barry Revzin (2022-02-14). "views::as_rvalue".
- ^ 73.0 73.1 Barry Revzin (2022-06-17). "cbegin should always return a constant iterator".
- ^ Michał Dominiak (2022-07-13). "views::repeat".
- ^ Christopher Di Bella; Tim Song (2022-07-08). "stride_view".
- ^ Sy Brand; Michał Dominiak (2022-07-13). "views::cartesian_product".
- ^ Corentin Jabot (2022-12-07). "views::enumerate" (PDF).
- ^ David Olsen (2022-04-22). "Ranges iterators as inputs to non-Ranges algorithms".
- ^ Michał Dominiak (2022-07-13). "Relaxing range adaptors to allow for move only types".
- ^ Ville Voutilainen (2022-11-12). "Making multi-param constructors of views explicit".
- ^ JeanHeyd Meneide; Todor Buyukliev; Isabella Muerte (2021-04-15). "out_ptr - a scalable output pointer abstraction".
- ^ Jonathan Wakely; Chris Kennelly (2021-01-22). "Providing size feedback in the Allocator interface".
- ^ Timur Doumler; Richard Smith (2022-07-15). "Explicit lifetime management" (PDF).
- ^ Pablo Halpern (2023-02-08). "Disallow User Specialization of allocator_traits".
- ^ Wim Leflere; Paul Fee (2020-06-13). "string contains function".
- ^ Yuriy Chernyshov (2020-09-06). "A Proposal to Prohibit std::basic_string and std::basic_string_view construction from nullptr".
- ^ Corentin Jabot (2021-03-17). "Range constructor forstd::string_view 2: Constrain Harder" (PDF).
- ^ Chris Kennelly; Mark Zeren (2021-09-14). "basic_string::resize_and_overwrite".
- ^ "std::string::substr() &&".
- ^ "Formatting Ranges". 16 May 2022.
- ^ Barry Revzin (2022-07-15). "Improve default container formatting".
- ^ Corentin Jabot; Victor Zverovich (2023-02-09). "Formatting thread::id and stacktrace" (PDF).
- ^ Alexey Gorgurov; Antony Polukhin (2020-09-16). "A Proposal to add stacktrace library".
- ^ "Formatted output".
- ^ Peter Sommerlad (2021-02-26). "A strstream replacement using span<charT> as buffer" (PDF).
- ^ "Support exclusive mode for fstreams".
- ^ Bryce Adelstein Lelbach (2021-09-25). "Printing volatile Pointers".
- ^ "MDSPAN". 13 July 2022.
- ^ "index_type & size_type in mdspan" (PDF).
- ^ "
mdspan
: renamepointer
andcontiguous
". 15 June 2022. - ^ "Add the missing
empty
tomdspan
". - ^ "A Standard flat_map" (PDF).
- ^ "A Standard flat_set" (PDF).
- ^ Arthur O'Dwyer; Mike Spertus (2021-03-14). "Stop overconstraining allocators in container deduction guides".
- ^ Konstantin Boyarinov; Sergey Vinogradov; Ruslan Arutyunyan (2020-12-15). "Heterogeneous erasure overloads for associative containers".
- ^ Corentin Jabot (2021-03-05). "Iterators pair constructors for stack and queue" (PDF).
- ^ Nevin Liber (2021-03-19). "Require span & basic_string_view to be TriviallyCopyable" (PDF).
- ^ Hans-J. Boehm (2020-10-23). "P0943R6: Support C atomics in C++".
- ^ Steve Downey; Zach Laine; Tom Honermann; Peter Bindels; Jens Maurer (2021-04-12). "C++ Identifier Syntax using Unicode Standard Annex 31".
- ^ Erich Keane (2020-07-02). "Allow Duplicate Attributes" (PDF).
- ^ Barry Revzin (2021-09-14). "Change scope of lambda trailing-return-type".
- ^ "The Equality Operator You Are Looking For". 2022-01-13.
- ^ "De-deprecating volatile compound operations" (PDF).
- ^ "Core Language Working Group NB comment resolutions for the November, 2022 meeting : 2654. Un-deprecation of compound volatile assignments".
- ^ "
char8_t
Compatibility and Portability Fix". 2022-06-17. - ^ "Relax requirements on
wchar_t
to match existing practices" (PDF). 2022-07-15. - ^ "Using unknown pointers and references in constant expressions". 8 April 2022.
- ^ "
consteval
needs to propagate up". 2022-11-11. - ^ Barry Revzin (2020-02-19). "Conditionally borrowed ranges".
- ^ Tim Song (2021-01-12). "Repairing input range adaptors and counted_iterator".
- ^ Tim Song (2021-05-06). "join_view should join all views of ranges".
- ^ Barry Revzin (2021-03-05). "Superior String Splitting".
- ^ Barry Revzin (2021-05-14). "Views should not be required to be default constructible".
- ^ Barry Revzin; Tim Song (2021-08-15). "What is a view?".
- ^ Nicolai Josuttis (2021-09-24). "Fix istream_view" (PDF).
- ^ Barry Revzin (2022-01-18). "Expose std::basic-format-string<charT, Args...>".
- ^ Victor Zverovich (2021-02-05). "std::format improvements".
- ^ Victor Zverovich; Corentin Jabot (2021-09-11). "Fixing locale handling in chrono formatters".
- ^ Corentin Jabot (2022-12-02). "format's width estimation is too approximate and not forward compatible" (PDF).
- ^ Tom Honermann (2023-02-08). "std::format() fill character allowances".
- ^ Victor Zverovich (2021-09-24). "Add support for std::generator-like types to std::format".
- ^ Barry Revzin (2021-02-11). "Missing constexpr in std::optional and std::variant".
- ^ Barry Revzin (2020-10-30). "Inheriting from std::variant".
- ^ JF Bastien; Alisdair Meredith (2021-04-16). "Removing Garbage Collection Support".
- ^ Jens Maurer (2021-04-12). "Mixed string literal concatenation".
- ^ "Remove non-encodable wide character literals and multicharacter wide character literals" (PDF).
- ^ CJ Johnson (2021-11-22). "Deprecate std::aligned_storage and std::aligned_union" (PDF).
- ^ Matthias Kretz (2022-11-08). "Deprecate numeric_limits::has_denorm" (PDF).
- ^ "Programming Languages — Technical specification for C++ extensions for concurrency 2" (PDF).
- ^ "C++ Support in Clang".
- ^ "C++ Standards Support in GCC - GNU Project".
- ^ Ranns, Nina (2020-11-19). "WG21 2020-11 Virtual Meeting: Minutes of Meeting" (PDF).
- ^ Ranns, Nina (2021-02-22). "WG21 2021-02 Virtual Meeting: Minutes of Meeting" (PDF).
- ^ Alexey Dmitriev; Howard Hinnant (2020-10-22). "Relax Requirements for time_point::clock".
- ^ Tim Song (2020-11-13). "Locks lock lockables".
- ^ Ranns, Nina (2021-06-07). "WG21 2021-06 Virtual Meeting Minutes of Meeting" (PDF).
- ^ Ranns, Nina (2021-10-04). "WG21 2021-10 Virtual Meeting Minutes of Meeting" (PDF).
- ^ "GCC 12 Adds Support For New #elifdef #elifndef Directives". phoronix. May 12, 2021. Archived from the original on December 27, 2022.
- ^ Steve Downey (2021-06-14). "Add a pmr alias for std::stacktrace".
- ^ Giuseppe D'Angelo (2021-06-28). "Add a conditional noexcept specification to std::exchange".
- ^ Tim Song (2021-08-06). "Cleaning up integer-class types".
- ^ Thomas Köppe (2021-06-11). "Clarifying the status of the "C headers"".
- ^ Ranns, Nina (2022-02-07). "WG21 2022-02 Virtual Meeting: Minutes of Meeting" (PDF).
- ^ Ranns, Nina (2022-08-09). "WG21 2022-07 Virtual Meeting: Minutes of Meeting" (PDF).
- ^ Ranns, Nina (2022-12-05). "WG21 2022-11 Hybrid Meeting: Minutes of Meeting" (PDF).
- ^ Victor Zverovich (2022-11-08). "Should the output of std::print to a terminal be synchronized with the underlying stream?".
- ^ Ranns, Nina (2023-03-06). "WG21 2023-02 Hybrid Meeting: Minutes of Meeting" (PDF).
- ^ Corentin Jabot (2023-02-09). "Referencing The Unicode Standard" (PDF).
- ^ Tim Song (2023-01-31). "Stashing stashing iterators for proper flattening".
- Short description with empty Wikidata description
- Articles needing cleanup from December 2023
- All pages needing cleanup
- Articles with sections that need to be turned into prose from December 2023
- Articles lacking reliable references from December 2023
- All articles lacking reliable references
- Wikipedia articles needing clarification from August 2024
- Articles with invalid date parameter in template
- Articles with example C++ code
- C++
- C++ programming language family
- Algol programming language family
- High-level programming languages
- Statically typed programming languages