Spec-Zone.ru › C++

C++20

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.

New language features

  • Feature test macros
  • Three-way comparison operator <=> and operator==() = default
  • Designated initializers
  • Init-statements and initializers in range-for
  • char8_t
  • New attributes: [[no_unique_address]], [[likely]], [[unlikely]]
  • Pack-expansions in lambda init-captures
  • Removed the requirement to use typename to disambiguate types in many contexts
  • consteval, constinit
  • Further relaxed constexpr
  • Signed integers are 2's complement
  • Bitwise shift operators unified behavior
  • aggregate initialization using parentheses
  • coroutines
  • modules
  • Constraints and concepts
  • Abbreviated function template
  • DR11: array new can deduce array size

New library features

New headers

  • <bit>
  • <compare>
  • <concepts>
  • <coroutine>
  • <format>
  • <numbers>
  • <ranges>
  • <source_location>
  • <span>
  • <syncstream>
  • <version>

in Thread support library:

  • <barrier>
  • <latch>
  • <semaphore>
  • <stop_token>

Library features

  • Library feature-test macros
  • Formatting library
  • Concepts library
  • Calendar and Time zone library in <chrono>
  • std::source_location
  • std::span
  • std::endian: big / little / native
  • Integral power-of-2 operations and std::bit_cast in <bit>
  • Array support for std::make_shared
  • std::remove_cvref
  • std::to_address
  • Floating-point atomics, std::shared_ptr atomics
  • Thread-coordination classes: std::barrier, std::latch, and std::counting_semaphore
  • std::jthread and thread cancellation classes: std::stop_token, std::stop_source, and std::stop_callback
  • std::basic_osyncstream
  • std::basic_string and other char8_t uses
  • constexpr for <algorithm>, <utility>, <complex>
  • string::starts_with / ends_with and string_view::starts_with / ends_with
  • std::assume_aligned
  • std::bind_front
  • std::c8rtomb / std::mbrtoc8
  • std::make_obj_using_allocator etc
  • std::make_shared_for_overwrite / std::make_unique_for_overwrite
  • Heterogeneous lookup in unordered associative containers
  • std::pmr::polymorphic_allocator with additional member functions and std::byte as its default template argument
  • execution::unseq
  • std::midpoint and std::lerp
  • std::ssize
  • std::is_bounded_array, std::is_unbounded_array
  • Ranges
  • Uniform container erasure: std::erase / std::erase_if, e.g. std::erase(std::list) or erase_if(std::map) etc
  • Mathematical constants in <numbers>

Defect reports

