Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      C++20

      From cppreference.com
      <cpp
       
       
       

      C++20 is a major version after C++17, featuring major features (concepts, modules, coroutines, and ranges) and other language and library features. The standard was published in December 2020.

      This section is incomplete

      Contents

      [edit]New language features

      [edit]New library features

      [edit]New headers

      inThread support library:

      [edit]Library features

      [edit]Defect reports

      Defect Reports fixed in C++20 (158 core, 345 library)

      [edit]Compiler support

      Main Article:C++20 compiler support

      [edit]C++20 core language features

      C++20 feature

       
      Paper(s)

       
      GCC
      Clang
      MSVC
      Apple Clang
      EDG eccp
      Intel C++
      Nvidia HPC C++ (ex PGI)*
      Nvidia nvcc
      Cray
      AllowLambda capture[=, this]P0409R28619.22*10.0.0*5.12021.120.712.011.0
      __VA_OPT__P0306R4
      P1042R1
      8 (partial)*
      10 (partial)*
      12
      919.25*11.0.3*5.12021.120.712.011.0
      Designated initializers  (FTM)*P0329R44.7 (partial)*
      8
      3.0 (partial)*
      10
      19.21*12.0.0*5.12021.120.712.011.0
      template-parameter-list for generic lambdas  (FTM)*P0428R28919.22*11.0.0*5.12021.120.712.011.0
      Default member initializers for bit-fieldsP0683R18619.25*10.0.0*5.12021.120.712.011.0
      Initializer list constructors in class template argument deductionP0702R18619.14*Yes5.02021.120.712.011.0
      const&-qualified pointers to membersP0704R18619.0 (2015)*10.0.0*5.12021.120.712.011.0
      Concepts  (FTM)*P0734R05*
      10
      1019.23*(partial)*
      19.30*
      12.0.0* (partial)6.12023.1*20.1112.011.0
      Lambdas in unevaluated contextsP0315R4913 (partial)*
      14 (partial)*
      17
      19.28 (16.8)*13.1.6* (partial)6.22023.1 (partial)
      2024.0
      20.712.0
      Three-way comparison operator  (FTM)*P0515R3108 (partial)
      10
      19.20*12.0.0*5.12021.120.712.011.0
      DR11: Simplifying implicit lambda captureP0588R1819.24*5.12021.120.712.0
      init-statements for range-based forP0614R19819.25*11.0.0*6.02021.720.1112.011.0
      Default constructible and assignable statelesslambdasP0624R29819.22*10.0.1*5.12021.120.712.011.0
      Type mismatch of defaulted special member functionsP0641R29(partial)*819.0 (2015)*(partial)*10.0.1*5.12021.120.712.011.0
      Access checking on specializationsP0692R1Yes8 (partial)
      14
      19.26*14.0.0*5.12021.120.712.0
      ADL and function templates that are not visibleP0846R09919.21*11.0.3*5.12021.120.712.011.0
      DR11: Specify whenconstexpr function definitions areneeded for constant evaluation  (FTM)*P0859R05.2 (partial)*
      9
      819.27* (partial)*
      19.31**
      11.0.0*(partial)12.011.0
      Attributes[[likely]] and[[unlikely]]P0479R591219.26*13.0.0*5.12021.720.712.0
      Maketypename more optionalP0634R391619.29 (16.10)*16.0.0*5.12023.120.712.0
      Pack-expansions inlambda init-captures  (FTM)*P0780R29919.22*11.0.3*6.12021.720.1112.011.0
      Attribute[[no_unique_address]]P0840R29919.28 (16.9)**11.0.3*5.12021.120.712.011.0
      Conditionally trivial special member functions  (FTM)*P0848R3101619.28 (16.8)*6.12021.720.1112.0
      DR17: Relaxing thestructured bindings customization point finding rulesP0961R18819.20*10.0.1*5.12021.120.712.011.0
      DR11: Relaxing therange-for loop customization point finding rulesP0962R18819.25*11.0.0*5.12021.120.712.011.0
      DR17: Allow structured bindings to accessible membersP0969R08819.20*10.0.1*5.12021.120.712.011.0
      Destroyingoperator delete  (FTM)*P0722R39619.27*10.0.0*6.12023.120.1112.011.0
      Class types inConstant template parametersP0732R2912 (partial)19.26*(partial)*
      19.28 (16.9)*
      13.0.0* (partial)6.22023.1 (partial)21.312.0
      Deprecate implicitcapture ofthis via[=]P0806R29719.22*10.0.1*5.120.712.011.0
      explicit(bool)  (FTM)*P0892R29919.24*11.0.3*5.12021.120.712.011.0
      Integratingfeature-test macrosP0941R253.419.15* (partial)
      19.20*
      Yes5.02021.120.712.011.0
      Prohibit aggregates with user-declared constructorsP1008R19819.20*10.0.1*5.12021.120.712.011.0
      constexprvirtual function  (FTM)*P1064R09919.28 (16.9)*11.0.3*5.12021.120.712.011.0
      Consistency improvements for comparisonsP1120R0108 (partial)
      10
      19.22*12.0.0*5.12023.120.712.011.0
      char8_t  (FTM)*P0482R697*19.22*10.0.0*5.12021.120.712.011.0
      std::is_constant_evaluated()  (FTM)*P0595R29919.25*11.0.3*5.119.121.112.011.0
      constexprtry-catch blocksP1002R19819.25*10.0.1*5.12023.120.712.011.0
      Immediate functions (consteval)  (FTM)*P1073R310 (partial)*
      11
      11 (partial)
      14 (partial)*
      17
      19.28 (16.8)*
      (partial)*

      19.29 (16.10)*
      11.0.3* (partial)
      15.0.0*
      5.12021.120.712.0
      Nested inline namespacesP1094R29819.27*10.0.1*5.12021.120.712.011.0
      Yet another approach forconstraineddeclarationsP1141R2101019.26* (partial)
      19.28 (16.9)*
      12.0.5*6.12023.120.1112.011.0
      Signed integers are two's complementP1236R199Yes11.0.3*N/A2023.1*yes*12.011.0
      dynamic_cast and polymorphictypeid inconstant expressionsP1327R110919.28 (16.9)*11.0.3*5.12021.120.712.011.0
      Changing the active member of a union insideconstexpr  (FTM)*P1330R09919.10*11.0.3*5.12021.120.712.011.0
      Coroutines  (FTM)*  (FTM)*P0912R5
      LWG3393
      108 (partial)
      17 (partial)*
      19.0 (2015)* (partial)
      19.10**
      19.28 (16.8)*
      10.0.1* (partial)5.12021.123.3*12.0 (host code only)
      Parenthesizedinitialization of aggregates  (FTM)*P0960R3101619.28 (16.8)*16.0.0*5.12021.120.712.0
      DR11: Array size deduction innew-expressionsP1009R211919.27*11.0.3*5.12021.120.712.011.0
      Modules  (FTM)*P1103R311 (partial)8 (partial)19.0 (2015)* (partial)
      19.10**
      19.28 (16.8)*
      10.0.1* (partial)2023.1 (partial)
      Stronger Unicode requirementsP1041R4
      P1139R2
      10Yes19.0 (2015)**
      19.26**
      YesN/A2023.1*Yes12.011.0
      <=> != ==P1185R2101019.22*12.0.0*5.12021.120.712.011.0
      DR11: Explicitly defaulted functions with different exception specificationsP1286R210919.28 (16.8)*11.0.3*5.12021.120.712.011.0
      Lambda capture and storage class specifiers of structured bindingsP1091R3
      P1381R1
      108 (partial)
      16
      19.11**
      19.24**
      16.0.0*5.12021.120.712.0
      Permit conversions to arrays of unknown boundP0388R4101419.27*14.0.0*6.02021.520.1112.0
      constexpr container operations  (FTM)*P0784R7101019.28 (16.9)*12.0.0*6.02021.520.1112.011.0
      Deprecating some uses ofvolatileP1152R4101019.27*12.0.0*6.02021.520.1112.011.0
      constinit  (FTM)*P1143R2101019.29 (16.10)*12.0.0*6.12021.720.1112.011.0
      Deprecate comma operator in subscriptsP1161R310919.25*11.0.3*6.02021.720.1112.011.0
      [[nodiscard]] with messageP1301R410919.25*11.0.3*6.02021.520.1112.011.0
      Trivial default initialization inconstexpr functionsP1331R2101019.27*12.0.0*6.12021.720.1112.011.0
      Unevaluatedasm-declaration inconstexpr functionsP1668R1101019.28 (16.9)*12.0.0*6.12021.720.1112.011.0
      using enum  (FTM)*P1099R5111319.24*13.1.6*6.32023.122.512.0
      SynthesizingThree-way comparison for specified comparison categoryP1186R3111019.24*12.0.0*6.02021.520.1112.011.0
      DR17:[[nodiscard]] for constructorsP1771R110919.24*11.0.3*6.02021.520.1112.011.0
      class template argument deduction for alias templates  (FTM)*P1814R0101919.27*6.523.912.0
      class template argument deduction for aggregates  (FTM)*P1816R0
      P2082R1
      10*
      11*
      1719.27*6.32023.1 (partial)*
      2024.1
      23.312.0
      DR11:Implicit move for more local objects and rvalue referencesP1825R011*1319.24*13.1.6*6.02021.520.1112.0
      Allow defaulting comparisons by valueP1946R0101019.25*12.0.0*6.12021.720.1112.011.0
      Removestd::weak_equality andstd::strong_equalityP1959R0101019.25*12.0.0*6.12021.720.1112.011.0
      Inconsistencies with constant template parameters  (FTM)*P1907R110 (partial)
      11
      18 (partial)*19.26*13.1.6* (partial)6.22023.1 (partial)21.312.0
      DR98: Pseudo-destructors end object lifetimesP0593R61111Yes12.0.5*N/A2023.1*Yes12.011.0
      DR11: Converting fromT* tobool should be considered narrowingP1957R210*
      11*
      1119.27*12.0.5*6.112.011.0
       

      C++20 feature
       

      Paper(s)
      GCC
      Clang
      MSVC
      Apple Clang
      EDG eccp
      Intel C++
      Nvidia HPC C++ (ex PGI)*
      Nvidia nvcc
      Cray

      [edit]C++20 library features

      C++20 feature

       
      Paper(s)

       
      GCC libstdc++
      Clang libc++
      MSVC STL
      Apple Clang*
      std::endian  (FTM)*P0463R18719.22*10.0.0*
      Extendingstd::make_shared() to support arrays  (FTM)*P0674R1121519.27*14.0.3*
      Floating-point atomic  (FTM)*P0020R6101819.22*16.0.0*
      Synchronized buffered (std::basic_osyncstream)  (FTM)*P0053R7111819.29 (16.10)*
      constexpr for<algorithm> and<utility>  (FTM)*P0202R3108 (partial)
      12
      19.26*10.0.1* (partial)
      13.0.0*
      Moreconstexpr for<complex>  (FTM)*P0415R197 (partial)
      16
      19.27*10.0.0* (partial)
      15.0.0*
      Makestd::memory_order a scoped enumerationP0439R09919.25*11.0.3*
      Stringprefix andsuffix checking:string(_view)::starts_with /ends_with  (FTM)*P0457R29619.21*10.0.0*
      Library support foroperator<=><compare>  (FTM)*P0768R1107 (partial)
      12 (partial)*
      17
      19.20* (partial)
      19.28 (16.9)*
      13.0.0*
      std::remove_cvref  (FTM)*P0550R29619.20*10.0.0*
      [[nodiscard]] in thestandard libraryP0600R197 (partial)
      16
      19.13* (partial)
      19.22*
      10.0.0* (partial)
      15.0.0*
      Usingstd::move innumeric algorithmsP0616R091219.23*13.0.0*
      Utility to convert a pointer to a raw pointer  (FTM)*P0653R28619.22*Yes
      Atomicstd::shared_ptr andstd::weak_ptr  (FTM)*P0718R21219.27*
      std::span  (FTM)*P0122R710719.26*10.0.0*
      Calendar andTime zone  (FTM)*P0355R711 (partial)*
      13 (partial)*
      14
      7 (partial)
      19 (partial)*
      19.29 (16.10)*10.0.0* (partial)
      <version>P0754R29719.22*10.0.0*
      Comparing unordered containersP0809R0YesYes16.0*Yes
      ConstexprIterator requirements  (FTM)*  (FTM)*P0858R091219.11*13.0.0*
      std::basic_string::reserve() should not shrinkP0966R111819.25*10.0.1*
      Atomic Compare-And-Exchange with padding bitsP0528R31319.28 (16.8)*
      std::atomic_ref  (FTM)*P0019R8101919.28 (16.8)*
      contains() member function of associative containers, e.g.std::map::contains()P0458R291319.21*13.1.6*
      DR11: Guaranteed copy elision forpiecewise constructionP0475R19Yes19.29 (16.10)*Yes
      std::bit_cast()  (FTM)*P0476R2111419.27*14.0.3*
      Integral power-of-2 operations:

      std::bit_ceil(),std::bit_floor(),std::bit_width(),std::has_single_bit()  (FTM)*

      P0556R3
      P1956R1
      9*
      10*
      9*
      12*
      19.25**
      19.27**
      19.28 (16.8)*
      11.0.3**
      13.0.0**
      Improving the return value of erase-like algorithms  (FTM)*P0646R191019.21*12.0.0*
      std::destroying_delete_t  (FTM)*P0722R39919.27*11.0.3*
      std::is_convertible  (FTM)*P0758R19919.23*11.0.3*
      Addstd::shift_left/right to<algorithm>  (FTM)*P0769R2101219.21*13.0.0*
      Constexpr forstd::swap() andswap related functionsP0879R0101319.26*13.1.6*
      std::type_identity  (FTM)*P0887R19819.21*10.0.1*
      Concepts library  (FTM)*P0898R3101319.23*13.1.6*
      constexprcomparison operators forstd::arrayP1023R010819.27*10.0.1*
      std::unwrap_ref_decay andstd::unwrap_reference  (FTM)*P0318R19819.21*10.0.1*
      std::bind_front()  (FTM)*P0356R591319.25*13.1.6*
      std::reference_wrapper for incomplete typesP0357R39819.26*10.0.1*
      Fixingoperator>>(basic_istream&, CharT*)P0487R111819.23*10.0.1*
      Library support forchar8_t  (FTM)*P0482R698 (partial)
      16
      19.22*10.0.1* (partial)
      15.0.0*
      Utility functions to implementuses-allocatorconstructionP0591R491619.29 (16.10)*15.0.0*
      DR17:std::variant andstd::optional should propagate copy/move trivialityP0602R48.3819.11*10.0.1*
      DR17: A sanestd::variant converting constructorP0608R310919.29 (16.10)**
      19.42**
      11.0.3*
      std::function's move constructor should benoexceptP0771R17.2619.22*Yes
      TheOneRangesProposal  (FTM)*P0896R41013 (partial)
      15*
      19.29 (16.10)*14.0.3*
      Heterogeneous lookup forunordered associative containers  (FTM)*P0919R3
      P1690R1
      111219.23* (P0919R3)
      19.25* (P1690R1)
      13.0.0*
      <chrono>zero(),min(), andmax() should benoexceptP0972R09819.14*10.0.1*
      constexpr instd::pointer_traits  (FTM)*P1006R19819.26*10.0.1*
      std::assume_aligned()  (FTM)*P1007R39*
      11
      1519.28 (16.9)*14.0.3*
      Smart pointer creation with default initialization (e.g.make_unique_for_overwrite)  (FTM)*P1020R1
      P1973R1
      11*
      12*
      1619.28 (16.9)*15.0.0*
      Miscconstexpr bits  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*P1032R1101319.28 (16.8)*13.1.6*
      Remove comparison operators ofstd::spanP1085R210819.26*10.0.1*
      Make stateful allocator propagation more consistent foroperator+(basic_string)P1165R1101519.26*14.0.3*
      Consistent container erasure, e.g.std::erase(std::vector), orstd::erase_if(std::map)  (FTM)*P1209R0
      P1115R3
      9*
      10*
      8*
      11*
      19.25**
      19.27**
      10.0.1**
      12.0.5**
      Standard library header unitsP1502R11119.29 (16.10)*
      polymorphic_allocator<> as a vocabulary type  (FTM)*P0339R691619.28 (16.9)*15.0.0*
      std::execution::unseq  (FTM)*P1001R291719.28 (16.8)*
      std::lerp() andstd::midpoint()  (FTM)*P0811R39919.23* (partial)
      19.28 (16.8)*
      11.0.3*
      Usability enhancements forstd::spanP1024R3109*
      14
      19.26*11.0.3*
      DR17: Makestd::create_directory() intuitiveP1164R18.31219.20*13.0.0*
      std::ssize() and unsigned extent forstd::span  (FTM)*P1227R210919.25*11.0.3*
      Traits for (un)bounded arrays  (FTM)*P1357R19919.25*11.0.3*
      std::to_array()  (FTM)*P0325R4101019.25*12.0.0*
      Efficient access tostd::basic_stringbuf’s bufferP0408R7111719.29 (16.10)*15.0.0*
      Layout-compatibility andpointer-interconvertibility traits  (FTM)*  (FTM)*P0466R51219.29 (16.10)**
      Bit operations:std::

      rotl(),rotr(),countl_zero(),countl_one(),countr_zero(),countr_one(),popcount()  (FTM)*

      P0553R49919.25**
      19.28 (16.8)*
      11.0.3*
      Mathematical constants  (FTM)*P0631R8101119.25*12.0.5*
      Text formatting  (FTM)*P0645R101314**
      17
      19.29 (16.10)*15.0.0*
      std::stop_token andstd::jthread  (FTM)*P0660R101017
      (partial)*

      20*
      19.28 (16.9)*
      constexprstd::allocator and related utilities  (FTM)*P0784R7101219.29 (16.10)*13.0.0*
      constexprstd::string  (FTM)*P0426R1
      P1032R1
      P0980R1
      121519.29 (16.10)*
      19.30**
      14.0.3*
      constexprstd::vector  (FTM)*P1004R2121519.29 (16.10)*
      19.30**
      14.0.3*
      Inputrange adaptorsP1035R7101619.29 (16.10)*15.0.0*
      constexprstd::invoke() and related utilitiesP1065R2101219.28 (16.8)*13.0.0*
      Atomic waiting and notifying,std::counting_semaphore,std::latch andstd::barrier  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*  (FTM)*P1135R6111119.28 (16.9)*13.1.6*
      std::source_location  (FTM)*P1208R61115*
      (partial)
      16
      19.29 (16.10)*15.0.0*
      Adding<=> to the standard libraryP1614R21014*
      (partial)
      17*
      (partial)
      19
      19.29 (16.10)*13.1.6* (partial)
      constexpr default constructor ofstd::atomic andstd::atomic_flag  (FTM)*P0883R2101319.26*13.1.6*
      constexpr fornumeric algorithms  (FTM)*P1645R1101219.26*13.0.0*
      Safe integral comparisons  (FTM)*P0586R2101319.27*13.1.6*
       

      C++20 feature
       

      Paper(s)
      GCC libstdc++
      Clang libc++
      MSVC STL
      Apple Clang*

      * - hover over a cell marked with the star* to see additional pop-up notes.
      DRnn - the numbernn after "DR" denotes target C++ revision the Defect Report is applied to, e.g., DR20 → C++20.

      [edit]External links

      1. C++20 - Wikipedia
      2. Working C++20 examples
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/20&oldid=178089"

      [8]ページ先頭

      ©2009-2025 Movatter.jp