C++23

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

C++23 is the informal name for the revision of the ISO/IEC standard for the C++ programming language expected to follow C++20. The current draft is N4885.[1]

In February 2020, at the final meeting for C++20 in Prague, an overall plan for C++23 was adopted:[2][3]

Planned features for C++23 are 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,[4][5] as was the November 2020 meeting in New York[6][5] and the February 2021 meeting in Kona, Hawaii.[6] It is unlikely that there will be any face-to-face meeting before 2022.[7]

New features[edit]

In the absence of face-to-face WG21 meetings, few new features have so far been added to the C++23 draft. But the following were added after the virtual WG21 meeting of 9 November 2020, where they were approved by straw polls:[7]

  • Literal suffixes for std::size_t and the corresponding signed type[8]
  • 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[9]
  • A stacktrace library (<stacktrace>), based on Boost.Stacktrace[10]
  • A type trait std::is_scoped_enum[11]
  • The header <stdatomic.h>, for interoperability with C atomics[12]

After the virtual WG21 meeting of 22 February 2021, following features are added where they were approved by straw polls:[13]

  • Repairing input range adaptors and counter_iterator.[14]
  • Removing unnecessary empty parameter list () from lambda expressions.[15]
  • Relax the requirements for time_point::clock.[16]
  • std::visit for classes that are derived from std::variant.[17]
  • Locks lock lockables.[18]
  • Conditionally borrowed ranges.[19]
  • std::to_underlying.[20]

After the Summer 2021 ISO C++ standards plenary virtual meeting of June 2021, few features are added for C++ 23:

  • Consteval if (if consteval). [21]
  • Narrowing contextual conversions to bool. [22]
  • Allowing duplicate attributes. [23]
  • std::span-based string-stream (<spanstream>). [24]
  • std::out_ptr() and std::inout_ptr(). [25]
  • constexpr for std::optional, std::variant[26], and std::type_info::operator==. [27]
  • Iterators pair constructors for std::stack (stack) and std::queue (queue). [28]
  • Few changes of the ranges library:
    • Generalized starts_with and ends_with for arbitrary ranges. [29]
    • Redesigned split_view and new lazy_split_view. [30]
    • Relaxing the constraint on join_view. [31]
    • Removing default_initializable constraint from concept view. [32]
    • Range constructor for std::basic_string_view. [33]
  • Prohibiting std::basic_string and std::basic_string_view construction from nullptr. [34]
  • std::invoke_r. [35]
  • Improvements on std::format. [36]
  • Adding default arguments for std::pair's forwarding constructor. [37]

References[edit]

  1. ^ "Working Draft, Standard for Programming Language C++" (PDF). 2021-03-17.
  2. ^ Dusíková, Hana (2019-11-06). "N4817: 2020 Prague Meeting Invitation and Information" (PDF). Retrieved 2020-02-13.
  3. ^ Voutilainen, Ville (2019-11-25). "To boldly suggest an overall plan for C++23". www.open-std.org. Retrieved 2020-02-13.
  4. ^ "Evolving C++ remotely".
  5. ^ a b Sutter, Herb (29 July 2020). "Business Plan and Convener's Report: ISO/IEC JTC1/SC22/WG21 (C++)" (PDF).
  6. ^ a b "Upcoming Meetings, Past Meetings".
  7. ^ a b Ranns, Nina (2020-11-19). "WG21 2020-11 Virtual Meeting: Minutes of Meeting" (PDF).
  8. ^ JeanHeyd Meneide; Rein Halbersma (2019-11-24). "Literal Suffix for (signed) size_t".
  9. ^ Wim Leflere; Paul Fee (2020-06-13). "string contains function".
  10. ^ Alexey Gorgurov; Antony Polukhin (2020-09-16). "A Proposal to add stacktrace library".
  11. ^ Juan Alday (2020-10-12). "A proposal for a type trait to detect scoped enumerations" (PDF).
  12. ^ Hans-J. Boehm (2020-10-23). "P0943R6: Support C atomics in C++".
  13. ^ Ranns, Nina (2021-02-22). "WG21 2021-02 Virtual Meeting: Minutes of Meeting" (PDF).
  14. ^ Tim Song (2021-01-12). "Repairing input range adaptors and counted_iterator".
  15. ^ Alex Christensen; JF Bastien (2020-12-11). "P1102R2: Down with ()!".
  16. ^ Alexey Dmitriev; Howard Hinnant (2020-10-22). "Relax Requirements for time_point::clock".
  17. ^ Barry Revzin (2020-10-30). "Inheriting from std::variant".
  18. ^ Tim Song (2020-11-13). "Locks lock lockables".
  19. ^ Barry Revzin (2020-02-19). "Conditionally borrowed ranges".
  20. ^ JeanHeyd Meneide (2021-01-22). "std::to_underlying for enumerations".
  21. ^ Barry Revzin; Richard Smith; Andrew Sutton; Daveed Vandevoorde (2021-03-22). "if consteval".
  22. ^ Andrzej Krzemieński (2021-04-12). "Narrowing contextual conversions to bool".
  23. ^ Erich Keane (2020-07-02). "Allow Duplicate Attributes" (PDF).
  24. ^ Peter Sommerlad (2021-02-26). "A strstream replacement using span<charT> as buffer" (PDF).
  25. ^ JeanHeyd Meneide; Todor Buyukliev; Isabella Muerte (2021-04-15). "out_ptr - a scalable output pointer abstraction".
  26. ^ Barry Revzin (2021-02-11). "Missing constexpr in std::optional and std::variant".
  27. ^ Peter Dimov (2021-05-01). "Making std::type_info::operator== constexpr".
  28. ^ Corentin Jabot (2021-03-05). "Iterators pair constructors for stack and queue" (PDF).
  29. ^ Christopher Di Bella (2021-02-19). "starts_with and ends_with".
  30. ^ Barry Revzin (2021-03-05). "Superior String Splitting".
  31. ^ Tim Song (2021-05-06). "join_view should join all views of ranges".
  32. ^ Barry Revzin (2021-05-14). "Views should not be required to be default constructible".
  33. ^ Corentin Jabot (2021-03-17). "Range constructor forstd::string_view 2: Constrain Harder" (PDF).
  34. ^ Yuriy Chernyshov (2020-09-06). "A Proposal to Prohibit std::basic_string and std::basic_string_view construction from nullptr".
  35. ^ Zhihao Yuan (2020-04-29). "invoke_r".
  36. ^ Victor Zverovich (2021-02-05). "std::format improvements".
  37. ^ Logan R. Smith (2021-01-25). "Default Arguments for pair's Forwarding Constructor".