C++ > C++20

C++20 は、プログラミング言語 C++ の標準規格 ISO/IEC 14882:2020 [1]の通称である[2]。C++17 の次のバージョンである。この規格は、2020年2月にプラハで開催された会議でWG21によって技術的に最終決定[3]され[4]、2020年9月4日に承認され、2020年12月に公開された。

C++20は、C++14やC++17と比べ新たな主要機能が追加されている[5]。以下は、C++20に受け入れられるか、C++20に含めることが検討されている変更の一部のリストである。[6] [要更新]

新機能

C++20では多くの新機能が導入された。次のリストは完全ではない可能性がある。

言語

ライブラリ

非推奨の機能

新しい(および変更された)キーワード

concept、constinit[35]、consteval、co_await、co_return、co_yield、requires(加えてexportの意味の変更)、およびchar8_tといった多くの新しいキーワード(および新規の「宇宙船演算子」operator <=>)が追加された[50]。また、C++20以降、explicitは式を取ることができるようになった[51]。volatileキーワードのほとんどの用法は廃止予定となった[49]。

キーワードに加えて、importやmoduleなど、特別な意味を持つ識別子が新しく加わった。

C++20で新しく追加された属性:[[likely]]、[[unlikely]]、および[[no_unique_address]][52]。

変更の歴史

2017年7月(トロント)にC++20ワーキングドラフトに適用された変更は次のとおりである:[53]

2017年11月の秋の会議(アルバカーキ)でC++20ワーキングドラフトに適用された変更は次のとおりである:[54] [55]

2018年3月(ジャクソンビル)のC++20ワーキングドラフトに適用された変更は次のとおりである:[56]

2018年6月の夏の会議(Rapperswil)でC++20ワーキングドラフトに適用された変更は次のとおりである:[63]

2018年11月の秋の会議(サンディエゴ)でC++20ワーキングドラフトに適用された変更は次のとおりである:

2019年2月の冬の会議(コナ)でC++20ワーキングドラフトに適用された変更は次のとおりである:[75] [76]

2019年7月の夏の会議(ケルン)でC++20ワーキングドラフトに適用された変更は次のとおりである:[86] [87] [88]

2019年11月の秋の会議(ベルファスト)でのNBコメントの解決中に適用された変更には以下を含む:[120][121][122]

技術仕様として公開されている機能

今後の標準に延期された機能

関連項目