Defect Reports fixed in C++20 (158 core, 345 library)
  • CWG#555
  • CWG#581
  • CWG#682
  • CWG#943
  • CWG#1076
  • CWG#1271
  • CWG#1299
  • CWG#1331
  • CWG#1332
  • CWG#1426
  • CWG#1469
  • CWG#1523
  • CWG#1581
  • CWG#1621
  • CWG#1632
  • CWG#1636
  • CWG#1640
  • CWG#1646
  • CWG#1704
  • CWG#1728
  • CWG#1781
  • CWG#1836
  • CWG#1857
  • CWG#1859
  • CWG#1862
  • CWG#1893
  • CWG#1910
  • CWG#1912
  • CWG#1913
  • CWG#1931
  • CWG#1937
  • CWG#1938
  • CWG#1943
  • CWG#1983
  • CWG#2020
  • CWG#2045
  • CWG#2051
  • CWG#2053
  • CWG#2059
  • CWG#2080
  • CWG#2081
  • CWG#2083
  • CWG#2088
  • CWG#2092
  • CWG#2103
  • CWG#2112
  • CWG#2126
  • CWG#2133
  • CWG#2164
  • CWG#2170
  • CWG#2177
  • CWG#2207
  • CWG#2226
  • CWG#2227
  • CWG#2229
  • CWG#2233
  • CWG#2234
  • CWG#2235
  • CWG#2237
  • CWG#2241
  • CWG#2249
  • CWG#2253
  • CWG#2254
  • CWG#2255
  • CWG#2256
  • CWG#2257
  • CWG#2260
  • CWG#2266
  • CWG#2267
  • CWG#2273
  • CWG#2277
  • CWG#2278
  • CWG#2280
  • CWG#2282
  • CWG#2285
  • CWG#2287
  • CWG#2289
  • CWG#2290
  • CWG#2292
  • CWG#2293
  • CWG#2294
  • CWG#2295
  • CWG#2299
  • CWG#2300
  • CWG#2303
  • CWG#2305
  • CWG#2307
  • CWG#2309
  • CWG#2310
  • CWG#2313
  • CWG#2315
  • CWG#2317
  • CWG#2318
  • CWG#2321
  • CWG#2322
  • CWG#2323
  • CWG#2330
  • CWG#2332
  • CWG#2336
  • CWG#2338
  • CWG#2339
  • CWG#2342
  • CWG#2343
  • CWG#2346
  • CWG#2347
  • CWG#2351
  • CWG#2352
  • CWG#2353
  • CWG#2354
  • CWG#2356
  • CWG#2358
  • CWG#2359
  • CWG#2360
  • CWG#2365
  • CWG#2366
  • CWG#2368
  • CWG#2371
  • CWG#2372
  • CWG#2373
  • CWG#2374
  • CWG#2376
  • CWG#2378
  • CWG#2379
  • CWG#2380
  • CWG#2381
  • CWG#2382
  • CWG#2384
  • CWG#2385
  • CWG#2386
  • CWG#2387
  • CWG#2390
  • CWG#2394
  • CWG#2399
  • CWG#2400
  • CWG#2404
  • CWG#2406
  • CWG#2411
  • CWG#2414
  • CWG#2416
  • CWG#2418
  • CWG#2419
  • CWG#2422
  • CWG#2424
  • CWG#2426
  • CWG#2427
  • CWG#2429
  • CWG#2430
  • CWG#2431
  • CWG#2432
  • CWG#2433
  • CWG#2436
  • CWG#2437
  • CWG#2439
  • CWG#2441
  • CWG#2442
  • CWG#2445
  • CWG#2446
  • CWG#2447
  • LWG#1052
  • LWG#1203
  • LWG#2040
  • LWG#2055
  • LWG#2070
  • LWG#2089
  • LWG#2139
  • LWG#2151
  • LWG#2154
  • LWG#2155
  • LWG#2164
  • LWG#2183
  • LWG#2184
  • LWG#2243
  • LWG#2292
  • LWG#2318
  • LWG#2334
  • LWG#2412
  • LWG#2444
  • LWG#2498
  • LWG#2499
  • LWG#2511
  • LWG#2593
  • LWG#2597
  • LWG#2682
  • LWG#2693
  • LWG#2741
  • LWG#2780
  • LWG#2783
  • LWG#2797
  • LWG#2800
  • LWG#2808
  • LWG#2814
  • LWG#2816
  • LWG#2821
  • LWG#2831
  • LWG#2832
  • LWG#2836
  • LWG#2840
  • LWG#2841
  • LWG#2843
  • LWG#2849
  • LWG#2851
  • LWG#2856
  • LWG#2859
  • LWG#2870
  • LWG#2894
  • LWG#2897
  • LWG#2899
  • LWG#2929
  • LWG#2932
  • LWG#2935
  • LWG#2936
  • LWG#2937
  • LWG#2938
  • LWG#2940
  • LWG#2941
  • LWG#2942
  • LWG#2943
  • LWG#2944
  • LWG#2945
  • LWG#2946
  • LWG#2948
  • LWG#2950
  • LWG#2951
  • LWG#2952
  • LWG#2953
  • LWG#2954
  • LWG#2955
  • LWG#2957
  • LWG#2958
  • LWG#2961
  • LWG#2964
  • LWG#2965
  • LWG#2966
  • LWG#2968
  • LWG#2969
  • LWG#2970
  • LWG#2972
  • LWG#2974
  • LWG#2975
  • LWG#2976
  • LWG#2977
  • LWG#2978
  • LWG#2979
  • LWG#2980
  • LWG#2981
  • LWG#2982
  • LWG#2988
  • LWG#2989
  • LWG#2993
  • LWG#2995
  • LWG#2996
  • LWG#2998
  • LWG#2999
  • LWG#3000
  • LWG#3001
  • LWG#3004
  • LWG#3005
  • LWG#3006
  • LWG#3007
  • LWG#3008
  • LWG#3009
  • LWG#3012
  • LWG#3013
  • LWG#3014
  • LWG#3015
  • LWG#3017
  • LWG#3018
  • LWG#3022
  • LWG#3023
  • LWG#3024
  • LWG#3025
  • LWG#3026
  • LWG#3030
  • LWG#3031
  • LWG#3034
  • LWG#3035
  • LWG#3037
  • LWG#3038
  • LWG#3039
  • LWG#3040
  • LWG#3041
  • LWG#3042
  • LWG#3043
  • LWG#3045
  • LWG#3048
  • LWG#3050
  • LWG#3051
  • LWG#3054
  • LWG#3055
  • LWG#3058
  • LWG#3061
  • LWG#3062
  • LWG#3065
  • LWG#3067
  • LWG#3070
  • LWG#3074
  • LWG#3075
  • LWG#3076
  • LWG#3077
  • LWG#3079
  • LWG#3080
  • LWG#3083
  • LWG#3087
  • LWG#3091
  • LWG#3094
  • LWG#3096
  • LWG#3100
  • LWG#3101
  • LWG#3102
  • LWG#3103
  • LWG#3104
  • LWG#3110
  • LWG#3111
  • LWG#3112
  • LWG#3113
  • LWG#3115
  • LWG#3116
  • LWG#3119
  • LWG#3122
  • LWG#3125
  • LWG#3127
  • LWG#3128
  • LWG#3129
  • LWG#3130
  • LWG#3131
  • LWG#3132
  • LWG#3133
  • LWG#3137
  • LWG#3140
  • LWG#3141
  • LWG#3144
  • LWG#3145
  • LWG#3147
  • LWG#3148
  • LWG#3149
  • LWG#3150
  • LWG#3151
  • LWG#3153
  • LWG#3154
  • LWG#3156
  • LWG#3158
  • LWG#3160
  • LWG#3168
  • LWG#3169
  • LWG#3173
  • LWG#3175
  • LWG#3176
  • LWG#3178
  • LWG#3179
  • LWG#3180
  • LWG#3182
  • LWG#3183
  • LWG#3184
  • LWG#3185
  • LWG#3186
  • LWG#3187
  • LWG#3190
  • LWG#3191
  • LWG#3194
  • LWG#3196
  • LWG#3198
  • LWG#3199
  • LWG#3200
  • LWG#3201
  • LWG#3202
  • LWG#3206
  • LWG#3208
  • LWG#3209
  • LWG#3212
  • LWG#3213
  • LWG#3218
  • LWG#3221
  • LWG#3222
  • LWG#3224
  • LWG#3225
  • LWG#3226
  • LWG#3228
  • LWG#3230
  • LWG#3231
  • LWG#3232
  • LWG#3233
  • LWG#3235
  • LWG#3237
  • LWG#3238
  • LWG#3239
  • LWG#3241
  • LWG#3242
  • LWG#3243
  • LWG#3244
  • LWG#3245
  • LWG#3246
  • LWG#3247
  • LWG#3248
  • LWG#3250
  • LWG#3251
  • LWG#3252
  • LWG#3253
  • LWG#3254
  • LWG#3255
  • LWG#3256
  • LWG#3257
  • LWG#3259
  • LWG#3260
  • LWG#3262
  • LWG#3264
  • LWG#3266
  • LWG#3269
  • LWG#3270
  • LWG#3272
  • LWG#3273
  • LWG#3274
  • LWG#3276
  • LWG#3277
  • LWG#3278
  • LWG#3279
  • LWG#3280
  • LWG#3281
  • LWG#3282
  • LWG#3284
  • LWG#3285
  • LWG#3286
  • LWG#3290
  • LWG#3291
  • LWG#3292
  • LWG#3294
  • LWG#3295
  • LWG#3296
  • LWG#3299
  • LWG#3300
  • LWG#3301
  • LWG#3302
  • LWG#3303
  • LWG#3304
  • LWG#3307
  • LWG#3310
  • LWG#3313
  • LWG#3314
  • LWG#3315
  • LWG#3316
  • LWG#3317
  • LWG#3318
  • LWG#3319
  • LWG#3320
  • LWG#3321
  • LWG#3322
  • LWG#3323
  • LWG#3324
  • LWG#3325
  • LWG#3326
  • LWG#3327
  • LWG#3328
  • LWG#3329
  • LWG#3330
  • LWG#3331
  • LWG#3332
  • LWG#3334
  • LWG#3335
  • LWG#3336
  • LWG#3338
  • LWG#3340
  • LWG#3345
  • LWG#3346
  • LWG#3347
  • LWG#3348
  • LWG#3349
  • LWG#3350
  • LWG#3351
  • LWG#3352
  • LWG#3354
  • LWG#3355
  • LWG#3356
  • LWG#3358
  • LWG#3359
  • LWG#3360
  • LWG#3362
  • LWG#3363
  • LWG#3364
  • LWG#3367
  • LWG#3368
  • LWG#3369
  • LWG#3371
  • LWG#3372
  • LWG#3373
  • LWG#3374
  • LWG#3375
  • LWG#3377
  • LWG#3379
  • LWG#3380
  • LWG#3381
  • LWG#3382
  • LWG#3383
  • LWG#3384
  • LWG#3385
  • LWG#3386
  • LWG#3387
  • LWG#3388
  • LWG#3389
  • LWG#3390
  • LWG#3393
  • LWG#3395
  • LWG#3396
  • LWG#3397
  • LWG#3398

