C++20

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

C++20 is the informal name for the revision of the ISO/IEC standard for the C++ programming language expected to follow C++17.[1] The C++ Standards Committee began planning C++20 in July 2017.[2] The current draft is N4750.[3]

Below is a partial list of changes that have been proposed or discussed for inclusion into C++20.[4]

Possible new language features[edit]

The following were voted into the C++20 draft in July 2017:[5]

  • Concepts[6]
  • Designated initializers[7] (based on the C99 feature)
  • [=, this] as a lambda capture[8]
  • Template parameter lists on lambdas[9]

Features voted into C++20 in the fall meeting in November 2017 include:[10]

  • Three-way comparison using the "spaceship operator", operator <=>
  • Initialization of an additional variable within a range-based for statement
  • Bit-casting of object representations, with less verbosity than memcpy() and more ability to exploit compiler internals
  • A specialization of std::atomic for std::shared_ptr
  • Lambdas in unevaluated contexts.[11][12]
  • Default constructible and assignable stateless lambdas.[11][13]
  • Allow pack expansions in lambda init-capture.[11][14]
  • String literals as template parameters.[11][15]

Other possible new language features:

Possible library changes[edit]

  • Atomic smart pointers[22] (std::atomic_shared_ptr and std::atomic_weak_ptr)
  • Extended futures[23]
  • Latches and barriers[24]
  • Networking extensions,[25] including async, basic I/O services, timers, buffers and buffer-oriented streams, sockets, and Internet protocols
  • Ranges[26]
  • Task blocks[27]

See also[edit]

References[edit]

  1. ^ "The next standard after C++17 will be C++20". , by Herb Sutter
  2. ^ "Current Status : Standard C++". 
  3. ^ "Working Draft, Standard for Programming Language C++" (PDF). 
  4. ^ "P0592R0: To boldly suggest an overall plan for C++20". 
  5. ^ Herb Sutter. "Trip report: Summer ISO C++ standards meeting (Toronto)". 
  6. ^ "P0606R0: Concepts Are Ready" (PDF). 
  7. ^ Tim Shen; Richard Smith. "Designated Initialization Wording". 
  8. ^ Thomas Köppe. "Allow lambda capture [=, this]". 
  9. ^ "Familiar template syntax for generic lambdas". 
  10. ^ Herb Sutter. "Trip report: Fall ISO C++ standards meeting (Albuquerque)". 
  11. ^ a b c d "Trip Report: C++ Standards Meeting in Albuquerque, November 2017". There's Waldo!. 2017-11-20. Retrieved 2017-12-11. 
  12. ^ "Wording for lambdas in unevaluated contexts" (PDF). 
  13. ^ "Default constructible and assignable stateless lambdas" (PDF). 
  14. ^ "Pack expansion in lambda init-capture". www.open-std.org. Retrieved 2017-12-11. 
  15. ^ "String literals as non-type template parameters" (PDF). 
  16. ^ "N4649: Working Draft, Technical Specification on C++ Extensions for Coroutines" (PDF). 
  17. ^ "N4637: Working Draft, Extensions to C++ for Modules" (PDF). 
  18. ^ "Clang 5 documentation on Modules". 
  19. ^ "N3341: Transactional Language Constructs for C++" (PDF). 
  20. ^ "Reflections on the reflection proposals - Meeting C++". meetingcpp.com. Retrieved 2017-06-30. 
  21. ^ Herb Sutter. "Metaclasses" (PDF). 
  22. ^ "Atomic Smart Pointers". 
  23. ^ "Functional in C++17 and C++20". 
  24. ^ "P0342R0: Timing barriers". 
  25. ^ "N4734: Working Draft, C++ Extensions for Networking" (PDF). 
  26. ^ "N4651: Working Draft, C++ Extensions for Ranges" (PDF). 
  27. ^ "Task Blocks". 

External links[edit]

  • JTC1/SC22/WG21 – the ISO/IEC C++ Standard Working Group (a.k.a. the C++ Standards Committee)
  • Ranges (range-v3) github repository, by Eric Niebler