参考文献

  1. ↑ “ISO/IEC 14882:2020 Programming languages — C++” (2020年12月). 2023年1月27日閲覧。
  2. ↑ “cpprefjp - C++日本語リファレンス C++20”. 2023年1月29日閲覧。
  3. ↑ Sutter (2019年10月1日). “P1000R3: C++ IS schedule”. 2020年2月13日閲覧。
  4. ↑ Dusíková (2019年11月6日). “N4817: 2020 Prague Meeting Invitation and Information”. 2020年2月13日閲覧。
  5. ↑ “Why does the C++ standard ship every three years?”. 2019年7月19日閲覧。
  6. ↑ “P0592R0: To boldly suggest an overall plan for C++20”. 2017年5月6日閲覧。
  7. ↑ “P0606R0: Concepts Are Ready”. 2017年5月6日閲覧。
  8. ↑ “P1141R1 - Yet another approach for constrained declarations”. 2018年11月11日閲覧。
  9. ↑ “N4720: Working Draft, Extensions to C++ for Modules”. 2019年4月30日閲覧。
  10. ↑ Tim Shen. “Designated Initialization Wording”. 2017年7月16日閲覧。
  11. ↑ Thomas Köppe. “Allow lambda capture [=, this]”. 2017年7月16日閲覧。
  12. ↑ “Familiar template syntax for generic lambdas”. 2017年7月16日閲覧。
  13. ↑ “Range-based for statements with initializer”. 2019年10月30日閲覧。
  14. ↑ “Trip Report: C++ Standards Meeting in Albuquerque, November 2017” (英語). There's Waldo!. (2017年11月20日) 2017年12月11日閲覧。
  15. ↑ “Wording for lambdas in unevaluated contexts”. 2017年12月11日閲覧。
  16. ↑ “Default constructible and assignable stateless lambdas”. 2017年12月11日閲覧。
  17. ↑ “Pack expansion in lambda init-capture”. www.open-std.org. 2017年12月11日閲覧。
  18. ↑ “String literals as non-type template parameters”. 2017年12月11日閲覧。
  19. ↑ Nina Ranns. “Down with typename!”. 2019年5月18日閲覧。
  20. ↑ “Language support for empty objects”. 2019年8月4日閲覧。
  21. ↑ “Proposed wording for likely and unlikely attributes (Revision 5)”. 2019年5月18日閲覧。
  22. ↑ “explicit(bool)”. www.open-std.org. 2018年11月13日閲覧。
  23. ↑ “Allowing Virtual Function Calls in Constant Expressions”. www.open-std.org. 2019年3月11日閲覧。
  24. ↑ “P1330R0 - Changing the active member of a union inside constexpr”. 2019年10月14日閲覧。
  25. ↑ “P1002R0 - Try-catch blocks in constexpr functions”. 2018年11月11日閲覧。
  26. ↑ “P1327R0 - Allowing dynamic_cast, polymorphic typeid in Constant Expressions”. 2019年10月14日閲覧。
  27. ↑ “P1006R1 - Constexpr in std::pointer_traits”. 2018年11月11日閲覧。
  28. ↑ “P1073R2 - Immediate functions”. 2018年11月11日閲覧。
  29. ↑ “P1236R0: Alternative Wording for P0907R4 Signed Integers are Two's Complement”. 2018年11月11日閲覧。
  30. ↑ “P0668R4: Revising the C++ memory model”. 2018年11月11日閲覧。
  31. ↑ “P1091R1: Extending structured bindings to be more like variable declarations”. www.open-std.org. 2019年2月24日閲覧。
  32. ↑ “P1091R2: Extending structured bindings to be more like variable declarations”. www.open-std.org. 2019年2月24日閲覧。
  33. ↑ “N4649: Working Draft, Technical Specification on C++ Extensions for Coroutines”. 2017年5月6日閲覧。
  34. ↑ “P1099R5: Using Enum”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  35. 1 2 “P1143R2: Adding the constinit keyword”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  36. ↑ “P0896R3”. 2018年11月11日閲覧。
  37. ↑ “Extending make_shared to Support Arrays”. 2020年2月16日閲覧。
  38. ↑ Meredith. “Revising atomic_shared_ptr for C++20”. JTC1/SC22/WG21 - The C++ Standards Committee - ISOCPP. ISO. 27 December 2018閲覧。
  39. ↑ “Utility to convert a pointer to a raw pointer”. 2020年2月12日閲覧。
  40. ↑ Howard E. Hinnant. “Extending <chrono> to Calendars and Time Zones”. 2019年5月18日閲覧。
  41. ↑ Neil MacIntosh. “span: bounds-safe views for sequences of objects”. 2019年5月18日閲覧。
  42. ↑ Alan Talbot. “<version>”. 2019年5月18日閲覧。
  43. ↑ “Bit-casting object representations”. www.open-std.org. 2018年11月10日閲覧。
  44. ↑ “Integrating feature-test macros into the C++ WD”. www.open-std.org. 2018年11月10日閲覧。
  45. ↑ “P1032R1 - Misc constexpr bits”. 2018年11月11日閲覧。
  46. ↑ “Smart pointer creation with default initialization”. 2020年2月12日閲覧。
  47. ↑ “std::map::contains - cppreference.com”. en.cppreference.com. 2020年5月12日閲覧。
  48. ↑ “P1161R2: Deprecate uses of the comma operator in subscripting expressions”. www.open-std.org. 2019年7月20日閲覧。
  49. 1 2 3 “P1152R4: Deprecating volatile”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  50. ↑ “C++ keywords - cppreference.com”. en.cppreference.com. 2019年8月4日閲覧。
  51. ↑ “explicit specifier - cppreference.com”. en.cppreference.com. 2019年8月4日閲覧。
  52. ↑ “attribute specifier sequence(since C++11) - cppreference.com”. en.cppreference.com. 2019年8月4日閲覧。
  53. ↑ Herb Sutter. “Trip report: Summer ISO C++ standards meeting (Toronto)”. 2017年7月16日閲覧。
  54. ↑ Herb Sutter. “Trip report: Fall ISO C++ standards meeting (Albuquerque)”. 2017年12月4日閲覧。
  55. ↑ Smith. “N4714 Editors' Report -- Programming Languages -- C++”. C++ standards drafts. GitHub. 27 December 2018閲覧。
  56. ↑ Botond Ballo. “Trip Report: C++ Standards Meeting in Jacksonville, March 2018”. 2019年5月18日閲覧。
  57. ↑ Nina Ranns. “Down with typename!”. 2019年5月18日閲覧。
  58. ↑ “Language support for empty objects”. 2019年8月4日閲覧。
  59. ↑ “Proposed wording for likely and unlikely attributes (Revision 5)”. 2019年5月18日閲覧。
  60. ↑ Howard E. Hinnant. “Extending <chrono> to Calendars and Time Zones”. 2019年5月18日閲覧。
  61. ↑ Neil MacIntosh. “span: bounds-safe views for sequences of objects”. 2019年5月18日閲覧。
  62. ↑ Alan Talbot. “<version>”. 2019年5月18日閲覧。
  63. ↑ Herb Sutter. “Trip report: Summer ISO C++ standards meeting (Rapperswil)”. 2018年11月10日閲覧。
  64. ↑ “Support for contract based programming in C++”. www.open-std.org. 2018年11月10日閲覧。
  65. ↑ “Integrating feature-test macros into the C++ WD”. www.open-std.org. 2018年11月10日閲覧。
  66. ↑ “Bit-casting object representations”. www.open-std.org. 2018年11月10日閲覧。
  67. ↑ “explicit(bool)”. www.open-std.org. 2018年11月13日閲覧。
  68. ↑ “Allowing Virtual Function Calls in Constant Expressions”. www.open-std.org. 2019年3月11日閲覧。
  69. ↑ “P1032R1 - Misc constexpr bits”. 2018年11月11日閲覧。
  70. ↑ “P1073R2 - Immediate functions”. 2018年11月11日閲覧。
  71. ↑ “P1236R0: Alternative Wording for P0907R4 Signed Integers are Two's Complement”. 2018年11月11日閲覧。
  72. ↑ “P1289R0 - Access control in contract conditions”. 2018年11月11日閲覧。
  73. ↑ “P0668R4: Revising the C++ memory model”. 2018年11月11日閲覧。
  74. ↑ “Smart pointer creation with default initialization”. 2020年2月12日閲覧。
  75. ↑ “r/cpp - 2019-02 Kona ISO C++ Committee Trip Report (C++20 design is complete; Modules in C++20; Coroutines in C++20; Reflection TS v1 published; work begins on a C++ Ecosystem Technical Report)” (英語). reddit. 2019年2月24日閲覧。
  76. ↑ “Trip report: Winter ISO C++ standards meeting (Kona)” (英語). Sutter’s Mill (2019年2月23日). 2019年2月24日閲覧。
  77. ↑ “N4649: Working Draft, Technical Specification on C++ Extensions for Coroutines”. 2017年5月6日閲覧。
  78. ↑ “Clang 5 Release Notes on coroutines”. 2018年8月31日閲覧。
  79. ↑ “N4720: Working Draft, Extensions to C++ for Modules”. 2019年4月30日閲覧。
  80. ↑ “Clang 5 documentation on Modules”. 2017年5月6日閲覧。
  81. ↑ “C++ Modules in VS 2015 Update 1”. 2018年8月10日閲覧。
  82. ↑ “cxx-modules - GCC Wiki”. gcc.gnu.org. 2019年2月24日閲覧。
  83. ↑ “cxx-modules - GCC Wiki”. gcc.gnu.org. 2019年2月24日閲覧。
  84. ↑ “P1091R1: Extending structured bindings to be more like variable declarations”. www.open-std.org. 2019年2月24日閲覧。
  85. ↑ “P1091R2: Extending structured bindings to be more like variable declarations”. www.open-std.org. 2019年2月24日閲覧。
  86. ↑ “r/cpp - 2019-07 Cologne ISO C++ Committee Trip Report — 🚀 The C++20 Eagle has Landed 🚀 (C++20 Committee Draft shipped; Contracts Moved From C++20 to a Study Group; `std::format` in C++20; C++20 Synchronization Library)” (英語). reddit. 2019年9月15日閲覧。
  87. ↑ Botond Ballo. “Trip Report: C++ Standards Meeting in Cologne, July 2019”. 2019年8月5日閲覧。
  88. ↑ Sutter. “Trip report: Summer ISO C++ standards meeting (Cologne)”. 2019年7月21日閲覧。
  89. ↑ Josuttis. “P1823R0: Remove Contracts from C++20”. 2019年8月20日閲覧。
  90. ↑ “P1161R2: Deprecate uses of the comma operator in subscripting expressions”. www.open-std.org. 2019年7月20日閲覧。
  91. ↑ “Permitting trivial default initialization in constexpr contexts”. 2019年7月20日閲覧。
  92. ↑ “P1668R1: Enabling Constexpr Intrinsics By Permitting Unevaluated inline-asm in Constexpr Functions”. www.open-std.org. 2019年7月20日閲覧。
  93. ↑ “P1099R5: Using Enum”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  94. ↑ “P1186R3: When do you actually use <=>?”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  95. ↑ “P1630R1: Spaceship needs a tune-up”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  96. ↑ “P1766R1: Mitigating minor modules maladies”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  97. ↑ “P1452R2: On the non-uniform semantics of return-type-requirements”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  98. ↑ “P1771R1: nodiscard for constructors”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  99. ↑ “P1754R1: Rename concepts to standard_case for C++20, while we still can”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  100. ↑ “P0645R10: Text Formatting”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  101. ↑ “std::format in C++20”. www.zverovich.net (2019年7月23日). 2019年9月15日閲覧。
  102. ↑ “P1361R2: Integration of chrono with text formatting”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  103. ↑ “P1652R1: Printf corner cases in std::format”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  104. ↑ “P0553R4: Bit operations”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  105. ↑ “P1965R2: constexpr INVOKE”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  106. ↑ “P0631R8: Math Constants”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  107. ↑ “P1643R1: Add wait/notify to atomic_ref<T>”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  108. ↑ “P1664R0: Add wait/notify to atomic<shared_ptr<T>>”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  109. ↑ “P1614R2: The Mothership has Landed - Adding <=> to the Library”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  110. ↑ “P1502R1: Standard library header units for C++20”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  111. ↑ “P1135R6: The C++20 Synchronization Library”. www.open-std.org (2019年7月20日). 2019年7月20日閲覧。
  112. ↑ “P0514R4: Efficient concurrent waiting for C++20”. 2019年7月20日閲覧。
  113. ↑ “P0666R2: Revised Latches and Barriers for C++20”. 2019年7月20日閲覧。
  114. ↑ “P0995R1: Improving atomic_flag”. 2019年7月20日閲覧。
  115. ↑ “P1285R0: Don't Make C++ Unimplementable On Small CPUs”. 2019年7月20日閲覧。
  116. ↑ “P1208R6: Adopt source_location from Library Fundamentals V3 for C++20”. 2019年8月20日閲覧。
  117. ↑ “P0980R1: Making std::string constexpr”. 2019年8月20日閲覧。
  118. ↑ “P1004R2: Making std::vector constexpr”. 2019年8月20日閲覧。
  119. ↑ “P0660R10: Stop Token and Joining Thread”. 2019年8月20日閲覧。
  120. ↑ “r/cpp - 2019-11 Belfast ISO C++ Committee Trip Report — Started Processing Feedback on the C++20 Committee Draft; ABI Review Group Formed” (英語). reddit. 2019年11月9日閲覧。
  121. ↑ Sutter (2019年11月9日). “Trip report: Autumn ISO C++ standards meeting (Belfast)” (英語). Sutter’s Mill. 2019年11月9日閲覧。
  122. ↑ botondballo (2019年11月15日). “Trip Report: C++ Standards Meeting in Belfast, November 2019” (英語). There's Waldo!. 2019年11月24日閲覧。
  123. ↑ “P1907R0: Inconsistencies with non-type template parameters”. www.open-std.org (2019年10月7日). 2019年11月9日閲覧。
  124. ↑ “P1714: NTTP are incomplete without float, double, and long double! (Revision 1)”. www.open-std.org (2019年7月19日). 2019年11月9日閲覧。
  125. ↑ “P1855R=: Make <compare> freestanding”. www.open-std.org (2019年10月5日). 2019年11月9日閲覧。
  126. ↑ “P1872R0: span should have size_type not index_type”. www.open-std.org (2019年9月16日). 2019年11月9日閲覧。
  127. ↑ “P1456: Move-only views”. www.open-std.org (2019年1月25日). 2019年11月9日閲覧。
  128. ↑ “[P1391R4 P1391: Range constructor for std::string_view]”. www.open-std.org. 2019年11月9日閲覧。
  129. ↑ “P1394: Range constructor for std::span”. www.open-std.org (2019年8月2日). 2019年11月9日閲覧。
  130. ↑ “P1870R1: forwarding-range<T> is too subtle”. www.open-std.org. 2019年11月9日閲覧。
  131. ↑ “P0883: Fixing Atomic Initialization”. www.open-std.org (2018年6月5日). 2019年11月9日閲覧。
  132. ↑ “Missing feature-test macros 2018-2019”. www.open-std.org (2019年10月6日). 2019年11月9日閲覧。
  133. ↑ “C++ Extensions for Parallelism Version 2”. 2019年7月9日閲覧。
  134. ↑ “Task Blocks”. 2017年7月23日閲覧。
  135. ↑ “C++ Extensions for Networking”. 2019年7月9日閲覧。
  136. ↑ “C++ Extensions for Reflection”. 2019年7月9日閲覧。
  137. ↑ Sutter (2019年7月20日). “Trip report: Summer ISO C++ standards meeting (Cologne)” (英語). Sutter’s Mill. 2019年7月21日閲覧。
  138. ↑ “Reflections on the reflection proposals - Meeting C++” (英語). meetingcpp.com. 2017年6月30日閲覧。
  139. ↑ “Static reflection”. www.open-std.org. 2018年11月10日閲覧。
  140. ↑ Herb Sutter. “Metaclasses”. 2017年7月23日閲覧。
  141. ↑ “A Unified Executors Proposal for C++”. www.open-std.org. 2019年2月24日閲覧。
  142. ↑ “N4771: Working Draft, C++ Extensions for Networking”. 2019年3月23日閲覧。
  143. ↑ “ISO/IEC TS 19216:2018 Programming Languages -- C++ Extensions for Networking”. 2018年12月17日閲覧。
  144. ↑ “A General Property Customization Mechanism”. www.open-std.org. 2019年2月24日閲覧。
  145. ↑ “A Unified Futures Proposal for C++”. 2019年7月8日閲覧。

外部リンク

⌬ Phoenix Mesh CID: 未登録 IPFS未登録 📡 0ピア N=1 CRITICAL PQS B63