Compiler support

Main Article: C++20 compiler support

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
Allow Lambda capture [=,this] P0409R2 8 6 19.22* 10.0.0* 5.1 2021.1 20.7 12.0 11.0
__VA_OPT__ P0306R4
P1042R1
8 (partial)*
10 (partial)*
12
9 19.25* 11.0.3* 5.1 2021.1 20.7 12.0 11.0
Designated initializers (FTM)* P0329R4 4.7 (partial)*
8
3.0 (partial)*
10
19.21* 12.0.0* 5.1 2021.1 20.7 12.0 11.0
template-parameter-list for generic lambdas (FTM)* P0428R2 8 9 19.22* 11.0.0* 5.1 2021.1 20.7 12.0 11.0
Default member initializers for bit-fields P0683R1 8 6 19.25* 10.0.0* 5.1 2021.1 20.7 12.0 11.0
Initializer list constructors in class template argument deduction P0702R1 8 6 19.14* Yes 5.0 2021.1 20.7 12.0 11.0
const&-qualified pointers to members P0704R1 8 6 19.0 (2015)* 10.0.0* 5.1 2021.1 20.7 12.0 11.0
Concepts (FTM)* P0734R0 5*
10
10 19.23* (partial)*
19.30*
12.0.0* (partial) 6.1 2023.1* 20.11 12.0 11.0
Lambdas in unevaluated contexts P0315R4 9 13 (partial)*
14 (partial)*
17
19.28 (16.8)* 13.1.6* (partial) 6.2 2023.1 (partial)
2024.0
20.7 12.0
Three-way comparison operator (FTM)* P0515R3 10 8 (partial)
10
19.20* 12.0.0* 5.1 2021.1 20.7 12.0 11.0
DR11: Simplifying implicit lambda capture P0588R1 8 19.24* 5.1 2021.1 20.7 12.0
init-statements for range-based for P0614R1 9 8 19.25* 11.0.0* 6.0 2021.7 20.11 12.0 11.0
Default constructible and assignable stateless lambdas P0624R2 9 8 19.22* 10.0.1* 5.1 2021.1 20.7 12.0 11.0
Type mismatch of defaulted special member functions P0641R2 9 (partial)* 8 19.0 (2015)* (partial)* 10.0.1* 5.1 2021.1 20.7 12.0 11.0
Access checking on specializations P0692R1 Yes 8 (partial)
14
19.26* 14.0.0* 5.1 2021.1 20.7 12.0
ADL and function templates that are not visible P0846R0 9 9 19.21* 11.0.3* 5.1 2021.1 20.7 12.0 11.0
DR11: Specify when constexpr function definitions are needed for constant evaluation (FTM)* P0859R0 5.2 (partial)*
9
8 19.27* (partial)*
19.31**
11.0.0* (partial) 12.0 11.0
Attributes [[likely]] and [[unlikely]] P0479R5 9 12 19.26* 13.0.0* 5.1 2021.7 20.7 12.0
Make typename more optional P0634R3 9 16 19.29 (16.10)* 16.0.0* 5.1 2023.1 20.7 12.0
Pack-expansions in lambda init-captures (FTM)* P0780R2 9 9 19.22* 11.0.3* 6.1 2021.7 20.11 12.0 11.0
Attribute [[no_unique_address]] P0840R2 9 9 19.28 (16.9)** 11.0.3* 5.1 2021.1 20.7 12.0 11.0
Conditionally trivial special member functions (FTM)* P0848R3 10 16 19.28 (16.8)* 6.1 2021.7 20.11 12.0
DR17: Relaxing the structured bindings customization point finding rules P0961R1 8 8 19.20* 10.0.1* 5.1 2021.1 20.7 12.0 11.0
DR11: Relaxing the range-for loop customization point finding rules P0962R1 8 8 19.25* 11.0.0* 5.1 2021.1 20.7 12.0 11.0
DR17: Allow structured bindings to accessible members P0969R0 8 8 19.20* 10.0.1* 5.1 2021.1 20.7 12.0 11.0
Destroying operator delete (FTM)* P0722R3 9 6 19.27* 10.0.0* 6.1 2023.1 20.11 12.0 11.0
Class types in Non-type template parameters P0732R2 9 12 (partial) 19.26*(partial)*
19.28 (16.9)*
13.0.0* (partial) 6.2 2023.1 (partial) 21.3 12.0
Deprecate implicit capture of this via [=] P0806R2 9 7 19.22* 10.0.1* 5.1 20.7 12.0 11.0
explicit(bool) (FTM)* P0892R2 9 9 19.24* 11.0.3* 5.1 2021.1 20.7 12.0 11.0
Integrating feature-test macros P0941R2 5 3.4 19.15* (partial)
19.20*
Yes 5.0 2021.1 20.7 12.0 11.0
Prohibit aggregates with user-declared constructors P1008R1 9 8 19.20* 10.0.1* 5.1 2021.1 20.7 12.0 11.0
constexpr virtual function (FTM)* P1064R0 9 9 19.28 (16.9)* 11.0.3* 5.1 2021.1 20.7 12.0 11.0
Consistency improvements for comparisons P1120R0 10 8 (partial)
10
19.22* 12.0.0* 5.1 2023.1 20.7 12.0 11.0
char8_t (FTM)* P0482R6 9 7* 19.22* 10.0.0* 5.1 2021.1 20.7 12.0 11.0
std::is_constant_evaluated() (FTM)* P0595R2 9 9 19.25* 11.0.3* 5.1 19.1 21.1 12.0 11.0
constexpr try-catch blocks P1002R1 9 8 19.25* 10.0.1* 5.1 2023.1 20.7 12.0 11.0
Immediate functions (consteval) (FTM)* P1073R3 10 (partial)*
11
11 (partial)
14 (partial)*
17
19.28 (16.8)*
(partial)*

19.29 (16.10)*
11.0.3* (partial)
15.0.0*
5.1 2021.1 20.7 12.0
Nested inline namespaces P1094R2 9 8 19.27* 10.0.1* 5.1 2021.1 20.7 12.0 11.0
Yet another approach for constrained declarations P1141R2 10 10 19.26* (partial)
19.28 (16.9)*
12.0.5* 6.1 2023.1 20.11 12.0 11.0
Signed integers are two's complement P1236R1 9 9 Yes 11.0.3* N/A 2023.1* yes* 12.0 11.0
dynamic_cast and polymorphic typeid in constant expressions P1327R1 10 9 19.28 (16.9)* 11.0.3* 5.1 2021.1 20.7 12.0 11.0
Changing the active member of a union inside constexpr (FTM)* P1330R0 9 9 19.10* 11.0.3* 5.1 2021.1 20.7 12.0 11.0
Coroutines (FTM)* (FTM)* P0912R5
LWG3393
10 8 (partial)
17 (partial)*
19.0 (2015)* (partial)
19.10**
19.28 (16.8)*
10.0.1* (partial) 5.1 2021.1 23.3* 12.0 (host code only)
Parenthesized initialization of aggregates (FTM)* P0960R3 10 16 19.28 (16.8)* 16.0.0* 5.1 2021.1 20.7 12.0
DR11: Array size deduction in new-expressions P1009R2 11 9 19.27* 11.0.3* 5.1 2021.1 20.7 12.0 11.0
Modules (FTM)* P1103R3 11 (partial) 8 (partial) 19.0 (2015)* (partial)
19.10**
19.28 (16.8)*
10.0.1* (partial) 2023.1 (partial)
Stronger Unicode requirements P1041R4
P1139R2
10 Yes 19.0 (2015)**
19.26**
Yes N/A 2023.1* Yes 12.0 11.0
<=> != == P1185R2 10 10 19.22* 12.0.0* 5.1 2021.1 20.7 12.0 11.0
DR11: Explicitly defaulted functions with different exception specifications P1286R2 10 9 19.28 (16.8)* 11.0.3* 5.1 2021.1 20.7 12.0 11.0
Lambda capture and storage class specifiers of structured bindings P1091R3
P1381R1
10 8 (partial)
16
19.11**
19.24**
16.0.0* 5.1 2021.1 20.7 12.0
Permit conversions to arrays of unknown bound P0388R4 10 14 19.27* 14.0.0* 6.0 2021.5 20.11 12.0
constexpr container operations (FTM)* P0784R7 10 10 19.28 (16.9)* 12.0.0* 6.0 2021.5 20.11 12.0 11.0
Deprecating some uses of volatile P1152R4 10 10 19.27* 12.0.0* 6.0 2021.5 20.11 12.0 11.0
constinit (FTM)* P1143R2 10 10 19.29 (16.10)* 12.0.0* 6.1 2021.7 20.11 12.0 11.0
Deprecate comma operator in subscripts P1161R3 10 9 19.25* 11.0.3* 6.0 2021.7 20.11 12.0 11.0
[[nodiscard]] with message P1301R4 10 9 19.25* 11.0.3* 6.0 2021.5 20.11 12.0 11.0
Trivial default initialization in constexpr functions P1331R2 10 10 19.27* 12.0.0* 6.1 2021.7 20.11 12.0 11.0
Unevaluated asm-declaration in constexpr functions P1668R1 10 10 19.28 (16.9)* 12.0.0* 6.1 2021.7 20.11 12.0 11.0
using enum (FTM)* P1099R5 11 13 19.24* 13.1.6* 6.3 2023.1 22.5 12.0
Synthesizing Three-way comparison for specified comparison category P1186R3 11 10 19.24* 12.0.0* 6.0 2021.5 20.11 12.0 11.0
DR17: [[nodiscard]] for constructors P1771R1 10 9 19.24* 11.0.3* 6.0 2021.5 20.11 12.0 11.0
class template argument deduction for alias templates (FTM)* P1814R0 10 19 19.27* 6.5 23.9 12.0
class template argument deduction for aggregates (FTM)* P1816R0
P2082R1
10*
11*
17 19.27* 6.3 2023.1 (partial)*
2024.1
23.3 12.0
DR11: Implicit move for more local objects and rvalue references P1825R0 11* 13 19.24* 13.1.6* 6.0 2021.5 20.11 12.0
Allow defaulting comparisons by value P1946R0 10 10 19.25* 12.0.0* 6.1 2021.7 20.11 12.0 11.0
Remove std::weak_equality and std::strong_equality P1959R0 10 10 19.25* 12.0.0* 6.1 2021.7 20.11 12.0 11.0
Inconsistencies with non-type template parameters (FTM)* P1907R1 10 (partial)
11
18 (partial)* 19.26* 13.1.6* (partial) 6.2 2023.1 (partial) 21.3 12.0
DR98: Pseudo-destructors end object lifetimes P0593R6 11 11 Yes 12.0.5* N/A 2023.1* Yes 12.0 11.0
DR11: Converting from T* to bool should be considered narrowing P1957R2 10*
11*
11 19.27* 12.0.5* 6.1 12.0 11.0


C++20 feature


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

C++20 library features

C++20 feature

Paper(s)

GCC libstdc++
Clang libc++
MSVC STL
Apple Clang*
std::endian (FTM)* P0463R1 8 7 19.22* 10.0.0*
Extending std::make_shared() to support arrays (FTM)* P0674R1 12 15 19.27* 14.0.3*
Floating-point atomic (FTM)* P0020R6 10 18 19.22* 16.0.0*
Synchronized buffered (std::basic_osyncstream) (FTM)* P0053R7 11 18 19.29 (16.10)*
constexpr for <algorithm> and <utility> (FTM)* P0202R3 10 8 (partial)
12
19.26* 10.0.1* (partial)
13.0.0*
More constexpr for <complex> (FTM)* P0415R1 9 7 (partial)
16
19.27* 10.0.0* (partial)
15.0.0*
Make std::memory_order a scoped enumeration P0439R0 9 9 19.25* 11.0.3*
String prefix and suffix checking: string(_view) ::starts_with / ends_with (FTM)* P0457R2 9 6 19.21* 10.0.0*
Library support for operator<=> <compare> (FTM)* P0768R1 10 7 (partial)
12 (partial)*
17
19.20* (partial)
19.28 (16.9)*
13.0.0*
std::remove_cvref (FTM)* P0550R2 9 6 19.20* 10.0.0*
[[nodiscard]] in the standard library P0600R1 9 7 (partial)
16
19.13* (partial)
19.22*
10.0.0* (partial)
15.0.0*
Using std::move in numeric algorithms P0616R0 9 12 19.23* 13.0.0*
Utility to convert a pointer to a raw pointer (FTM)* P0653R2 8 6 19.22* Yes
Atomic std::shared_ptr and std::weak_ptr (FTM)* P0718R2 12 19.27*
std::span (FTM)* P0122R7 10 7 19.26* 10.0.0*
Calendar and Time zone (FTM)* P0355R7 11 (partial)*
13 (partial)*
14
7 (partial)
19 (partial)*
19.29 (16.10)* 10.0.0* (partial)
<version> P0754R2 9 7 19.22* 10.0.0*
Comparing unordered containers P0809R0 Yes Yes 16.0* Yes
ConstexprIterator requirements (FTM)* (FTM)* P0858R0 9 12 19.11* 13.0.0*
std::basic_string::reserve() should not shrink P0966R1 11 8 19.25* 10.0.1*
Atomic Compare-And-Exchange with padding bits P0528R3 13 19.28 (16.8)*
std::atomic_ref (FTM)* P0019R8 10 19 19.28 (16.8)*
contains() member function of associative containers, e.g. std::map::contains() P0458R2 9 13 19.21* 13.1.6*
DR11: Guaranteed copy elision for piecewise construction P0475R1 9 Yes 19.29 (16.10)* Yes
std::bit_cast() (FTM)* P0476R2 11 14 19.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)* P0646R1 9 10 19.21* 12.0.0*
std::destroying_delete_t (FTM)* P0722R3 9 9 19.27* 11.0.3*
std::is_convertible (FTM)* P0758R1 9 9 19.23* 11.0.3*
Add std::shift_left/right to <algorithm> (FTM)* P0769R2 10 12 (partial)* 19.21* 13.0.0* (partial)*
Constexpr for std::swap() and swap related functions P0879R0 10 13 19.26* 13.1.6*
std::type_identity (FTM)* P0887R1 9 8 19.21* 10.0.1*
Concepts library (FTM)* P0898R3 10 13 19.23* 13.1.6*
constexpr comparison operators for std::array P1023R0 10 8 19.27* 10.0.1*
std::unwrap_ref_decay and std::unwrap_reference (FTM)* P0318R1 9 8 19.21* 10.0.1*
std::bind_front() (FTM)* P0356R5 9 13 19.25* 13.1.6*
std::reference_wrapper for incomplete types P0357R3 9 8 19.26* 10.0.1*
Fixing operator>>(basic_istream&, CharT*) P0487R1 11 8 19.23* 10.0.1*
Library support for char8_t (FTM)* P0482R6 9 8 (partial)
16
19.22* 10.0.1* (partial)
15.0.0*
Utility functions to implement uses-allocator construction P0591R4 9 16 19.29 (16.10)* 15.0.0*
DR17: std::variant and std::optional should propagate copy/move triviality P0602R4 8.3 8 19.11* 10.0.1*
DR17: A sane std::variant converting constructor P0608R3 10 9 19.29 (16.10)**
19.42**
11.0.3*
std::function's move constructor should be noexcept P0771R1 7.2 6 19.22* Yes
The One Ranges Proposal (FTM)* P0896R4 10 13 (partial)
15*
19.29 (16.10)* 14.0.3*
Heterogeneous lookup for unordered associative containers (FTM)* P0919R3
P1690R1
11 12 19.23* (P0919R3)
19.25* (P1690R1)
13.0.0*
<chrono> zero(), min(), and max() should be noexcept P0972R0 9 8 19.14* 10.0.1*
constexpr in std::pointer_traits (FTM)* P1006R1 9 8 19.26* 10.0.1*
std::assume_aligned() (FTM)* P1007R3 9*
11
15 19.28 (16.9)* 14.0.3*
Smart pointer creation with default initialization (e.g. make_unique_for_overwrite) (FTM)* P1020R1
P1973R1
11*
12*
16 19.28 (16.9)* 15.0.0*
Misc constexpr bits (FTM)* (FTM)* (FTM)* (FTM)* (FTM)* (FTM)* P1032R1 10 13 19.28 (16.8)* 13.1.6*
Remove comparison operators of std::span P1085R2 10 8 19.26* 10.0.1*
Make stateful allocator propagation more consistent for operator+(basic_string) P1165R1 10 15 19.26* 14.0.3*
Consistent container erasure, e.g. std::erase(std::vector), or std::erase_if(std::map) (FTM)* P1209R0
P1115R3
9*
10*
8*
11*
19.25**
19.27**
10.0.1**
12.0.5**
Standard library header units P1502R1 11 19.29 (16.10)*
polymorphic_allocator<> as a vocabulary type (FTM)* P0339R6 9 16 19.28 (16.9)* 15.0.0*
std::execution::unseq (FTM)* P1001R2 9 17 19.28 (16.8)*
std::lerp() and std::midpoint() (FTM)* P0811R3 9 9 19.23* (partial)
19.28 (16.8)*
11.0.3*
Usability enhancements for std::span P1024R3 10 9*
14
19.26* 11.0.3*
DR17: Make std::create_directory() intuitive P1164R1 8.3 12 19.20* 13.0.0*
std::ssize() and unsigned extent for std::span (FTM)* P1227R2 10 9 19.25* 11.0.3*
Traits for (un)bounded arrays (FTM)* P1357R1 9 9 19.25* 11.0.3*
std::to_array() (FTM)* P0325R4 10 10 19.25* 12.0.0*
Efficient access to std::basic_stringbuf’s buffer P0408R7 11 17 19.29 (16.10)* 15.0.0*
Layout-compatibility and pointer-interconvertibility traits (FTM)* (FTM)* P0466R5 12 19.29 (16.10)**
Bit operations: std::

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

P0553R4 9 9 19.25**
19.28 (16.8)*
11.0.3*
Mathematical constants (FTM)* P0631R8 10 11 19.25* 12.0.5*
Text formatting (FTM)* P0645R10 13 14**
17
19.29 (16.10)* 15.0.0*
std::stop_token and std::jthread (FTM)* P0660R10 10 17
(partial)*

20*
19.28 (16.9)*
constexpr std::allocator and related utilities (FTM)* P0784R7 10 12 19.29 (16.10)* 13.0.0*
constexpr std::string (FTM)* P0426R1
P1032R1
P0980R1
12 15 19.29 (16.10)*
19.30**
14.0.3*
constexpr std::vector (FTM)* P1004R2 12 15 19.29 (16.10)*
19.30**
14.0.3*
Input range adaptors P1035R7 10 16 19.29 (16.10)* 15.0.0*
constexpr std::invoke() and related utilities P1065R2 10 12 19.28 (16.8)* 13.0.0*
Atomic waiting and notifying, std::counting_semaphore, std::latch and std::barrier (FTM)* (FTM)* (FTM)* (FTM)* (FTM)* (FTM)* P1135R6 11 11 19.28 (16.9)* 13.1.6*
std::source_location (FTM)* P1208R6 11 15*
(partial)
16
19.29 (16.10)* 15.0.0*
Adding <=> to the standard library P1614R2 10 14*
(partial)
17*
(partial)
19
19.29 (16.10)* 13.1.6* (partial)
constexpr default constructor of std::atomic and std::atomic_flag (FTM)* P0883R2 10 13 19.26* 13.1.6*
constexpr for numeric algorithms (FTM)* P1645R1 10 12 19.26* 13.0.0*
Safe integral comparisons (FTM)* P0586R2 10 13 19.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 number nn after "DR" denotes target C++ revision the Defect Report is applied to, e.g., DR20 → C++20.

External links

1. C++20 - Wikipedia
2. Working C++20 examples

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/20

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API