From Jason Turner

[support]

Large diff (129.1 KB) - rendering may be slow on some devices

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpr10t1bgl/{from.md → to.md} +953 -388
tmp/tmpr10t1bgl/{from.md → to.md} RENAMED
@@ -9,25 +9,27 @@ declare these function signatures and define any related types.
9
 
10
  The following subclauses describe common type definitions used
11
  throughout the library, characteristics of the predefined types,
12
  functions supporting start and termination of a C++ program, support for
13
  dynamic memory management, support for dynamic type identification,
14
- support for exception processing, support for initializer lists, and
15
- other runtime support, as summarized in [[support.summary]].
 
16
 
17
  **Table: Language support library summary** <a id="support.summary">[support.summary]</a>
18
 
19
  | Subclause | | Header |
20
- | ----------------------- | ------------------------- | -------------------------------------------------- |
21
  | [[support.types]] | Common definitions | `<cstddef>`, `<cstdlib>` |
22
  | [[support.limits]] | Implementation properties | `<cfloat>`, `<climits>`, `<limits>`, `<version>` |
23
  | [[support.arith.types]] | Arithmetic types | `<cstdint>`, `<stdfloat>` |
24
  | [[support.start.term]] | Start and termination | `<cstdlib>` |
25
  | [[support.dynamic]] | Dynamic memory management | `<new>` |
26
- | [[support.rtti]] | Type identification | `<typeinfo>` |
27
  | [[support.srcloc]] | Source location | `<source_location>` |
28
  | [[support.exception]] | Exception handling | `<exception>` |
 
29
  | [[support.initlist]] | Initializer lists | `<initializer_list>` |
30
  | [[cmp]] | Comparisons | `<compare>` |
31
  | [[support.coroutine]] | Coroutines | `<coroutine>` |
32
  | [[support.runtime]] | Other runtime support | `<csetjmp>`, `<csignal>`, `<cstdarg>`, `<cstdlib>` |
33
 
@@ -70,29 +72,30 @@ namespace std {
70
  #define offsetof(P, D) see below
71
  ```
72
 
73
  The contents and meaning of the header `<cstddef>` are the same as the C
74
  standard library header `<stddef.h>`, except that it does not declare
75
- the type `wchar_t`, that it also declares the type `byte` and its
76
- associated operations [[support.types.byteops]], and as noted in
77
- [[support.types.nullptr]] and [[support.types.layout]].
 
78
 
79
- See also: ISO C 7.19
80
 
81
  ### Header `<cstdlib>` synopsis <a id="cstdlib.syn">[[cstdlib.syn]]</a>
82
 
83
  ``` cpp
84
  namespace std {
85
  using size_t = see below; // freestanding
86
- using div_t = see below;
87
- using ldiv_t = see below;
88
- using lldiv_t = see below;
89
  }
90
 
91
  #define NULL see below // freestanding
92
- #define EXIT_FAILURE see below
93
- #define EXIT_SUCCESS see below
94
  #define RAND_MAX see below
95
  #define MB_CUR_MAX see below
96
 
97
  namespace std {
98
  // Exposition-only function type aliases
@@ -116,18 +119,24 @@ namespace std {
116
 
117
  // [c.malloc], C library memory allocation
118
  void* aligned_alloc(size_t alignment, size_t size);
119
  void* calloc(size_t nmemb, size_t size);
120
  void free(void* ptr);
 
 
121
  void* malloc(size_t size);
122
  void* realloc(void* ptr, size_t size);
 
123
 
124
  double atof(const char* nptr);
125
  int atoi(const char* nptr);
126
  long int atol(const char* nptr);
127
  long long int atoll(const char* nptr);
128
  double strtod(const char* nptr, char** endptr);
 
 
 
129
  float strtof(const char* nptr, char** endptr);
130
  long double strtold(const char* nptr, char** endptr);
131
  long int strtol(const char* nptr, char** endptr, int base);
132
  long long int strtoll(const char* nptr, char** endptr, int base);
133
  unsigned long int strtoul(const char* nptr, char** endptr, int base);
@@ -139,49 +148,54 @@ namespace std {
139
  int wctomb(char* s, wchar_t wchar);
140
  size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n);
141
  size_t wcstombs(char* s, const wchar_t* pwcs, size_t n);
142
 
143
  // [alg.c.library], C standard library algorithms
144
- void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
145
  c-compare-pred* compar);
146
- void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
147
  compare-pred* compar);
148
- void qsort(void* base, size_t nmemb, size_t size, c-compare-pred* compar);
149
- void qsort(void* base, size_t nmemb, size_t size, compare-pred* compar);
 
 
 
 
150
 
151
  // [c.math.rand], low-quality random number generation
152
  int rand();
153
  void srand(unsigned int seed);
154
 
155
  // [c.math.abs], absolute values
156
- constexpr int abs(int j);
157
- constexpr long int abs(long int j);
158
- constexpr long long int abs(long long int j);
159
- constexpr floating-point-type abs(floating-point-type j);
160
 
161
- constexpr long int labs(long int j);
162
- constexpr long long int llabs(long long int j);
163
 
164
- constexpr div_t div(int numer, int denom);
165
- constexpr ldiv_t div(long int numer, long int denom); // see [library.c]
166
- constexpr lldiv_t div(long long int numer, long long int denom); // see [library.c]
167
- constexpr ldiv_t ldiv(long int numer, long int denom);
168
- constexpr lldiv_t lldiv(long long int numer, long long int denom);
169
  }
170
  ```
171
 
172
  The contents and meaning of the header `<cstdlib>` are the same as the C
173
  standard library header `<stdlib.h>`, except that it does not declare
174
- the type `wchar_t`, and except as noted in [[support.types.nullptr]],
 
175
  [[support.types.layout]], [[support.start.term]], [[c.malloc]],
176
  [[c.mb.wcs]], [[alg.c.library]], [[c.math.rand]], and [[c.math.abs]].
177
 
178
  [*Note 1*: Several functions have additional overloads in this
179
  document, but they have the same behavior as in the C standard library
180
  [[library.c]]. — *end note*]
181
 
182
- See also: ISO C 7.22
183
 
184
  ### Null pointers <a id="support.types.nullptr">[[support.types.nullptr]]</a>
185
 
186
  The type `nullptr_t` is a synonym for the type of a `nullptr`
187
  expression, and it has the characteristics described in 
@@ -192,11 +206,11 @@ another `nullptr_t` object that is an lvalue can be
192
  taken. — *end note*]
193
 
194
  The macro `NULL` is an *implementation-defined* null pointer
195
  constant.[^1]
196
 
197
- See also: ISO C 7.19
198
 
199
  ### Sizes, alignments, and offsets <a id="support.types.layout">[[support.types.layout]]</a>
200
 
201
  The macro `offsetof(type, member-designator)` has the same semantics as
202
  the corresponding macro in the C standard library header `<stddef.h>`,
@@ -223,15 +237,17 @@ that is large enough to contain the size in bytes of any object
223
  *Recommended practice:* An implementation should choose types for
224
  `ptrdiff_t` and `size_t` whose integer conversion ranks [[conv.rank]]
225
  are no greater than that of `signed long int` unless a larger size is
226
  necessary to contain all the possible values.
227
 
228
- The type `max_align_t` is a trivial standard-layout type whose alignment
229
- requirement is at least as great as that of every scalar type, and whose
230
- alignment requirement is supported in every context [[basic.align]].
 
 
231
 
232
- See also: ISO C 7.19
233
 
234
  ### `byte` type operations <a id="support.types.byteops">[[support.types.byteops]]</a>
235
 
236
  ``` cpp
237
  template<class IntType>
@@ -359,217 +375,362 @@ about the C++ standard library (e.g., version number and release date).
359
 
360
  Each of the macros defined in `<version>` is also defined after
361
  inclusion of any member of the set of library headers indicated in the
362
  corresponding comment in this synopsis.
363
 
364
- [*Note 1*: Future revisions of C++ might replace the values of these
365
- macros with greater values. — *end note*]
366
 
367
  ``` cpp
368
- #define __cpp_lib_addressof_constexpr 201603L // also in <memory>
 
 
 
369
  #define __cpp_lib_algorithm_iterator_requirements 202207L
370
  // also in <algorithm>, <numeric>, <memory>
 
371
  #define __cpp_lib_allocate_at_least 202302L // also in <memory>
372
  #define __cpp_lib_allocator_traits_is_always_equal 201411L
373
- // also in <memory>, <scoped_allocator>, <string>, <deque>, <forward_list>, <list>, <vector>,
374
- // <map>, <set>, <unordered_map>, <unordered_set>
375
- #define __cpp_lib_adaptor_iterator_pair_constructor 202106L // also in <stack>, <queue>
376
  #define __cpp_lib_any 201606L // also in <any>
377
- #define __cpp_lib_apply 201603L // also in <tuple>
378
  #define __cpp_lib_array_constexpr 201811L // also in <iterator>, <array>
379
- #define __cpp_lib_as_const 201510L // also in <utility>
380
  #define __cpp_lib_associative_heterogeneous_erasure 202110L
381
  // also in <map>, <set>, <unordered_map>, <unordered_set>
382
- #define __cpp_lib_assume_aligned 201811L // also in <memory>
383
- #define __cpp_lib_atomic_flag_test 201907L // also in <atomic>
384
- #define __cpp_lib_atomic_float 201711L // also in <atomic>
385
- #define __cpp_lib_atomic_is_always_lock_free 201603L // also in <atomic>
 
 
386
  #define __cpp_lib_atomic_lock_free_type_aliases 201907L // also in <atomic>
387
- #define __cpp_lib_atomic_ref 201806L // also in <atomic>
 
 
388
  #define __cpp_lib_atomic_shared_ptr 201711L // also in <memory>
389
- #define __cpp_lib_atomic_value_initialization 201911L // also in <atomic>, <memory>
390
- #define __cpp_lib_atomic_wait 201907L // also in <atomic>
391
  #define __cpp_lib_barrier 202302L // also in <barrier>
392
- #define __cpp_lib_bind_back 202202L // also in <functional>
393
- #define __cpp_lib_bind_front 201907L // also in <functional>
394
- #define __cpp_lib_bit_cast 201806L // also in <bit>
395
- #define __cpp_lib_bitops 201907L // also in <bit>
396
- #define __cpp_lib_bool_constant 201505L // also in <type_traits>
397
- #define __cpp_lib_bounded_array_traits 201902L // also in <type_traits>
 
398
  #define __cpp_lib_boyer_moore_searcher 201603L // also in <functional>
399
- #define __cpp_lib_byte 201603L // also in <cstddef>
400
- #define __cpp_lib_byteswap 202110L // also in <bit>
401
  #define __cpp_lib_char8_t 201907L
402
- // also in <atomic>, <filesystem>, <istream>, <limits>, <locale>, <ostream>, <string>, <string_view>
403
- #define __cpp_lib_chrono 201907L // also in <chrono>
 
404
  #define __cpp_lib_chrono_udls 201304L // also in <chrono>
405
  #define __cpp_lib_clamp 201603L // also in <algorithm>
406
- #define __cpp_lib_common_reference 202302L // also in <type_traits>
407
- #define __cpp_lib_common_reference_wrapper 202302L // also in <functional>
408
  #define __cpp_lib_complex_udls 201309L // also in <complex>
409
- #define __cpp_lib_concepts 202207L // also in <concepts>, <compare>
410
- #define __cpp_lib_constexpr_algorithms 201806L // also in <algorithm>, <utility>
 
 
 
411
  #define __cpp_lib_constexpr_bitset 202207L // also in <bitset>
412
- #define __cpp_lib_constexpr_charconv 202207L // also in <charconv>
413
- #define __cpp_lib_constexpr_cmath 202202L // also in <cmath>, <cstdlib>
414
- #define __cpp_lib_constexpr_complex 201711L // also in <complex>
 
415
  #define __cpp_lib_constexpr_dynamic_alloc 201907L // also in <memory>
416
- #define __cpp_lib_constexpr_functional 201907L // also in <functional>
417
- #define __cpp_lib_constexpr_iterator 201811L // also in <iterator>
418
- #define __cpp_lib_constexpr_memory 202202L // also in <memory>
 
 
 
 
 
 
 
 
 
419
  #define __cpp_lib_constexpr_numeric 201911L // also in <numeric>
 
 
 
420
  #define __cpp_lib_constexpr_string 201907L // also in <string>
421
  #define __cpp_lib_constexpr_string_view 201811L // also in <string_view>
422
- #define __cpp_lib_constexpr_tuple 201811L // also in <tuple>
423
- #define __cpp_lib_constexpr_typeinfo 202106L // also in <typeinfo>
424
- #define __cpp_lib_constexpr_utility 201811L // also in <utility>
 
 
425
  #define __cpp_lib_constexpr_vector 201907L // also in <vector>
 
 
426
  #define __cpp_lib_containers_ranges 202202L
427
  // also in <vector>, <list>, <forward_list>, <map>, <set>, <unordered_map>, <unordered_set>,
428
  // <deque>, <queue>, <stack>, <string>
429
- #define __cpp_lib_coroutine 201902L // also in <coroutine>
430
- #define __cpp_lib_destroying_delete 201806L // also in <new>
 
 
 
 
 
431
  #define __cpp_lib_enable_shared_from_this 201603L // also in <memory>
432
- #define __cpp_lib_endian 201907L // also in <bit>
433
  #define __cpp_lib_erase_if 202002L
434
  // also in <string>, <deque>, <forward_list>, <list>, <vector>, <map>, <set>, <unordered_map>,
435
  // <unordered_set>
436
- #define __cpp_lib_exchange_function 201304L // also in <utility>
 
437
  #define __cpp_lib_execution 201902L // also in <execution>
438
  #define __cpp_lib_expected 202211L // also in <expected>
439
  #define __cpp_lib_filesystem 201703L // also in <filesystem>
440
  #define __cpp_lib_flat_map 202207L // also in <flat_map>
441
  #define __cpp_lib_flat_set 202207L // also in <flat_set>
442
- #define __cpp_lib_format 202207L // also in <format>
 
443
  #define __cpp_lib_format_ranges 202207L // also in <format>
 
444
  #define __cpp_lib_formatters 202302L // also in <stacktrace>, <thread>
445
- #define __cpp_lib_forward_like 202207L // also in <utility>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446
  #define __cpp_lib_gcd_lcm 201606L // also in <numeric>
447
  #define __cpp_lib_generator 202207L // also in <generator>
448
  #define __cpp_lib_generic_associative_lookup 201304L // also in <map>, <set>
449
  #define __cpp_lib_generic_unordered_lookup 201811L
450
  // also in <unordered_map>, <unordered_set>
451
- #define __cpp_lib_hardware_interference_size 201703L // also in <new>
452
- #define __cpp_lib_has_unique_object_representations 201606L // also in <type_traits>
 
 
453
  #define __cpp_lib_hypot 201603L // also in <cmath>
454
  #define __cpp_lib_incomplete_container_elements 201505L
455
  // also in <forward_list>, <list>, <vector>
456
- #define __cpp_lib_int_pow2 202002L // also in <bit>
 
 
457
  #define __cpp_lib_integer_comparison_functions 202002L // also in <utility>
458
- #define __cpp_lib_integer_sequence 201304L // also in <utility>
459
- #define __cpp_lib_integral_constant_callable 201304L // also in <type_traits>
460
  #define __cpp_lib_interpolate 201902L // also in <cmath>, <numeric>
461
- #define __cpp_lib_invoke 201411L // also in <functional>
462
- #define __cpp_lib_invoke_r 202106L // also in <functional>
463
  #define __cpp_lib_ios_noreplace 202207L // also in <ios>
464
- #define __cpp_lib_is_aggregate 201703L // also in <type_traits>
465
- #define __cpp_lib_is_constant_evaluated 201811L // also in <type_traits>
466
- #define __cpp_lib_is_final 201402L // also in <type_traits>
467
- #define __cpp_lib_is_implicit_lifetime 202302L // also in <type_traits>
468
- #define __cpp_lib_is_invocable 201703L // also in <type_traits>
469
- #define __cpp_lib_is_layout_compatible 201907L // also in <type_traits>
470
- #define __cpp_lib_is_nothrow_convertible 201806L // also in <type_traits>
471
- #define __cpp_lib_is_null_pointer 201309L // also in <type_traits>
472
- #define __cpp_lib_is_pointer_interconvertible 201907L // also in <type_traits>
473
- #define __cpp_lib_is_scoped_enum 202011L // also in <type_traits>
474
- #define __cpp_lib_is_swappable 201603L // also in <type_traits>
 
 
 
475
  #define __cpp_lib_jthread 201911L // also in <stop_token>, <thread>
476
  #define __cpp_lib_latch 201907L // also in <latch>
477
- #define __cpp_lib_launder 201606L // also in <new>
 
478
  #define __cpp_lib_list_remove_return_type 201806L // also in <forward_list>, <list>
479
- #define __cpp_lib_logical_traits 201510L // also in <type_traits>
480
- #define __cpp_lib_make_from_tuple 201606L // also in <tuple>
481
- #define __cpp_lib_make_reverse_iterator 201402L // also in <iterator>
482
  #define __cpp_lib_make_unique 201304L // also in <memory>
483
  #define __cpp_lib_map_try_emplace 201411L // also in <map>
484
  #define __cpp_lib_math_constants 201907L // also in <numbers>
485
  #define __cpp_lib_math_special_functions 201603L // also in <cmath>
486
- #define __cpp_lib_mdspan 202207L // also in <mdspan>
487
  #define __cpp_lib_memory_resource 201603L // also in <memory_resource>
488
- #define __cpp_lib_modules 202207L
489
- #define __cpp_lib_move_iterator_concept 202207L // also in <iterator>
490
  #define __cpp_lib_move_only_function 202110L // also in <functional>
491
  #define __cpp_lib_node_extract 201606L
492
  // also in <map>, <set>, <unordered_map>, <unordered_set>
493
  #define __cpp_lib_nonmember_container_access 201411L
494
- // also in <array>, <deque>, <forward_list>, <iterator>, <list>, <map>, <regex>, <set>, <string>,
495
- // <unordered_map>, <unordered_set>, <vector>
496
- #define __cpp_lib_not_fn 201603L // also in <functional>
497
- #define __cpp_lib_null_iterators 201304L // also in <iterator>
498
- #define __cpp_lib_optional 202110L // also in <optional>
499
- #define __cpp_lib_out_ptr 202106L // also in <memory>
500
- #define __cpp_lib_parallel_algorithm 201603L // also in <algorithm>, <numeric>
 
 
 
 
 
 
501
  #define __cpp_lib_polymorphic_allocator 201902L // also in <memory_resource>
502
- #define __cpp_lib_print 202207L // also in <print>, <ostream>
503
  #define __cpp_lib_quoted_string_io 201304L // also in <iomanip>
504
- #define __cpp_lib_ranges 202302L
505
  // also in <algorithm>, <functional>, <iterator>, <memory>, <ranges>
506
- #define __cpp_lib_ranges_as_const 202207L // also in <ranges>
507
- #define __cpp_lib_ranges_as_rvalue 202207L // also in <ranges>
508
- #define __cpp_lib_ranges_cartesian_product 202207L // also in <ranges>
509
- #define __cpp_lib_ranges_chunk 202202L // also in <ranges>
510
- #define __cpp_lib_ranges_chunk_by 202202L // also in <ranges>
 
 
511
  #define __cpp_lib_ranges_contains 202207L // also in <algorithm>
512
- #define __cpp_lib_ranges_enumerate 202302L // also in <ranges>, <version>
513
  #define __cpp_lib_ranges_find_last 202207L // also in <algorithm>
514
  #define __cpp_lib_ranges_fold 202207L // also in <algorithm>
 
 
515
  #define __cpp_lib_ranges_iota 202202L // also in <numeric>
516
- #define __cpp_lib_ranges_join_with 202202L // also in <ranges>
517
- #define __cpp_lib_ranges_repeat 202207L // also in <ranges>
518
- #define __cpp_lib_ranges_slide 202202L // also in <ranges>
 
519
  #define __cpp_lib_ranges_starts_ends_with 202106L // also in <algorithm>
520
- #define __cpp_lib_ranges_stride 202207L // also in <ranges>
521
- #define __cpp_lib_ranges_to_container 202202L // also in <ranges>
522
- #define __cpp_lib_ranges_zip 202110L // also in <ranges>, <tuple>, <utility>
523
- #define __cpp_lib_raw_memory_algorithms 201606L // also in <memory>
524
- #define __cpp_lib_reference_from_temporary 202202L // also in <type_traits>
525
- #define __cpp_lib_remove_cvref 201711L // also in <type_traits>
526
- #define __cpp_lib_result_of_sfinae 201210L // also in <functional>, <type_traits>
 
 
 
 
 
 
 
527
  #define __cpp_lib_robust_nonmodifying_seq_ops 201304L // also in <algorithm>
528
  #define __cpp_lib_sample 201603L // also in <algorithm>
 
529
  #define __cpp_lib_scoped_lock 201703L // also in <mutex>
530
  #define __cpp_lib_semaphore 201907L // also in <semaphore>
 
531
  #define __cpp_lib_shared_mutex 201505L // also in <shared_mutex>
532
  #define __cpp_lib_shared_ptr_arrays 201707L // also in <memory>
533
  #define __cpp_lib_shared_ptr_weak_type 201606L // also in <memory>
534
  #define __cpp_lib_shared_timed_mutex 201402L // also in <shared_mutex>
535
  #define __cpp_lib_shift 202202L // also in <algorithm>
 
 
 
536
  #define __cpp_lib_smart_ptr_for_overwrite 202002L // also in <memory>
537
- #define __cpp_lib_source_location 201907L // also in <source_location>
538
- #define __cpp_lib_span 202002L // also in <span>
 
 
539
  #define __cpp_lib_spanstream 202106L // also in <spanstream>
540
- #define __cpp_lib_ssize 201902L // also in <iterator>
 
541
  #define __cpp_lib_stacktrace 202011L // also in <stacktrace>
542
- #define __cpp_lib_start_lifetime_as 202207L // also in <memory>
543
  #define __cpp_lib_starts_ends_with 201711L // also in <string>, <string_view>
544
  #define __cpp_lib_stdatomic_h 202011L // also in <stdatomic.h>
545
  #define __cpp_lib_string_contains 202011L // also in <string>, <string_view>
546
  #define __cpp_lib_string_resize_and_overwrite 202110L // also in <string>
 
547
  #define __cpp_lib_string_udls 201304L // also in <string>
548
- #define __cpp_lib_string_view 201803L // also in <string>, <string_view>
 
549
  #define __cpp_lib_syncbuf 201803L // also in <syncstream>
550
- #define __cpp_lib_three_way_comparison 201907L // also in <compare>
551
- #define __cpp_lib_to_address 201711L // also in <memory>
552
- #define __cpp_lib_to_array 201907L // also in <array>
553
- #define __cpp_lib_to_chars 201611L // also in <charconv>
554
- #define __cpp_lib_to_underlying 202102L // also in <utility>
555
- #define __cpp_lib_transformation_trait_aliases 201304L // also in <type_traits>
556
- #define __cpp_lib_transparent_operators 201510L // also in <memory>, <functional>
557
- #define __cpp_lib_tuple_like 202207L
 
 
 
 
 
 
 
558
  // also in <utility>, <tuple>, <map>, <unordered_map>
559
- #define __cpp_lib_tuple_element_t 201402L // also in <tuple>
560
- #define __cpp_lib_tuples_by_type 201304L // also in <utility>, <tuple>
561
- #define __cpp_lib_type_identity 201806L // also in <type_traits>
562
- #define __cpp_lib_type_trait_variable_templates 201510L // also in <type_traits>
563
- #define __cpp_lib_uncaught_exceptions 201411L // also in <exception>
564
  #define __cpp_lib_unordered_map_try_emplace 201411L // also in <unordered_map>
565
- #define __cpp_lib_unreachable 202202L // also in <utility>
566
- #define __cpp_lib_unwrap_ref 201811L // also in <type_traits>
567
- #define __cpp_lib_variant 202106L // also in <variant>
568
- #define __cpp_lib_void_t 201411L // also in <type_traits>
569
  ```
570
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  ### Header `<limits>` synopsis <a id="limits.syn">[[limits.syn]]</a>
572
 
573
  ``` cpp
574
  // all freestanding
575
  namespace std {
@@ -710,10 +871,13 @@ not have specializations.
710
  #### `numeric_limits` members <a id="numeric.limits.members">[[numeric.limits.members]]</a>
711
 
712
  Each member function defined in this subclause is signal-safe
713
  [[support.signal]].
714
 
 
 
 
715
  ``` cpp
716
  static constexpr T min() noexcept;
717
  ```
718
 
719
  Minimum finite value.[^3]
@@ -748,11 +912,11 @@ static constexpr int digits;
748
  Number of `radix` digits that can be represented without change.
749
 
750
  For integer types, the number of non-sign bits in the representation.
751
 
752
  For floating-point types, the number of `radix` digits in the
753
- mantissa.[^6]
754
 
755
  ``` cpp
756
  static constexpr int digits10;
757
  ```
758
 
@@ -929,11 +1093,11 @@ Meaningful for all floating-point types.
929
 
930
  ``` cpp
931
  static constexpr bool is_iec559;
932
  ```
933
 
934
- `true` if and only if the type adheres to ISO/IEC/IEEE 60559.[^22]
935
 
936
  [*Note 1*: The value is `true` for any of the types `float16_t`,
937
  `float32_t`, `float64_t`, or `float128_t`, if
938
  present [[basic.extended.fp]]. — *end note*]
939
 
@@ -1101,11 +1265,23 @@ namespace std {
1101
 
1102
  ### Header `<climits>` synopsis <a id="climits.syn">[[climits.syn]]</a>
1103
 
1104
  ``` cpp
1105
  // all freestanding
 
1106
  #define CHAR_BIT see below
 
 
 
 
 
 
 
 
 
 
 
1107
  #define SCHAR_MIN see below
1108
  #define SCHAR_MAX see below
1109
  #define UCHAR_MAX see below
1110
  #define CHAR_MIN see below
1111
  #define CHAR_MAX see below
@@ -1123,35 +1299,39 @@ namespace std {
1123
  #define LLONG_MAX see below
1124
  #define ULLONG_MAX see below
1125
  ```
1126
 
1127
  The header `<climits>` defines all macros the same as the C standard
1128
- library header `<limits.h>`.
 
1129
 
1130
- [*Note 1*: Except for `CHAR_BIT` and `MB_LEN_MAX`, a macro referring to
1131
- an integer type `T` defines a constant whose type is the promoted type
1132
- of `T` [[conv.prom]]. — *end note*]
1133
 
1134
- See also: ISO C 5.2.4.2.1
1135
 
1136
  ### Header `<cfloat>` synopsis <a id="cfloat.syn">[[cfloat.syn]]</a>
1137
 
1138
  ``` cpp
1139
  // all freestanding
 
 
1140
  #define FLT_ROUNDS see below
1141
  #define FLT_EVAL_METHOD see below
1142
- #define FLT_HAS_SUBNORM see below
1143
- #define DBL_HAS_SUBNORM see below
1144
- #define LDBL_HAS_SUBNORM see below
1145
  #define FLT_RADIX see below
 
 
 
 
 
1146
  #define FLT_MANT_DIG see below
1147
  #define DBL_MANT_DIG see below
1148
  #define LDBL_MANT_DIG see below
1149
  #define FLT_DECIMAL_DIG see below
1150
  #define DBL_DECIMAL_DIG see below
1151
  #define LDBL_DECIMAL_DIG see below
1152
- #define DECIMAL_DIG see below
1153
  #define FLT_DIG see below
1154
  #define DBL_DIG see below
1155
  #define LDBL_DIG see below
1156
  #define FLT_MIN_EXP see below
1157
  #define DBL_MIN_EXP see below
@@ -1180,21 +1360,23 @@ See also: ISO C 5.2.4.2.1
1180
  ```
1181
 
1182
  The header `<cfloat>` defines all macros the same as the C standard
1183
  library header `<float.h>`.
1184
 
1185
- See also: ISO C 5.2.4.2.2
1186
 
1187
  ## Arithmetic types <a id="support.arith.types">[[support.arith.types]]</a>
1188
 
1189
  ### Header `<cstdint>` synopsis <a id="cstdint.syn">[[cstdint.syn]]</a>
1190
 
1191
  The header `<cstdint>` supplies integer types having specified widths,
1192
  and macros that specify limits of integer types.
1193
 
1194
  ``` cpp
1195
  // all freestanding
 
 
1196
  namespace std {
1197
  using int8_t = signed integer type; // optional
1198
  using int16_t = signed integer type; // optional
1199
  using int32_t = signed integer type; // optional
1200
  using int64_t = signed integer type; // optional
@@ -1238,50 +1420,68 @@ namespace std {
1238
  }
1239
 
1240
  #define INTN_MIN see below
1241
  #define INTN_MAX see below
1242
  #define UINTN_MAX see below
 
 
1243
 
1244
  #define INT_FASTN_MIN see below
1245
  #define INT_FASTN_MAX see below
1246
  #define UINT_FASTN_MAX see below
 
 
1247
 
1248
  #define INT_LEASTN_MIN see below
1249
  #define INT_LEASTN_MAX see below
1250
  #define UINT_LEASTN_MAX see below
 
 
1251
 
1252
  #define INTMAX_MIN see below
1253
  #define INTMAX_MAX see below
1254
  #define UINTMAX_MAX see below
 
 
1255
 
1256
  #define INTPTR_MIN see below // optional
1257
  #define INTPTR_MAX see below // optional
1258
  #define UINTPTR_MAX see below // optional
 
 
1259
 
1260
  #define PTRDIFF_MIN see below
1261
  #define PTRDIFF_MAX see below
 
1262
  #define SIZE_MAX see below
 
1263
 
1264
  #define SIG_ATOMIC_MIN see below
1265
  #define SIG_ATOMIC_MAX see below
 
1266
 
1267
  #define WCHAR_MIN see below
1268
  #define WCHAR_MAX see below
 
1269
 
1270
  #define WINT_MIN see below
1271
  #define WINT_MAX see below
 
1272
 
1273
  #define INTN_C(value) see below
1274
  #define UINTN_C(value) see below
1275
  #define INTMAX_C(value) see below
1276
  #define UINTMAX_C(value) see below
1277
  ```
1278
 
1279
  The header defines all types and macros the same as the C standard
1280
- library header `<stdint.h>`.
 
 
 
1281
 
1282
- See also: ISO C 7.20
1283
 
1284
  All types that use the placeholder *N* are optional when *N* is not `8`,
1285
  `16`, `32`, or `64`. The exact-width types `intN_t` and `uintN_t` for
1286
  *N* = `8`, `16`, `32`, and `64` are also optional; however, if an
1287
  implementation defines integer types with the corresponding width and no
@@ -1329,11 +1529,11 @@ this subclause. — *end note*]
1329
 
1330
  *Effects:* This function has the semantics specified in the C standard
1331
  library.
1332
 
1333
  *Remarks:* The program is terminated without executing destructors for
1334
- objects of automatic, thread, or static storage duration and without
1335
  calling functions passed to `atexit()` [[basic.start.term]]. The
1336
  function `_Exit` is signal-safe [[support.signal]].
1337
 
1338
  ``` cpp
1339
  [[noreturn]] void abort() noexcept;
@@ -1437,11 +1637,11 @@ After calling registered functions, `quick_exit` shall call
1437
  `_Exit(status)`.
1438
 
1439
  *Remarks:* The function `quick_exit` is signal-safe [[support.signal]]
1440
  when the functions registered with `at_quick_exit` are.
1441
 
1442
- See also: ISO C 7.22.4
1443
 
1444
  ## Dynamic memory management <a id="support.dynamic">[[support.dynamic]]</a>
1445
 
1446
  ### General <a id="support.dynamic.general">[[support.dynamic.general]]</a>
1447
 
@@ -1477,46 +1677,45 @@ namespace std {
1477
  using new_handler = void (*)();
1478
  new_handler get_new_handler() noexcept;
1479
  new_handler set_new_handler(new_handler new_p) noexcept;
1480
 
1481
  // [ptr.launder], pointer optimization barrier
1482
- template<class T> [[nodiscard]] constexpr T* launder(T* p) noexcept;
1483
 
1484
  // [hardware.interference], hardware interference size
1485
  inline constexpr size_t hardware_destructive_interference_size = implementation-defined{};
1486
  inline constexpr size_t hardware_constructive_interference_size = implementation-defined{};
1487
  }
1488
 
1489
  // [new.delete], storage allocation and deallocation
1490
- [[nodiscard]] void* operator new(std::size_t size);
1491
- [[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignment);
1492
- [[nodiscard]] void* operator new(std::size_t size, const std::nothrow_t&) noexcept;
1493
- [[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignment,
1494
- const std::nothrow_t&) noexcept;
1495
 
1496
  void operator delete(void* ptr) noexcept;
1497
  void operator delete(void* ptr, std::size_t size) noexcept;
1498
  void operator delete(void* ptr, std::align_val_t alignment) noexcept;
1499
  void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
1500
  void operator delete(void* ptr, const std::nothrow_t&) noexcept;
1501
  void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
1502
 
1503
- [[nodiscard]] void* operator new[](std::size_t size);
1504
- [[nodiscard]] void* operator new[](std::size_t size, std::align_val_t alignment);
1505
- [[nodiscard]] void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
1506
- [[nodiscard]] void* operator new[](std::size_t size, std::align_val_t alignment,
1507
  const std::nothrow_t&) noexcept;
1508
 
1509
  void operator delete[](void* ptr) noexcept;
1510
  void operator delete[](void* ptr, std::size_t size) noexcept;
1511
  void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
1512
  void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
1513
  void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
1514
  void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
1515
 
1516
- [[nodiscard]] void* operator new (std::size_t size, void* ptr) noexcept;
1517
- [[nodiscard]] void* operator new[](std::size_t size, void* ptr) noexcept;
1518
  void operator delete (void* ptr, void*) noexcept;
1519
  void operator delete[](void* ptr, void*) noexcept;
1520
  ```
1521
 
1522
  ### Storage allocation and deallocation <a id="new.delete">[[new.delete]]</a>
@@ -1527,26 +1726,37 @@ Except where otherwise specified, the provisions of 
1527
  [[basic.stc.dynamic]] apply to the library versions of `operator new`
1528
  and `operator
1529
  delete`. If the value of an alignment argument passed to any of these
1530
  functions is not a valid alignment value, the behavior is undefined.
1531
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1532
  #### Single-object forms <a id="new.delete.single">[[new.delete.single]]</a>
1533
 
1534
  ``` cpp
1535
- [[nodiscard]] void* operator new(std::size_t size);
1536
- [[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignment);
1537
  ```
1538
 
1539
  *Effects:* The allocation functions [[basic.stc.dynamic.allocation]]
1540
  called by a *new-expression*[[expr.new]] to allocate `size` bytes of
1541
  storage. The second form is called for a type with new-extended
1542
  alignment, and the first form is called otherwise.
1543
 
1544
- *Replaceable:* A C++ program may define functions with either of these
1545
- function signatures, and thereby displace the default versions defined
1546
- by the C++ standard library.
1547
-
1548
  *Required behavior:* Return a non-null pointer to suitably aligned
1549
  storage [[basic.stc.dynamic]], or else throw a `bad_alloc` exception.
1550
  This requirement is binding on any replacement versions of these
1551
  functions.
1552
 
@@ -1563,24 +1773,21 @@ functions.
1563
  function [[new.handler]]. If the called function returns, the loop
1564
  repeats.
1565
  - The loop terminates when an attempt to allocate the requested storage
1566
  is successful or when a called `new_handler` function does not return.
1567
 
 
 
1568
  ``` cpp
1569
- [[nodiscard]] void* operator new(std::size_t size, const std::nothrow_t&) noexcept;
1570
- [[nodiscard]] void* operator new(std::size_t size, std::align_val_t alignment,
1571
- const std::nothrow_t&) noexcept;
1572
  ```
1573
 
1574
  *Effects:* Same as above, except that these are called by a placement
1575
  version of a *new-expression* when a C++ program prefers a null pointer
1576
  result as an error indication, instead of a `bad_alloc` exception.
1577
 
1578
- *Replaceable:* A C++ program may define functions with either of these
1579
- function signatures, and thereby displace the default versions defined
1580
- by the C++ standard library.
1581
-
1582
  *Required behavior:* Return a non-null pointer to suitably aligned
1583
  storage [[basic.stc.dynamic]], or else return a null pointer. Each of
1584
  these nothrow versions of `operator new` returns a pointer obtained as
1585
  if acquired from the (possibly replaced) corresponding non-placement
1586
  function. This requirement is binding on any replacement versions of
@@ -1598,10 +1805,12 @@ T* p1 = new T; // throws bad_alloc if it fails
1598
  T* p2 = new(nothrow) T; // returns nullptr if it fails
1599
  ```
1600
 
1601
  — *end example*]
1602
 
 
 
1603
  ``` cpp
1604
  void operator delete(void* ptr) noexcept;
1605
  void operator delete(void* ptr, std::size_t size) noexcept;
1606
  void operator delete(void* ptr, std::align_val_t alignment) noexcept;
1607
  void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
@@ -1622,46 +1831,43 @@ returned `ptr`.
1622
 
1623
  *Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
1624
  called by a *delete-expression*[[expr.delete]] to render the value of
1625
  `ptr` invalid.
1626
 
1627
- *Replaceable:* A C++ program may define functions with any of these
1628
- function signatures, and thereby displace the default versions defined
1629
- by the C++ standard library.
1630
-
1631
- If a function without a `size` parameter is defined, the program should
1632
- also define the corresponding function with a `size` parameter. If a
1633
- function with a `size` parameter is defined, the program shall also
1634
- define the corresponding version without the `size` parameter.
1635
-
1636
- [*Note 1*: The default behavior below might change in the future, which
1637
- will require replacing both deallocation functions when replacing the
1638
- allocation function. — *end note*]
1639
-
1640
  *Required behavior:* A call to an `operator delete` with a `size`
1641
  parameter may be changed to a call to the corresponding
1642
  `operator delete` without a `size` parameter, without affecting memory
1643
  allocation.
1644
 
1645
- [*Note 2*: A conforming implementation is for
1646
  `operator delete(void* ptr, std::size_t size)` to simply call
1647
  `operator delete(ptr)`. — *end note*]
1648
 
1649
  *Default behavior:* The functions that have a `size` parameter forward
1650
  their other parameters to the corresponding function without a `size`
1651
  parameter.
1652
 
1653
- [*Note 3*: See the note in the above *Replaceable:*
1654
  paragraph. — *end note*]
1655
 
1656
  *Default behavior:* If `ptr` is null, does nothing. Otherwise, reclaims
1657
  the storage allocated by the earlier call to `operator new`.
1658
 
1659
  *Remarks:* It is unspecified under what conditions part or all of such
1660
  reclaimed storage will be allocated by subsequent calls to
1661
  `operator new` or any of `aligned_alloc`, `calloc`, `malloc`, or
1662
- `realloc`, declared in `<cstdlib>`.
 
 
 
 
 
 
 
 
 
 
1663
 
1664
  ``` cpp
1665
  void operator delete(void* ptr, const std::nothrow_t&) noexcept;
1666
  void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
1667
  ```
@@ -1680,54 +1886,45 @@ allocation function that returned `ptr`.
1680
  *Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
1681
  called by the implementation to render the value of `ptr` invalid when
1682
  the constructor invoked from a nothrow placement version of the
1683
  *new-expression* throws an exception.
1684
 
1685
- *Replaceable:* A C++ program may define functions with either of these
1686
- function signatures, and thereby displace the default versions defined
1687
- by the C++ standard library.
1688
-
1689
  *Default behavior:* Calls `operator delete(ptr)`, or
1690
  `operator delete(ptr, alignment)`, respectively.
1691
 
 
 
1692
  #### Array forms <a id="new.delete.array">[[new.delete.array]]</a>
1693
 
1694
  ``` cpp
1695
- [[nodiscard]] void* operator new[](std::size_t size);
1696
- [[nodiscard]] void* operator new[](std::size_t size, std::align_val_t alignment);
1697
  ```
1698
 
1699
  *Effects:* The allocation functions [[basic.stc.dynamic.allocation]]
1700
  called by the array form of a *new-expression*[[expr.new]] to allocate
1701
  `size` bytes of storage. The second form is called for a type with
1702
  new-extended alignment, and the first form is called otherwise.[^31]
1703
 
1704
- *Replaceable:* A C++ program may define functions with either of these
1705
- function signatures, and thereby displace the default versions defined
1706
- by the C++ standard library.
1707
-
1708
  *Required behavior:* Same as for the corresponding single-object forms.
1709
  This requirement is binding on any replacement versions of these
1710
  functions.
1711
 
1712
  *Default behavior:* Returns `operator new(size)`, or
1713
  `operator new(size, alignment)`, respectively.
1714
 
 
 
1715
  ``` cpp
1716
- [[nodiscard]] void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
1717
- [[nodiscard]] void* operator new[](std::size_t size, std::align_val_t alignment,
1718
- const std::nothrow_t&) noexcept;
1719
  ```
1720
 
1721
  *Effects:* Same as above, except that these are called by a placement
1722
  version of a *new-expression* when a C++ program prefers a null pointer
1723
  result as an error indication, instead of a `bad_alloc` exception.
1724
 
1725
- *Replaceable:* A C++ program may define functions with either of these
1726
- function signatures, and thereby displace the default versions defined
1727
- by the C++ standard library.
1728
-
1729
  *Required behavior:* Return a non-null pointer to suitably aligned
1730
  storage [[basic.stc.dynamic]], or else return a null pointer. Each of
1731
  these nothrow versions of `operator new[]` returns a pointer obtained as
1732
  if acquired from the (possibly replaced) corresponding non-placement
1733
  function. This requirement is binding on any replacement versions of
@@ -1736,10 +1933,12 @@ these functions.
1736
  *Default behavior:* Calls `operator new[](size)`, or
1737
  `operator new[](size, alignment)`, respectively. If the call returns
1738
  normally, returns the result of that call. Otherwise, returns a null
1739
  pointer.
1740
 
 
 
1741
  ``` cpp
1742
  void operator delete[](void* ptr) noexcept;
1743
  void operator delete[](void* ptr, std::size_t size) noexcept;
1744
  void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
1745
  void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
@@ -1760,38 +1959,36 @@ returned `ptr`.
1760
 
1761
  *Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
1762
  called by the array form of a *delete-expression* to render the value of
1763
  `ptr` invalid.
1764
 
1765
- *Replaceable:* A C++ program may define functions with any of these
1766
- function signatures, and thereby displace the default versions defined
1767
- by the C++ standard library.
1768
-
1769
- If a function without a `size` parameter is defined, the program should
1770
- also define the corresponding function with a `size` parameter. If a
1771
- function with a `size` parameter is defined, the program shall also
1772
- define the corresponding version without the `size` parameter.
1773
-
1774
- [*Note 1*: The default behavior below might change in the future, which
1775
- will require replacing both deallocation functions when replacing the
1776
- allocation function. — *end note*]
1777
-
1778
  *Required behavior:* A call to an `operator delete[]` with a `size`
1779
  parameter may be changed to a call to the corresponding
1780
  `operator delete[]` without a `size` parameter, without affecting memory
1781
  allocation.
1782
 
1783
- [*Note 2*: A conforming implementation is for
1784
  `operator delete[](void* ptr, std::size_t size)` to simply call
1785
  `operator delete[](ptr)`. — *end note*]
1786
 
1787
  *Default behavior:* The functions that have a `size` parameter forward
1788
  their other parameters to the corresponding function without a `size`
1789
  parameter. The functions that do not have a `size` parameter forward
1790
  their parameters to the corresponding `operator delete` (single-object)
1791
  function.
1792
 
 
 
 
 
 
 
 
 
 
 
 
1793
  ``` cpp
1794
  void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
1795
  void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
1796
  ```
1797
 
@@ -1809,26 +2006,24 @@ allocation function that returned `ptr`.
1809
  *Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
1810
  called by the implementation to render the value of `ptr` invalid when
1811
  the constructor invoked from a nothrow placement version of the array
1812
  *new-expression* throws an exception.
1813
 
1814
- *Replaceable:* A C++ program may define functions with either of these
1815
- function signatures, and thereby displace the default versions defined
1816
- by the C++ standard library.
1817
-
1818
  *Default behavior:* Calls `operator delete[](ptr)`, or
1819
  `operator delete[](ptr, alignment)`, respectively.
1820
 
 
 
1821
  #### Non-allocating forms <a id="new.delete.placement">[[new.delete.placement]]</a>
1822
 
1823
  These functions are reserved; a C++ program may not define functions
1824
  that displace the versions in the C++ standard library [[constraints]].
1825
  The provisions of  [[basic.stc.dynamic]] do not apply to these reserved
1826
  placement forms of `operator new` and `operator delete`.
1827
 
1828
  ``` cpp
1829
- [[nodiscard]] void* operator new(std::size_t size, void* ptr) noexcept;
1830
  ```
1831
 
1832
  *Returns:* `ptr`.
1833
 
1834
  *Remarks:* Intentionally performs no other action.
@@ -1843,11 +2038,11 @@ Something* p = new (place) Something();
1843
  ```
1844
 
1845
  — *end example*]
1846
 
1847
  ``` cpp
1848
- [[nodiscard]] void* operator new[](std::size_t size, void* ptr) noexcept;
1849
  ```
1850
 
1851
  *Returns:* `ptr`.
1852
 
1853
  *Remarks:* Intentionally performs no other action.
@@ -1892,20 +2087,20 @@ before [[intro.multithread]] the next allocation (if any) in this order.
1892
  ``` cpp
1893
  namespace std {
1894
  class bad_alloc : public exception {
1895
  public:
1896
  // see [exception] for the specification of the special member functions
1897
- const char* what() const noexcept override;
1898
  };
1899
  }
1900
  ```
1901
 
1902
  The class `bad_alloc` defines the type of objects thrown as exceptions
1903
  by the implementation to report a failure to allocate storage.
1904
 
1905
  ``` cpp
1906
- const char* what() const noexcept override;
1907
  ```
1908
 
1909
  *Returns:* An *implementation-defined* NTBS.
1910
 
1911
  #### Class `bad_array_new_length` <a id="new.badlength">[[new.badlength]]</a>
@@ -1913,22 +2108,22 @@ const char* what() const noexcept override;
1913
  ``` cpp
1914
  namespace std {
1915
  class bad_array_new_length : public bad_alloc {
1916
  public:
1917
  // see [exception] for the specification of the special member functions
1918
- const char* what() const noexcept override;
1919
  };
1920
  }
1921
  ```
1922
 
1923
  The class `bad_array_new_length` defines the type of objects thrown as
1924
  exceptions by the implementation to report an attempt to allocate an
1925
  array of size less than zero or greater than an *implementation-defined*
1926
  limit [[expr.new]].
1927
 
1928
  ``` cpp
1929
- const char* what() const noexcept override;
1930
  ```
1931
 
1932
  *Returns:* An *implementation-defined* NTBS.
1933
 
1934
  #### Type `new_handler` <a id="new.handler">[[new.handler]]</a>
@@ -1972,11 +2167,11 @@ new_handler get_new_handler() noexcept;
1972
  [*Note 1*: This can be a null pointer value. — *end note*]
1973
 
1974
  ### Pointer optimization barrier <a id="ptr.launder">[[ptr.launder]]</a>
1975
 
1976
  ``` cpp
1977
- template<class T> [[nodiscard]] constexpr T* launder(T* p) noexcept;
1978
  ```
1979
 
1980
  *Mandates:* `!is_function_v<T> && !is_void_v<T>` is `true`.
1981
 
1982
  *Preconditions:* `p` represents the address *A* of a byte in memory. An
@@ -2062,11 +2257,13 @@ static_assert(sizeof(together) <= hardware_constructive_interference_size);
2062
 
2063
  ### General <a id="support.rtti.general">[[support.rtti.general]]</a>
2064
 
2065
  The header `<typeinfo>` defines a type associated with type information
2066
  generated by the implementation. It also defines two types for reporting
2067
- dynamic type identification errors.
 
 
2068
 
2069
  ### Header `<typeinfo>` synopsis <a id="typeinfo.syn">[[typeinfo.syn]]</a>
2070
 
2071
  ``` cpp
2072
  // all freestanding
@@ -2087,12 +2284,12 @@ namespace std {
2087
  constexpr bool operator==(const type_info& rhs) const noexcept;
2088
  bool before(const type_info& rhs) const noexcept;
2089
  size_t hash_code() const noexcept;
2090
  const char* name() const noexcept;
2091
 
2092
- type_info(const type_info&) = delete; // cannot be copied
2093
- type_info& operator=(const type_info&) = delete; // cannot be copied
2094
  };
2095
  }
2096
  ```
2097
 
2098
  The class `type_info` describes type information generated by the
@@ -2145,21 +2342,21 @@ string [[multibyte.strings]], suitable for conversion and display as a
2145
  ``` cpp
2146
  namespace std {
2147
  class bad_cast : public exception {
2148
  public:
2149
  // see [exception] for the specification of the special member functions
2150
- const char* what() const noexcept override;
2151
  };
2152
  }
2153
  ```
2154
 
2155
  The class `bad_cast` defines the type of objects thrown as exceptions by
2156
  the implementation to report the execution of an invalid `dynamic_cast`
2157
  expression [[expr.dynamic.cast]].
2158
 
2159
  ``` cpp
2160
- const char* what() const noexcept override;
2161
  ```
2162
 
2163
  *Returns:* An *implementation-defined* NTBS.
2164
 
2165
  ### Class `bad_typeid` <a id="bad.typeid">[[bad.typeid]]</a>
@@ -2167,25 +2364,134 @@ const char* what() const noexcept override;
2167
  ``` cpp
2168
  namespace std {
2169
  class bad_typeid : public exception {
2170
  public:
2171
  // see [exception] for the specification of the special member functions
2172
- const char* what() const noexcept override;
2173
  };
2174
  }
2175
  ```
2176
 
2177
  The class `bad_typeid` defines the type of objects thrown as exceptions
2178
  by the implementation to report a null pointer in a `typeid` expression
2179
  [[expr.typeid]].
2180
 
2181
  ``` cpp
2182
- const char* what() const noexcept override;
2183
  ```
2184
 
2185
  *Returns:* An *implementation-defined* NTBS.
2186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2187
  ## Source location <a id="support.srcloc">[[support.srcloc]]</a>
2188
 
2189
  ### Header `<source_location>` synopsis <a id="source.location.syn">[[source.location.syn]]</a>
2190
 
2191
  The header `<source_location>` defines the class `source_location` that
@@ -2271,11 +2577,11 @@ static consteval source_location current() noexcept;
2271
  [[support.srcloc.current]].
2272
  - Otherwise, when invoked in some other way, returns a `source_location`
2273
  whose data members are initialized with valid but unspecified values.
2274
 
2275
  *Remarks:* Any call to `current` that appears as a default member
2276
- initializer [[class.mem]], or as a subexpression thereof, should
2277
  correspond to the location of the constructor definition or aggregate
2278
  initialization that uses the default member initializer. Any call to
2279
  `current` that appears as a default argument [[dcl.fct.default]], or as
2280
  a subexpression thereof, should correspond to the location of the
2281
  invocation of the function that uses the default argument [[expr.call]].
@@ -2361,45 +2667,48 @@ namespace std {
2361
  using terminate_handler = void (*)();
2362
  terminate_handler get_terminate() noexcept;
2363
  terminate_handler set_terminate(terminate_handler f) noexcept;
2364
  [[noreturn]] void terminate() noexcept;
2365
 
2366
- int uncaught_exceptions() noexcept;
2367
 
2368
  using exception_ptr = unspecified;
2369
 
2370
- exception_ptr current_exception() noexcept;
2371
- [[noreturn]] void rethrow_exception(exception_ptr p);
2372
- template<class E> exception_ptr make_exception_ptr(E e) noexcept;
 
 
2373
 
2374
- template<class T> [[noreturn]] void throw_with_nested(T&& t);
2375
- template<class E> void rethrow_if_nested(const E& e);
2376
  }
2377
  ```
2378
 
2379
  ### Class `exception` <a id="exception">[[exception]]</a>
2380
 
2381
  ``` cpp
2382
  namespace std {
2383
  class exception {
2384
  public:
2385
- exception() noexcept;
2386
- exception(const exception&) noexcept;
2387
- exception& operator=(const exception&) noexcept;
2388
- virtual ~exception();
2389
- virtual const char* what() const noexcept;
2390
  };
2391
  }
2392
  ```
2393
 
2394
  The class `exception` defines the base class for the types of objects
2395
  thrown as exceptions by C++ standard library components, and certain
2396
  expressions, to report errors detected during program execution.
2397
 
2398
- Each standard library class `T` that derives from class `exception` has
2399
- the following publicly accessible member functions, each of them having
2400
- a non-throwing exception specification [[except.spec]]:
 
2401
 
2402
  - default constructor (unless the class synopsis shows other
2403
  constructors)
2404
  - copy constructor
2405
  - copy assignment operator
@@ -2409,28 +2718,29 @@ postcondition: If two objects `lhs` and `rhs` both have dynamic type `T`
2409
  and `lhs` is a copy of `rhs`, then `strcmp(lhs.what(), rhs.what())` is
2410
  equal to `0`. The `what()` member function of each such `T` satisfies
2411
  the constraints specified for `exception::what()` (see below).
2412
 
2413
  ``` cpp
2414
- exception(const exception& rhs) noexcept;
2415
- exception& operator=(const exception& rhs) noexcept;
2416
  ```
2417
 
2418
  *Ensures:* If `*this` and `rhs` both have dynamic type `exception` then
2419
  the value of the expression `strcmp(what(), rhs.what())` shall equal 0.
2420
 
2421
  ``` cpp
2422
- virtual ~exception();
2423
  ```
2424
 
2425
  *Effects:* Destroys an object of class `exception`.
2426
 
2427
  ``` cpp
2428
- virtual const char* what() const noexcept;
2429
  ```
2430
 
2431
- *Returns:* An *implementation-defined* NTBS.
 
2432
 
2433
  *Remarks:* The message may be a null-terminated multibyte
2434
  string [[multibyte.strings]], suitable for conversion and display as a
2435
  `wstring` [[string.classes]], [[locale.codecvt]]. The return value
2436
  remains valid until the exception object from which it is obtained is
@@ -2442,22 +2752,22 @@ called.
2442
  ``` cpp
2443
  namespace std {
2444
  class bad_exception : public exception {
2445
  public:
2446
  // see [exception] for the specification of the special member functions
2447
- const char* what() const noexcept override;
2448
  };
2449
  }
2450
  ```
2451
 
2452
  The class `bad_exception` defines the type of the object referenced by
2453
  the `exception_ptr` returned from a call to `current_exception`
2454
  [[propagation]] when the currently active exception object fails to
2455
  copy.
2456
 
2457
  ``` cpp
2458
- const char* what() const noexcept override;
2459
  ```
2460
 
2461
  *Returns:* An *implementation-defined* NTBS.
2462
 
2463
  ### Abnormal termination <a id="exception.terminate">[[exception.terminate]]</a>
@@ -2520,14 +2830,15 @@ abandoned for any of several reasons [[except.terminate]]. May also be
2520
  called directly by the program.
2521
 
2522
  ### `uncaught_exceptions` <a id="uncaught.exceptions">[[uncaught.exceptions]]</a>
2523
 
2524
  ``` cpp
2525
- int uncaught_exceptions() noexcept;
2526
  ```
2527
 
2528
- *Returns:* The number of uncaught exceptions [[except.uncaught]].
 
2529
 
2530
  *Remarks:* When `uncaught_exceptions() > 0`, throwing an exception can
2531
  result in a call of the function `std::terminate` [[except.terminate]].
2532
 
2533
  ### Exception propagation <a id="propagation">[[propagation]]</a>
@@ -2554,21 +2865,23 @@ enumeration, or pointer type.
2554
  as `exception_ptr`. — *end note*]
2555
 
2556
  For purposes of determining the presence of a data race, operations on
2557
  `exception_ptr` objects shall access and modify only the `exception_ptr`
2558
  objects themselves and not the exceptions they refer to. Use of
2559
- `rethrow_exception` on `exception_ptr` objects that refer to the same
2560
- exception object shall not introduce a data race.
2561
 
2562
  [*Note 2*: If `rethrow_exception` rethrows the same exception object
2563
  (rather than a copy), concurrent access to that rethrown exception
2564
  object can introduce a data race. Changes in the number of
2565
  `exception_ptr` objects that refer to a particular exception do not
2566
  introduce a data race. — *end note*]
2567
 
 
 
2568
  ``` cpp
2569
- exception_ptr current_exception() noexcept;
2570
  ```
2571
 
2572
  *Returns:* An `exception_ptr` object that refers to the currently
2573
  handled exception [[except.handle]] or a copy of the currently handled
2574
  exception, or a null `exception_ptr` object if no exception is being
@@ -2586,15 +2899,15 @@ If the attempt to copy the current exception object throws an exception,
2586
  the function returns an `exception_ptr` object that refers to the thrown
2587
  exception or, if this is not possible, to an instance of
2588
  `bad_exception`.
2589
 
2590
  [*Note 4*: The copy constructor of the thrown exception can also fail,
2591
- so the implementation is allowed to substitute a `bad_exception` object
2592
- to avoid infinite recursion. — *end note*]
2593
 
2594
  ``` cpp
2595
- [[noreturn]] void rethrow_exception(exception_ptr p);
2596
  ```
2597
 
2598
  *Preconditions:* `p` is not a null pointer.
2599
 
2600
  *Effects:* Let u be the exception object to which `p` refers, or a copy
@@ -2606,11 +2919,11 @@ memory for the copy is allocated in an unspecified way.
2606
  - otherwise, if copying the exception to which `p` refers to form u
2607
  throws an exception, throws that exception;
2608
  - otherwise, throws u.
2609
 
2610
  ``` cpp
2611
- template<class E> exception_ptr make_exception_ptr(E e) noexcept;
2612
  ```
2613
 
2614
  *Effects:* Creates an `exception_ptr` object that refers to a copy of
2615
  `e`, as if:
2616
 
@@ -2623,28 +2936,43 @@ try {
2623
  ```
2624
 
2625
  [*Note 5*: This function is provided for convenience and efficiency
2626
  reasons. — *end note*]
2627
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2628
  ### `nested_exception` <a id="except.nested">[[except.nested]]</a>
2629
 
2630
  ``` cpp
2631
  namespace std {
2632
  class nested_exception {
2633
  public:
2634
- nested_exception() noexcept;
2635
- nested_exception(const nested_exception&) noexcept = default;
2636
- nested_exception& operator=(const nested_exception&) noexcept = default;
2637
- virtual ~nested_exception() = default;
2638
 
2639
  // access functions
2640
- [[noreturn]] void rethrow_nested() const;
2641
- exception_ptr nested_ptr() const noexcept;
2642
  };
2643
 
2644
- template<class T> [[noreturn]] void throw_with_nested(T&& t);
2645
- template<class E> void rethrow_if_nested(const E& e);
2646
  }
2647
  ```
2648
 
2649
  The class `nested_exception` is designed for use as a mixin through
2650
  multiple inheritance. It captures the currently handled exception and
@@ -2653,33 +2981,33 @@ stores it for later use.
2653
  [*Note 1*: `nested_exception` has a virtual destructor to make it a
2654
  polymorphic class. Its presence can be tested for with
2655
  `dynamic_cast`. — *end note*]
2656
 
2657
  ``` cpp
2658
- nested_exception() noexcept;
2659
  ```
2660
 
2661
  *Effects:* The constructor calls `current_exception()` and stores the
2662
  returned value.
2663
 
2664
  ``` cpp
2665
- [[noreturn]] void rethrow_nested() const;
2666
  ```
2667
 
2668
  *Effects:* If `nested_ptr()` returns a null pointer, the function calls
2669
  the function `std::terminate`. Otherwise, it throws the stored exception
2670
  captured by `*this`.
2671
 
2672
  ``` cpp
2673
- exception_ptr nested_ptr() const noexcept;
2674
  ```
2675
 
2676
  *Returns:* The stored exception captured by this `nested_exception`
2677
  object.
2678
 
2679
  ``` cpp
2680
- template<class T> [[noreturn]] void throw_with_nested(T&& t);
2681
  ```
2682
 
2683
  Let `U` be `decay_t<T>`.
2684
 
2685
  *Preconditions:* `U` meets the *Cpp17CopyConstructible* requirements.
@@ -2689,11 +3017,11 @@ Let `U` be `decay_t<T>`.
2689
  is `true`, an exception of unspecified type that is publicly derived
2690
  from both `U` and `nested_exception` and constructed from
2691
  `std::forward<T>(t)`, otherwise `std::forward<T>(t)`.
2692
 
2693
  ``` cpp
2694
- template<class E> void rethrow_if_nested(const E& e);
2695
  ```
2696
 
2697
  *Effects:* If `E` is not a polymorphic class type, or if
2698
  `nested_exception` is an inaccessible or ambiguous base class of `E`,
2699
  there is no effect. Otherwise, performs:
@@ -2701,10 +3029,192 @@ there is no effect. Otherwise, performs:
2701
  ``` cpp
2702
  if (auto p = dynamic_cast<const nested_exception*>(addressof(e)))
2703
  p->rethrow_nested();
2704
  ```
2705
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2706
  ## Initializer lists <a id="support.initlist">[[support.initlist]]</a>
2707
 
2708
  ### General <a id="support.initlist.general">[[support.initlist.general]]</a>
2709
 
2710
  The header `<initializer_list>` defines a class template and several
@@ -2744,11 +3254,11 @@ An object of type `initializer_list<E>` provides access to an array of
2744
  objects of type `const E`.
2745
 
2746
  [*Note 1*: A pair of pointers or a pointer plus a length would be
2747
  obvious representations for `initializer_list`. `initializer_list` is
2748
  used to implement initializer lists as specified in  [[dcl.init.list]].
2749
- Copying an initializer list does not copy the underlying
2750
  elements. — *end note*]
2751
 
2752
  If an explicit specialization or partial specialization of
2753
  `initializer_list` is declared, the program is ill-formed.
2754
 
@@ -2826,11 +3336,11 @@ namespace std {
2826
  template<class... Ts>
2827
  struct common_comparison_category {
2828
  using type = see below;
2829
  };
2830
  template<class... Ts>
2831
- using common_comparison_category_t = typename common_comparison_category<Ts...>::type;
2832
 
2833
  // [cmp.concept], concept three_way_comparable
2834
  template<class T, class Cat = partial_ordering>
2835
  concept three_way_comparable = see below;
2836
  template<class T, class U, class Cat = partial_ordering>
@@ -2838,11 +3348,11 @@ namespace std {
2838
 
2839
  // [cmp.result], result of three-way comparison
2840
  template<class T, class U = T> struct compare_three_way_result;
2841
 
2842
  template<class T, class U = T>
2843
- using compare_three_way_result_t = typename compare_three_way_result<T, U>::type;
2844
 
2845
  // [comparisons.three.way], class compare_three_way
2846
  struct compare_three_way;
2847
 
2848
  // [cmp.alg], comparison algorithms
@@ -2852,10 +3362,17 @@ namespace std {
2852
  inline constexpr unspecified partial_order = unspecified;
2853
  inline constexpr unspecified compare_strong_order_fallback = unspecified;
2854
  inline constexpr unspecified compare_weak_order_fallback = unspecified;
2855
  inline constexpr unspecified compare_partial_order_fallback = unspecified;
2856
  }
 
 
 
 
 
 
 
2857
  }
2858
  ```
2859
 
2860
  ### Comparison category types <a id="cmp.categories">[[cmp.categories]]</a>
2861
 
@@ -2889,12 +3406,12 @@ meets this requirement.
2889
  — *end example*]
2890
 
2891
  In this context, the behavior of a program that supplies an argument
2892
  other than a literal `0` is undefined.
2893
 
2894
- For the purposes of subclause [[cmp.categories]], *substitutability* is
2895
- the property that `f(a) == f(b)` is `true` whenever `a == b` is `true`,
2896
  where `f` denotes a function that reads only comparison-salient state
2897
  that is accessible via the argument’s public const members.
2898
 
2899
  #### Class `partial_ordering` <a id="cmp.partialord">[[cmp.partialord]]</a>
2900
 
@@ -2906,17 +3423,17 @@ values to be incomparable.[^32]
2906
 
2907
  ``` cpp
2908
  namespace std {
2909
  class partial_ordering {
2910
  int value; // exposition only
2911
- bool is_ordered; // exposition only
2912
 
2913
  // exposition-only constructors
2914
  constexpr explicit
2915
- partial_ordering(ord v) noexcept : value(int(v)), is_ordered(true) {} // exposition only
2916
  constexpr explicit
2917
- partial_ordering(ncmp v) noexcept : value(int(v)), is_ordered(false) {} // exposition only
2918
 
2919
  public:
2920
  // valid values
2921
  static const partial_ordering less;
2922
  static const partial_ordering equivalent;
@@ -2952,20 +3469,20 @@ constexpr bool operator< (partial_ordering v, unspecified) noexcept;
2952
  constexpr bool operator> (partial_ordering v, unspecified) noexcept;
2953
  constexpr bool operator<=(partial_ordering v, unspecified) noexcept;
2954
  constexpr bool operator>=(partial_ordering v, unspecified) noexcept;
2955
  ```
2956
 
2957
- *Returns:* For `operator`, `v.is_ordered && v.value 0`.
2958
 
2959
  ``` cpp
2960
  constexpr bool operator< (unspecified, partial_ordering v) noexcept;
2961
  constexpr bool operator> (unspecified, partial_ordering v) noexcept;
2962
  constexpr bool operator<=(unspecified, partial_ordering v) noexcept;
2963
  constexpr bool operator>=(unspecified, partial_ordering v) noexcept;
2964
  ```
2965
 
2966
- *Returns:* For `operator`, `v.is_ordered && 0 v.value`.
2967
 
2968
  ``` cpp
2969
  constexpr partial_ordering operator<=>(partial_ordering v, unspecified) noexcept;
2970
  ```
2971
 
@@ -3042,20 +3559,20 @@ constexpr bool operator< (weak_ordering v, unspecified) noexcept;
3042
  constexpr bool operator> (weak_ordering v, unspecified) noexcept;
3043
  constexpr bool operator<=(weak_ordering v, unspecified) noexcept;
3044
  constexpr bool operator>=(weak_ordering v, unspecified) noexcept;
3045
  ```
3046
 
3047
- *Returns:* `v.value 0` for `operator`.
3048
 
3049
  ``` cpp
3050
  constexpr bool operator< (unspecified, weak_ordering v) noexcept;
3051
  constexpr bool operator> (unspecified, weak_ordering v) noexcept;
3052
  constexpr bool operator<=(unspecified, weak_ordering v) noexcept;
3053
  constexpr bool operator>=(unspecified, weak_ordering v) noexcept;
3054
  ```
3055
 
3056
- *Returns:* `0 v.value` for `operator`.
3057
 
3058
  ``` cpp
3059
  constexpr weak_ordering operator<=>(weak_ordering v, unspecified) noexcept;
3060
  ```
3061
 
@@ -3147,20 +3664,20 @@ constexpr bool operator< (strong_ordering v, unspecified) noexcept;
3147
  constexpr bool operator> (strong_ordering v, unspecified) noexcept;
3148
  constexpr bool operator<=(strong_ordering v, unspecified) noexcept;
3149
  constexpr bool operator>=(strong_ordering v, unspecified) noexcept;
3150
  ```
3151
 
3152
- *Returns:* `v.value 0` for `operator`.
3153
 
3154
  ``` cpp
3155
  constexpr bool operator< (unspecified, strong_ordering v) noexcept;
3156
  constexpr bool operator> (unspecified, strong_ordering v) noexcept;
3157
  constexpr bool operator<=(unspecified, strong_ordering v) noexcept;
3158
  constexpr bool operator>=(unspecified, strong_ordering v) noexcept;
3159
  ```
3160
 
3161
- *Returns:* `0 v.value` for `operator`.
3162
 
3163
  ``` cpp
3164
  constexpr strong_ordering operator<=>(strong_ordering v, unspecified) noexcept;
3165
  ```
3166
 
@@ -3219,14 +3736,14 @@ template<class T, class U>
3219
  };
3220
  ```
3221
 
3222
  Let `t` and `u` be lvalues of types `const remove_reference_t<T>` and
3223
  `const remove_reference_t<U>`, respectively. `T` and `U` model
3224
- `partially-ordered-with<T, U>` only if:
3225
 
3226
  - `t < u`, `t <= u`, `t > u`, `t >= u`, `u < t`, `u <= t`, `u > t`, and
3227
- `u >= t` have the same domain.
3228
  - `bool(t < u) == bool(u > t)` is `true`,
3229
  - `bool(u < t) == bool(t > u)` is `true`,
3230
  - `bool(t <= u) == bool(u >= t)` is `true`, and
3231
  - `bool(u <= t) == bool(t >= u)` is `true`.
3232
 
@@ -3239,11 +3756,11 @@ template<class T, class Cat = partial_ordering>
3239
  { a <=> b } -> compares-as<Cat>;
3240
  };
3241
  ```
3242
 
3243
  Let `a` and `b` be lvalues of type `const remove_reference_t<T>`. `T`
3244
- and `Cat` model `three_way_comparable<T, Cat>` only if:
3245
 
3246
  - `(a <=> b == 0) == bool(a == b)` is `true`,
3247
  - `(a <=> b != 0) == bool(a != b)` is `true`,
3248
  - `((a <=> b) <=> 0)` and `(0 <=> (b <=> a))` are equal,
3249
  - `(a <=> b < 0) == bool(a < b)` is `true`,
@@ -3275,11 +3792,11 @@ let `u` and `u2` be lvalues denoting distinct equal objects of types
3275
  `const remove_reference_t<U>` and `remove_cvref_t<U>`, respectively. Let
3276
  `C` be
3277
  `common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>`.
3278
  Let `CONVERT_TO_LVALUE<C>(E)` be defined as in
3279
  [[concepts.compare.general]]. `T`, `U`, and `Cat` model
3280
- `three_way_comparable_with<T, U, Cat>` only if:
3281
 
3282
  - `t <=> u` and `u <=> t` have the same domain,
3283
  - `((t <=> u) <=> 0)` and `(0 <=> (u <=> t))` are equal,
3284
  - `(t <=> u == 0) == bool(t == u)` is `true`,
3285
  - `(t <=> u != 0) == bool(t != u)` is `true`,
@@ -3321,11 +3838,11 @@ expression `strong_order(E, F)` is expression-equivalent
3321
  [[basic.lookup.argdep]].
3322
  - Otherwise, if the decayed type `T` of `E` is a floating-point type,
3323
  yields a value of type `strong_ordering` that is consistent with the
3324
  ordering observed by `T`’s comparison operators, and if
3325
  `numeric_limits<T>::is_iec559` is `true`, is additionally consistent
3326
- with the `totalOrder` operation as specified in ISO/IEC/IEEE 60559.
3327
  - Otherwise, `strong_ordering(compare_three_way()(E, F))` if it is a
3328
  well-formed expression.
3329
  - Otherwise, `strong_order(E, F)` is ill-formed.
3330
 
3331
  [*Note 1*: Ill-formed cases above result in substitution failure when
@@ -3443,12 +3960,12 @@ expression-equivalent [[defns.expression.equivalent]] to:
3443
 
3444
  - If the decayed types of `E` and `F` differ,
3445
  `compare_partial_order_fallback(E, F)` is ill-formed.
3446
  - Otherwise, `partial_order(E, F)` if it is a well-formed expression.
3447
  - Otherwise, if the expressions `E == F`, `E < F`, and `F < E` are all
3448
- well-formed and each of `decltype(E == F)` and `decltype(E < F)`
3449
- models `boolean-testable`,
3450
  ``` cpp
3451
  E == F ? partial_ordering::equivalent :
3452
  E < F ? partial_ordering::less :
3453
  F < E ? partial_ordering::greater :
3454
  partial_ordering::unordered
@@ -3459,10 +3976,42 @@ expression-equivalent [[defns.expression.equivalent]] to:
3459
 
3460
  [*Note 6*: Ill-formed cases above result in substitution failure when
3461
  `compare_partial_order_fallback(E, F)` appears in the immediate context
3462
  of a template instantiation. — *end note*]
3463
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3464
  ## Coroutines <a id="support.coroutine">[[support.coroutine]]</a>
3465
 
3466
  ### General <a id="support.coroutine.general">[[support.coroutine.general]]</a>
3467
 
3468
  The header `<coroutine>` defines several types providing compile and
@@ -3520,11 +4069,11 @@ such that if `ArgTypes` is a parameter pack of types and if the
3520
  *qualified-id* `R::promise_type` is valid and denotes a type
3521
  [[temp.deduct]], then `coroutine_traits<R, ArgTypes...>` has the
3522
  following publicly accessible member:
3523
 
3524
  ``` cpp
3525
- using promise_type = typename R::promise_type;
3526
  ```
3527
 
3528
  Otherwise, `coroutine_traits<R, ArgTypes...>` has no members.
3529
 
3530
  Program-defined specializations of this template shall define a publicly
@@ -3760,10 +4309,12 @@ struct noop_coroutine_promise {};
3760
  The class `noop_coroutine_promise` defines the promise type for the
3761
  coroutine referred to by `noop_coroutine_handle` [[coroutine.syn]].
3762
 
3763
  #### Class `coroutine_handle<noop_coroutine_promise>` <a id="coroutine.handle.noop">[[coroutine.handle.noop]]</a>
3764
 
 
 
3765
  ``` cpp
3766
  namespace std {
3767
  template<>
3768
  struct coroutine_handle<noop_coroutine_promise>
3769
  {
@@ -3905,41 +4456,39 @@ the `setlocale` function.
3905
 
3906
  ### Header `<cstdarg>` synopsis <a id="cstdarg.syn">[[cstdarg.syn]]</a>
3907
 
3908
  ``` cpp
3909
  // all freestanding
 
 
3910
  namespace std {
3911
  using va_list = see below;
3912
  }
3913
 
3914
  #define va_arg(V, P) see below
3915
  #define va_copy(VDST, VSRC) see below
3916
  #define va_end(V) see below
3917
- #define va_start(V, P) see below
3918
  ```
3919
 
3920
  The contents of the header `<cstdarg>` are the same as the C standard
3921
  library header `<stdarg.h>`, with the following changes:
3922
 
3923
- - In lieu of the default argument promotions specified in ISO C 6.5.2.2,
3924
- the definition in  [[expr.call]] applies.
3925
- - The restrictions that ISO C places on the second parameter to the
3926
- `va_start` macro in header `<stdarg.h>` are different in this
3927
- document. The parameter `parmN` is the rightmost parameter in the
3928
- variable parameter list of the function definition (the one just
3929
- before the `...`).[^33] If the parameter `parmN` is a pack expansion
3930
- [[temp.variadic]] or an entity resulting from a lambda capture
3931
- [[expr.prim.lambda]], the program is ill-formed, no diagnostic
3932
- required. If the parameter `parmN` is of a reference type, or of a
3933
- type that is not compatible with the type that results when passing an
3934
- argument for which there is no parameter, the behavior is undefined.
3935
 
3936
- See also: ISO C 7.16.1.1
3937
 
3938
  ### Header `<csetjmp>` synopsis <a id="csetjmp.syn">[[csetjmp.syn]]</a>
3939
 
3940
  ``` cpp
 
 
3941
  namespace std {
3942
  using jmp_buf = see below;
3943
  [[noreturn]] void longjmp(jmp_buf env, int val);
3944
  }
3945
 
@@ -4014,11 +4563,11 @@ An evaluation is *signal-safe* unless it includes one of the following:
4014
  - an access to an object with thread storage duration;
4015
  - a `dynamic_cast` expression;
4016
  - throwing of an exception;
4017
  - control entering a *try-block* or *function-try-block*;
4018
  - initialization of a variable with static storage duration requiring
4019
- dynamic initialization [[basic.start.dynamic]], [[stmt.dcl]][^34] ; or
4020
  - waiting for the completion of the initialization of a variable with
4021
  static storage duration [[stmt.dcl]].
4022
 
4023
  A signal handler invocation has undefined behavior if it includes an
4024
  evaluation that is not signal-safe.
@@ -4035,32 +4584,32 @@ See also: ISO C 7.14
4035
 
4036
  For compatibility with the C standard library, the C++ standard library
4037
  provides the *C headers* shown in [[c.headers]]. The intended use of
4038
  these headers is for interoperability only. It is possible that C++
4039
  source files need to include one of these headers in order to be valid
4040
- ISO C. Source files that are not intended to also be valid ISO C should
4041
- not use any of the C headers.
4042
 
4043
  [*Note 1*: The C headers either have no effect, such as `<stdbool.h>`
4044
  and `<stdalign.h>`, or otherwise the corresponding header of the form
4045
  `<cname>` provides the same facilities and assuredly defines them in
4046
  namespace `std`. — *end note*]
4047
 
4048
  [*Example 1*:
4049
 
4050
- The following source file is both valid C++ and valid ISO C. Viewed as
4051
- C++, it declares a function with C language linkage; viewed as C it
4052
- simply declares a function (and provides a prototype).
4053
 
4054
  ``` cpp
4055
- #include <stdbool.h> // for bool in C, no effect in C++{}
4056
  #include <stddef.h> // for size_t
4057
 
4058
  #ifdef __cplusplus // see [cpp.predefined]
4059
  extern "C" // see [dcl.link]
4060
  #endif
4061
- void f(bool b[], size_t n);
4062
  ```
4063
 
4064
  — *end example*]
4065
 
4066
  ### Header `<complex.h>` synopsis <a id="complex.h.syn">[[complex.h.syn]]</a>
@@ -4084,23 +4633,20 @@ The C++ header `<iso646.h>` is empty.
4084
  [[lex.key]]. — *end note*]
4085
 
4086
  ### Header `<stdalign.h>` synopsis <a id="stdalign.h.syn">[[stdalign.h.syn]]</a>
4087
 
4088
  The contents of the C++ header `<stdalign.h>` are the same as the C
4089
- standard library header `<stdalign.h>`, with the following changes: The
4090
- header `<stdalign.h>` does not define a macro named `alignas`.
4091
 
4092
  See also: ISO C 7.15
4093
 
4094
  ### Header `<stdbool.h>` synopsis <a id="stdbool.h.syn">[[stdbool.h.syn]]</a>
4095
 
4096
  The contents of the C++ header `<stdbool.h>` are the same as the C
4097
- standard library header `<stdbool.h>`, with the following changes: The
4098
- header `<stdbool.h>` does not define macros named `bool`, `true`, or
4099
- `false`.
4100
 
4101
- See also: ISO C 7.18
4102
 
4103
  ### Header `<tgmath.h>` synopsis <a id="tgmath.h.syn">[[tgmath.h.syn]]</a>
4104
 
4105
  ``` cpp
4106
  #include <cmath>
@@ -4119,39 +4665,44 @@ overloads. — *end note*]
4119
  `<tgmath.h>`. — *end note*]
4120
 
4121
  ### Other C headers <a id="support.c.headers.other">[[support.c.headers.other]]</a>
4122
 
4123
  Every C header other than `<complex.h>`, `<iso646.h>`, `<stdalign.h>`,
4124
- `<stdatomic.h>`, `<stdbool.h>`, and `<tgmath.h>`, each of which has a
4125
- name of the form `<name.h>`, behaves as if each name placed in the
4126
- standard library namespace by the corresponding `<cname>` header is
4127
- placed within the global namespace scope, except for the functions
4128
- described in [[sf.cmath]], the `std::lerp` function overloads
4129
- [[c.math.lerp]], the declaration of `std::byte` [[cstddef.syn]], and the
4130
- functions and function templates described in [[support.types.byteops]].
4131
- It is unspecified whether these names are first declared or defined
4132
- within namespace scope [[basic.scope.namespace]] of the namespace `std`
4133
- and are then injected into the global namespace scope by explicit
4134
- *using-declaration*s [[namespace.udecl]].
 
4135
 
4136
  [*Example 1*: The header `<cstdlib>` assuredly provides its
4137
  declarations and definitions within the namespace `std`. It may also
4138
  provide these names within the global namespace. The header `<stdlib.h>`
4139
  assuredly provides the same declarations and definitions within the
4140
- global namespace, much as in the C Standard. It may also provide these
4141
  names within the namespace `std`. — *end example*]
4142
 
4143
  <!-- Link reference definitions -->
4144
  [alg.c.library]: algorithms.md#alg.c.library
4145
  [alloc.errors]: #alloc.errors
 
4146
  [atomics]: thread.md#atomics
4147
  [bad.alloc]: #bad.alloc
4148
  [bad.cast]: #bad.cast
4149
  [bad.exception]: #bad.exception
4150
  [bad.typeid]: #bad.typeid
4151
  [basic.align]: basic.md#basic.align
4152
  [basic.compound]: basic.md#basic.compound
 
 
 
4153
  [basic.extended.fp]: basic.md#basic.extended.fp
4154
  [basic.fundamental]: basic.md#basic.fundamental
4155
  [basic.life]: basic.md#basic.life
4156
  [basic.lookup.argdep]: basic.md#basic.lookup.argdep
4157
  [basic.scope.namespace]: basic.md#basic.scope.namespace
@@ -4159,18 +4710,18 @@ names within the namespace `std`. — *end example*]
4159
  [basic.start.term]: basic.md#basic.start.term
4160
  [basic.stc.dynamic]: basic.md#basic.stc.dynamic
4161
  [basic.stc.dynamic.allocation]: basic.md#basic.stc.dynamic.allocation
4162
  [basic.stc.dynamic.deallocation]: basic.md#basic.stc.dynamic.deallocation
4163
  [c.headers]: #c.headers
4164
- [c.locales]: localization.md#c.locales
4165
  [c.malloc]: mem.md#c.malloc
4166
  [c.math.abs]: numerics.md#c.math.abs
4167
  [c.math.lerp]: numerics.md#c.math.lerp
4168
  [c.math.rand]: numerics.md#c.math.rand
4169
- [c.mb.wcs]: strings.md#c.mb.wcs
4170
  [cfloat.syn]: #cfloat.syn
4171
- [class.mem]: class.md#class.mem
4172
  [class.prop]: class.md#class.prop
4173
  [class.spaceship]: class.md#class.spaceship
4174
  [climits.syn]: #climits.syn
4175
  [cmp]: #cmp
4176
  [cmp.alg]: #cmp.alg
@@ -4181,15 +4732,17 @@ names within the namespace `std`. — *end example*]
4181
  [cmp.partialord]: #cmp.partialord
4182
  [cmp.result]: #cmp.result
4183
  [cmp.strongord]: #cmp.strongord
4184
  [cmp.weakord]: #cmp.weakord
4185
  [compare.syn]: #compare.syn
 
4186
  [complex]: numerics.md#complex
4187
  [complex.h.syn]: #complex.h.syn
4188
  [concept.totallyordered]: concepts.md#concept.totallyordered
4189
  [concepts.compare.general]: concepts.md#concepts.compare.general
4190
  [constraints]: library.md#constraints
 
4191
  [conv.prom]: expr.md#conv.prom
4192
  [conv.ptr]: expr.md#conv.ptr
4193
  [conv.qual]: expr.md#conv.qual
4194
  [conv.rank]: basic.md#conv.rank
4195
  [coroutine.handle]: #coroutine.handle
@@ -4200,10 +4753,11 @@ names within the namespace `std`. — *end example*]
4200
  [coroutine.handle.general]: #coroutine.handle.general
4201
  [coroutine.handle.hash]: #coroutine.handle.hash
4202
  [coroutine.handle.noop]: #coroutine.handle.noop
4203
  [coroutine.handle.noop.address]: #coroutine.handle.noop.address
4204
  [coroutine.handle.noop.conv]: #coroutine.handle.noop.conv
 
4205
  [coroutine.handle.noop.observers]: #coroutine.handle.noop.observers
4206
  [coroutine.handle.noop.promise]: #coroutine.handle.noop.promise
4207
  [coroutine.handle.noop.resumption]: #coroutine.handle.noop.resumption
4208
  [coroutine.handle.observers]: #coroutine.handle.observers
4209
  [coroutine.handle.promise]: #coroutine.handle.promise
@@ -4231,37 +4785,40 @@ names within the namespace `std`. — *end example*]
4231
  [defns.expression.equivalent]: intro.md#defns.expression.equivalent
4232
  [except.handle]: except.md#except.handle
4233
  [except.nested]: #except.nested
4234
  [except.spec]: except.md#except.spec
4235
  [except.terminate]: except.md#except.terminate
4236
- [except.uncaught]: except.md#except.uncaught
4237
  [exception]: #exception
4238
  [exception.syn]: #exception.syn
4239
  [exception.terminate]: #exception.terminate
4240
  [expr.add]: expr.md#expr.add
4241
  [expr.await]: expr.md#expr.await
4242
  [expr.call]: expr.md#expr.call
 
4243
  [expr.context]: expr.md#expr.context
4244
  [expr.delete]: expr.md#expr.delete
4245
  [expr.dynamic.cast]: expr.md#expr.dynamic.cast
4246
  [expr.eq]: expr.md#expr.eq
4247
  [expr.new]: expr.md#expr.new
4248
- [expr.prim.lambda]: expr.md#expr.prim.lambda
4249
  [expr.rel]: expr.md#expr.rel
4250
  [expr.sizeof]: expr.md#expr.sizeof
4251
  [expr.spaceship]: expr.md#expr.spaceship
4252
  [expr.typeid]: expr.md#expr.typeid
4253
  [get.new.handler]: #get.new.handler
4254
  [get.terminate]: #get.terminate
4255
  [hardware.interference]: #hardware.interference
4256
  [initializer.list.syn]: #initializer.list.syn
4257
  [intro.multithread]: basic.md#intro.multithread
4258
  [iso646.h.syn]: #iso646.h.syn
 
 
4259
  [lex.key]: lex.md#lex.key
4260
  [library.c]: library.md#library.c
4261
  [limits.syn]: #limits.syn
4262
- [locale.codecvt]: localization.md#locale.codecvt
 
4263
  [multibyte.strings]: library.md#multibyte.strings
4264
  [namespace.udecl]: dcl.md#namespace.udecl
4265
  [new.badlength]: #new.badlength
4266
  [new.delete]: #new.delete
4267
  [new.delete.array]: #new.delete.array
@@ -4291,10 +4848,14 @@ names within the namespace `std`. — *end example*]
4291
  [support]: #support
4292
  [support.arith.types]: #support.arith.types
4293
  [support.c.headers]: #support.c.headers
4294
  [support.c.headers.general]: #support.c.headers.general
4295
  [support.c.headers.other]: #support.c.headers.other
 
 
 
 
4296
  [support.coroutine]: #support.coroutine
4297
  [support.coroutine.general]: #support.coroutine.general
4298
  [support.dynamic]: #support.dynamic
4299
  [support.dynamic.general]: #support.dynamic.general
4300
  [support.exception]: #support.exception
@@ -4323,21 +4884,27 @@ names within the namespace `std`. — *end example*]
4323
  [support.types]: #support.types
4324
  [support.types.byteops]: #support.types.byteops
4325
  [support.types.layout]: #support.types.layout
4326
  [support.types.nullptr]: #support.types.nullptr
4327
  [swappable.requirements]: library.md#swappable.requirements
 
 
 
4328
  [temp.deduct]: temp.md#temp.deduct
4329
  [temp.dep.constexpr]: temp.md#temp.dep.constexpr
4330
  [temp.dep.expr]: temp.md#temp.dep.expr
4331
- [temp.variadic]: temp.md#temp.variadic
4332
  [term.odr.use]: basic.md#term.odr.use
 
4333
  [terminate]: #terminate
4334
  [terminate.handler]: #terminate.handler
4335
  [tgmath.h.syn]: #tgmath.h.syn
 
 
4336
  [type.info]: #type.info
4337
  [typeinfo.syn]: #typeinfo.syn
4338
  [uncaught.exceptions]: #uncaught.exceptions
 
4339
  [unord.hash]: utilities.md#unord.hash
4340
  [utility.arg.requirements]: library.md#utility.arg.requirements
4341
  [version.syn]: #version.syn
4342
 
4343
  [^1]: Possible definitions include `0` and `0L`, but not `(void*)0`.
@@ -4361,12 +4928,13 @@ names within the namespace `std`. — *end example*]
4361
 
4362
  [^9]: Distinguishes types with bases other than 2 (e.g., BCD).
4363
 
4364
  [^10]: Equivalent to `FLT_EPSILON`, `DBL_EPSILON`, `LDBL_EPSILON`.
4365
 
4366
- [^11]: Rounding error is described in LIA-1 Section 5.2.4 and Annex C
4367
- Rationale Section C.5.2.4 — Rounding and rounding constants.
 
4368
 
4369
  [^12]: Equivalent to `FLT_MIN_EXP`, `DBL_MIN_EXP`, `LDBL_MIN_EXP`.
4370
 
4371
  [^13]: Equivalent to `FLT_MIN_10_EXP`, `DBL_MIN_10_EXP`,
4372
  `LDBL_MIN_10_EXP`.
@@ -4374,33 +4942,33 @@ names within the namespace `std`. — *end example*]
4374
  [^14]: Equivalent to `FLT_MAX_EXP`, `DBL_MAX_EXP`, `LDBL_MAX_EXP`.
4375
 
4376
  [^15]: Equivalent to `FLT_MAX_10_EXP`, `DBL_MAX_10_EXP`,
4377
  `LDBL_MAX_10_EXP`.
4378
 
4379
- [^16]: Required by LIA-1.
4380
 
4381
- [^17]: Required by LIA-1.
4382
 
4383
- [^18]: Required by LIA-1.
4384
 
4385
- [^19]: Required by LIA-1.
4386
 
4387
- [^20]: Required by LIA-1.
4388
 
4389
- [^21]: Required by LIA-1.
4390
 
4391
- [^22]: ISO/IEC/IEEE 60559:2020 is the same as IEEE 754-2019.
4392
 
4393
- [^23]: Required by LIA-1.
4394
 
4395
- [^24]: Required by LIA-1.
4396
 
4397
- [^25]: Required by LIA-1.
4398
 
4399
- [^26]: Refer to ISO/IEC/IEEE 60559. Required by LIA-1.
4400
 
4401
- [^27]: Equivalent to `FLT_ROUNDS`. Required by LIA-1.
4402
 
4403
  [^28]: A function is called for every time it is registered.
4404
 
4405
  [^29]: Objects with automatic storage duration are all destroyed in a
4406
  program whose `main` function [[basic.start.main]] contains no
@@ -4418,10 +4986,7 @@ names within the namespace `std`. — *end example*]
4418
  however, increase the `size` argument to `operator new[]` to obtain
4419
  space to store supplemental information.
4420
 
4421
  [^32]: That is, `a < b`, `a == b`, and `a > b` might all be `false`.
4422
 
4423
- [^33]: Note that `va_start` is required to work as specified even if
4424
- unary `operator&` is overloaded for the type of `parmN`.
4425
-
4426
- [^34]: Such initialization can occur because it is the first odr-use
4427
  [[term.odr.use]] of that variable.
 
9
 
10
  The following subclauses describe common type definitions used
11
  throughout the library, characteristics of the predefined types,
12
  functions supporting start and termination of a C++ program, support for
13
  dynamic memory management, support for dynamic type identification,
14
+ support for contract-violation handling, support for exception
15
+ processing, support for initializer lists, and other runtime support, as
16
+ summarized in [[support.summary]].
17
 
18
  **Table: Language support library summary** <a id="support.summary">[support.summary]</a>
19
 
20
  | Subclause | | Header |
21
+ | ----------------------- | --------------------------- | -------------------------------------------------- |
22
  | [[support.types]] | Common definitions | `<cstddef>`, `<cstdlib>` |
23
  | [[support.limits]] | Implementation properties | `<cfloat>`, `<climits>`, `<limits>`, `<version>` |
24
  | [[support.arith.types]] | Arithmetic types | `<cstdint>`, `<stdfloat>` |
25
  | [[support.start.term]] | Start and termination | `<cstdlib>` |
26
  | [[support.dynamic]] | Dynamic memory management | `<new>` |
27
+ | [[support.rtti]] | Type identification | `<typeinfo>`, `<typeindex>` |
28
  | [[support.srcloc]] | Source location | `<source_location>` |
29
  | [[support.exception]] | Exception handling | `<exception>` |
30
+ | [[support.contract]] | Contract-violation handling | `<contracts>` |
31
  | [[support.initlist]] | Initializer lists | `<initializer_list>` |
32
  | [[cmp]] | Comparisons | `<compare>` |
33
  | [[support.coroutine]] | Coroutines | `<coroutine>` |
34
  | [[support.runtime]] | Other runtime support | `<csetjmp>`, `<csignal>`, `<cstdarg>`, `<cstdlib>` |
35
 
 
72
  #define offsetof(P, D) see below
73
  ```
74
 
75
  The contents and meaning of the header `<cstddef>` are the same as the C
76
  standard library header `<stddef.h>`, except that it does not declare
77
+ the type `wchar_t`, that it does not define the macro `unreachable`,
78
+ that it also declares the type `byte` and its associated operations
79
+ [[support.types.byteops]], and as noted in [[support.types.nullptr]] and
80
+ [[support.types.layout]].
81
 
82
+ See also: ISO C 7.21
83
 
84
  ### Header `<cstdlib>` synopsis <a id="cstdlib.syn">[[cstdlib.syn]]</a>
85
 
86
  ``` cpp
87
  namespace std {
88
  using size_t = see below; // freestanding
89
+ using div_t = see below; // freestanding
90
+ using ldiv_t = see below; // freestanding
91
+ using lldiv_t = see below; // freestanding
92
  }
93
 
94
  #define NULL see below // freestanding
95
+ #define EXIT_FAILURE see below // freestanding
96
+ #define EXIT_SUCCESS see below // freestanding
97
  #define RAND_MAX see below
98
  #define MB_CUR_MAX see below
99
 
100
  namespace std {
101
  // Exposition-only function type aliases
 
119
 
120
  // [c.malloc], C library memory allocation
121
  void* aligned_alloc(size_t alignment, size_t size);
122
  void* calloc(size_t nmemb, size_t size);
123
  void free(void* ptr);
124
+ void free_sized(void* ptr, size_t size);
125
+ void free_aligned_sized(void* ptr, size_t alignment, size_t size);
126
  void* malloc(size_t size);
127
  void* realloc(void* ptr, size_t size);
128
+ size_t memalignment(const void* p); // freestanding
129
 
130
  double atof(const char* nptr);
131
  int atoi(const char* nptr);
132
  long int atol(const char* nptr);
133
  long long int atoll(const char* nptr);
134
  double strtod(const char* nptr, char** endptr);
135
+ int strfromd(char* s, size_t n, const char* format, double fp);
136
+ int strfromf(char* s, size_t n, const char* format, float fp);
137
+ int strfroml(char* s, size_t n, const char* format, long double fp);
138
  float strtof(const char* nptr, char** endptr);
139
  long double strtold(const char* nptr, char** endptr);
140
  long int strtol(const char* nptr, char** endptr, int base);
141
  long long int strtoll(const char* nptr, char** endptr, int base);
142
  unsigned long int strtoul(const char* nptr, char** endptr, int base);
 
148
  int wctomb(char* s, wchar_t wchar);
149
  size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n);
150
  size_t wcstombs(char* s, const wchar_t* pwcs, size_t n);
151
 
152
  // [alg.c.library], C standard library algorithms
153
+ void* bsearch(const void* key, void* base, size_t nmemb, size_t size, // freestanding
154
  c-compare-pred* compar);
155
+ void* bsearch(const void* key, void* base, size_t nmemb, size_t size, // freestanding
156
  compare-pred* compar);
157
+ const void* bsearch(const void* key, const void* base, size_t nmemb, // freestanding
158
+ size_t size, c-compare-pred* compar);
159
+ const void* bsearch(const void* key, const void* base, size_t nmemb, // freestanding
160
+ size_t size, compare-pred* compar);
161
+ void qsort(void* base, size_t nmemb, size_t size, c-compare-pred* compar); // freestanding
162
+ void qsort(void* base, size_t nmemb, size_t size, compare-pred* compar); // freestanding
163
 
164
  // [c.math.rand], low-quality random number generation
165
  int rand();
166
  void srand(unsigned int seed);
167
 
168
  // [c.math.abs], absolute values
169
+ constexpr int abs(int j); // freestanding
170
+ constexpr long int abs(long int j); // freestanding
171
+ constexpr long long int abs(long long int j); // freestanding
172
+ constexpr floating-point-type abs(floating-point-type j); // freestanding-deleted
173
 
174
+ constexpr long int labs(long int j); // freestanding
175
+ constexpr long long int llabs(long long int j); // freestanding
176
 
177
+ constexpr div_t div(int numer, int denom); // freestanding
178
+ constexpr ldiv_t div(long int numer, long int denom); // freestanding; see [library.c]
179
+ constexpr lldiv_t div(long long int numer, long long int denom); // freestanding; see [library.c]
180
+ constexpr ldiv_t ldiv(long int numer, long int denom); // freestanding
181
+ constexpr lldiv_t lldiv(long long int numer, long long int denom); // freestanding
182
  }
183
  ```
184
 
185
  The contents and meaning of the header `<cstdlib>` are the same as the C
186
  standard library header `<stdlib.h>`, except that it does not declare
187
+ the types `wchar_t` or `once_flag`, and does not declare the function
188
+ `call_once`, and except as noted in [[support.types.nullptr]],
189
  [[support.types.layout]], [[support.start.term]], [[c.malloc]],
190
  [[c.mb.wcs]], [[alg.c.library]], [[c.math.rand]], and [[c.math.abs]].
191
 
192
  [*Note 1*: Several functions have additional overloads in this
193
  document, but they have the same behavior as in the C standard library
194
  [[library.c]]. — *end note*]
195
 
196
+ See also: ISO C 7.24
197
 
198
  ### Null pointers <a id="support.types.nullptr">[[support.types.nullptr]]</a>
199
 
200
  The type `nullptr_t` is a synonym for the type of a `nullptr`
201
  expression, and it has the characteristics described in 
 
206
  taken. — *end note*]
207
 
208
  The macro `NULL` is an *implementation-defined* null pointer
209
  constant.[^1]
210
 
211
+ See also: ISO C 7.21
212
 
213
  ### Sizes, alignments, and offsets <a id="support.types.layout">[[support.types.layout]]</a>
214
 
215
  The macro `offsetof(type, member-designator)` has the same semantics as
216
  the corresponding macro in the C standard library header `<stddef.h>`,
 
237
  *Recommended practice:* An implementation should choose types for
238
  `ptrdiff_t` and `size_t` whose integer conversion ranks [[conv.rank]]
239
  are no greater than that of `signed long int` unless a larger size is
240
  necessary to contain all the possible values.
241
 
242
+ The type `max_align_t` is a trivially copyable standard-layout type
243
+ whose alignment requirement is at least as great as that of every scalar
244
+ type, and whose alignment requirement is supported in every context
245
+ [[basic.align]].
246
+ `std::is_trivially_default_constructible_v<max_align_t>` is `true`.
247
 
248
+ See also: ISO C 7.21
249
 
250
  ### `byte` type operations <a id="support.types.byteops">[[support.types.byteops]]</a>
251
 
252
  ``` cpp
253
  template<class IntType>
 
375
 
376
  Each of the macros defined in `<version>` is also defined after
377
  inclusion of any member of the set of library headers indicated in the
378
  corresponding comment in this synopsis.
379
 
380
+ [*Note 1*: Future revisions of this document might replace the values
381
+ of these macros with greater values. — *end note*]
382
 
383
  ``` cpp
384
+ #define __cpp_lib_adaptor_iterator_pair_constructor 202106L // also in <stack>, <queue>
385
+ #define __cpp_lib_addressof_constexpr 201603L // freestanding, also in <memory>
386
+ #define __cpp_lib_algorithm_default_value_type 202403L
387
+ // also in <algorithm>, <ranges>, <string>, <deque>, <list>, <forward_list>, <vector>
388
  #define __cpp_lib_algorithm_iterator_requirements 202207L
389
  // also in <algorithm>, <numeric>, <memory>
390
+ #define __cpp_lib_aligned_accessor 202411L // also in <mdspan>
391
  #define __cpp_lib_allocate_at_least 202302L // also in <memory>
392
  #define __cpp_lib_allocator_traits_is_always_equal 201411L
393
+ // freestanding, also in <memory>, <scoped_allocator>, <string>, <deque>, <forward_list>, <list>,
394
+ // <vector>, <map>, <set>, <unordered_map>, <unordered_set>
 
395
  #define __cpp_lib_any 201606L // also in <any>
396
+ #define __cpp_lib_apply 202506L // freestanding, also in <tuple>, <type_traits>
397
  #define __cpp_lib_array_constexpr 201811L // also in <iterator>, <array>
398
+ #define __cpp_lib_as_const 201510L // freestanding, also in <utility>
399
  #define __cpp_lib_associative_heterogeneous_erasure 202110L
400
  // also in <map>, <set>, <unordered_map>, <unordered_set>
401
+ #define __cpp_lib_associative_heterogeneous_insertion 202306L
402
+ // also in <map>, <set>, <unordered_map>, <unordered_set>
403
+ #define __cpp_lib_assume_aligned 201811L // freestanding, also in <memory>
404
+ #define __cpp_lib_atomic_flag_test 201907L // freestanding, also in <atomic>
405
+ #define __cpp_lib_atomic_float 201711L // freestanding, also in <atomic>
406
+ #define __cpp_lib_atomic_is_always_lock_free 201603L // freestanding, also in <atomic>
407
  #define __cpp_lib_atomic_lock_free_type_aliases 201907L // also in <atomic>
408
+ #define __cpp_lib_atomic_min_max 202506L // freestanding, also in <atomic>
409
+ #define __cpp_lib_atomic_reductions 202506L // freestanding, also in <atomic>
410
+ #define __cpp_lib_atomic_ref 202411L // freestanding, also in <atomic>
411
  #define __cpp_lib_atomic_shared_ptr 201711L // also in <memory>
412
+ #define __cpp_lib_atomic_value_initialization 201911L // freestanding, also in <atomic>, <memory>
413
+ #define __cpp_lib_atomic_wait 201907L // freestanding, also in <atomic>
414
  #define __cpp_lib_barrier 202302L // also in <barrier>
415
+ #define __cpp_lib_bind_back 202306L // freestanding, also in <functional>
416
+ #define __cpp_lib_bind_front 202306L // freestanding, also in <functional>
417
+ #define __cpp_lib_bit_cast 201806L // freestanding, also in <bit>
418
+ #define __cpp_lib_bitops 201907L // freestanding, also in <bit>
419
+ #define __cpp_lib_bitset 202306L // also in <bitset>
420
+ #define __cpp_lib_bool_constant 201505L // freestanding, also in <type_traits>
421
+ #define __cpp_lib_bounded_array_traits 201902L // freestanding, also in <type_traits>
422
  #define __cpp_lib_boyer_moore_searcher 201603L // also in <functional>
423
+ #define __cpp_lib_byte 201603L // freestanding, also in <cstddef>
424
+ #define __cpp_lib_byteswap 202110L // freestanding, also in <bit>
425
  #define __cpp_lib_char8_t 201907L
426
+ // freestanding, also in <atomic>, <filesystem>, <istream>, <limits>, <locale>, <ostream>, <string>,
427
+ // <string_view>
428
+ #define __cpp_lib_chrono 202306L // also in <chrono>
429
  #define __cpp_lib_chrono_udls 201304L // also in <chrono>
430
  #define __cpp_lib_clamp 201603L // also in <algorithm>
431
+ #define __cpp_lib_common_reference 202302L // freestanding, also in <type_traits>
432
+ #define __cpp_lib_common_reference_wrapper 202302L // freestanding, also in <functional>
433
  #define __cpp_lib_complex_udls 201309L // also in <complex>
434
+ #define __cpp_lib_concepts 202207L
435
+ // freestanding, also in <concepts>, <compare>
436
+ #define __cpp_lib_constant_wrapper 202506L // freestanding, also in <type_traits>
437
+ #define __cpp_lib_constexpr_algorithms 202306L // also in <algorithm>, <utility>
438
+ #define __cpp_lib_constexpr_atomic 202411L // also in <atomic>
439
  #define __cpp_lib_constexpr_bitset 202207L // also in <bitset>
440
+ #define __cpp_lib_constexpr_charconv 202207L // freestanding, also in <charconv>
441
+ #define __cpp_lib_constexpr_cmath 202306L // also in <cmath>, <cstdlib>
442
+ #define __cpp_lib_constexpr_complex 202306L // also in <complex>
443
+ #define __cpp_lib_constexpr_deque 202502L // also in <deque>
444
  #define __cpp_lib_constexpr_dynamic_alloc 201907L // also in <memory>
445
+ #define __cpp_lib_constexpr_exceptions 202502L
446
+ // also in <exception>, <stdexcept>, <expected>, <optional>, <variant>, and <format>
447
+ #define __cpp_lib_constexpr_flat_map 202502L // also in <flat_map>
448
+ #define __cpp_lib_constexpr_flat_set 202502L // also in <flat_set>
449
+ #define __cpp_lib_constexpr_forward_list 202502L // also in <forward_list>
450
+ #define __cpp_lib_constexpr_functional 201907L // freestanding, also in <functional>
451
+ #define __cpp_lib_constexpr_inplace_vector 202502L // also in <inplace_vector>
452
+ #define __cpp_lib_constexpr_iterator 201811L // freestanding, also in <iterator>
453
+ #define __cpp_lib_constexpr_list 202502L // also in <list>
454
+ #define __cpp_lib_constexpr_map 202502L // also in <map>
455
+ #define __cpp_lib_constexpr_memory 202506L // freestanding, also in <memory>
456
+ #define __cpp_lib_constexpr_new 202406L // freestanding, also in <new>
457
  #define __cpp_lib_constexpr_numeric 201911L // also in <numeric>
458
+ #define __cpp_lib_constexpr_queue 202502L // also in <queue>
459
+ #define __cpp_lib_constexpr_set 202502L // also in <set>
460
+ #define __cpp_lib_constexpr_stack 202502L // also in <stack>
461
  #define __cpp_lib_constexpr_string 201907L // also in <string>
462
  #define __cpp_lib_constexpr_string_view 201811L // also in <string_view>
463
+ #define __cpp_lib_constexpr_tuple 201811L // freestanding, also in <tuple>
464
+ #define __cpp_lib_constexpr_typeinfo 202106L // freestanding, also in <typeinfo>
465
+ #define __cpp_lib_constexpr_unordered_map 202502L // also in <unordered_map>
466
+ #define __cpp_lib_constexpr_unordered_set 202502L // also in <unordered_set>
467
+ #define __cpp_lib_constexpr_utility 201811L // freestanding, also in <utility>
468
  #define __cpp_lib_constexpr_vector 201907L // also in <vector>
469
+ #define __cpp_lib_constrained_equality 202411L // freestanding,
470
+ // also in <utility>, <tuple>, <optional>, <variant>, <expected>
471
  #define __cpp_lib_containers_ranges 202202L
472
  // also in <vector>, <list>, <forward_list>, <map>, <set>, <unordered_map>, <unordered_set>,
473
  // <deque>, <queue>, <stack>, <string>
474
+ #define __cpp_lib_contracts 202502L // freestanding, also in <contracts>
475
+ #define __cpp_lib_copyable_function 202306L // also in <functional>
476
+ #define __cpp_lib_coroutine 201902L // freestanding, also in <coroutine>
477
+ #define __cpp_lib_counting_scope 202506L // also in <execution>
478
+ #define __cpp_lib_debugging 202403L // freestanding, also in <debugging>
479
+ #define __cpp_lib_define_static 202506L // freestanding, also in <meta>
480
+ #define __cpp_lib_destroying_delete 201806L // freestanding, also in <new>
481
  #define __cpp_lib_enable_shared_from_this 201603L // also in <memory>
482
+ #define __cpp_lib_endian 201907L // freestanding, also in <bit>
483
  #define __cpp_lib_erase_if 202002L
484
  // also in <string>, <deque>, <forward_list>, <list>, <vector>, <map>, <set>, <unordered_map>,
485
  // <unordered_set>
486
+ #define __cpp_lib_exception_ptr_cast 202506L // also in <exception>
487
+ #define __cpp_lib_exchange_function 201304L // freestanding, also in <utility>
488
  #define __cpp_lib_execution 201902L // also in <execution>
489
  #define __cpp_lib_expected 202211L // also in <expected>
490
  #define __cpp_lib_filesystem 201703L // also in <filesystem>
491
  #define __cpp_lib_flat_map 202207L // also in <flat_map>
492
  #define __cpp_lib_flat_set 202207L // also in <flat_set>
493
+ #define __cpp_lib_format 202311L // also in <format>
494
+ #define __cpp_lib_format_path 202506L // also in <filesystem>
495
  #define __cpp_lib_format_ranges 202207L // also in <format>
496
+ #define __cpp_lib_format_uchar 202311L // also in <format>
497
  #define __cpp_lib_formatters 202302L // also in <stacktrace>, <thread>
498
+ #define __cpp_lib_forward_like 202207L // freestanding, also in <utility>
499
+ #define __cpp_lib_freestanding_algorithm 202502L // freestanding, also in <algorithm>
500
+ #define __cpp_lib_freestanding_array 202311L // freestanding, also in <array>
501
+ #define __cpp_lib_freestanding_char_traits 202306L // freestanding, also in <string>
502
+ #define __cpp_lib_freestanding_charconv 202306L // freestanding, also in <charconv>
503
+ #define __cpp_lib_freestanding_cstdlib 202306L // freestanding, also in <cstdlib>, <cmath>
504
+ #define __cpp_lib_freestanding_cstring 202311L // freestanding, also in <cstring>
505
+ #define __cpp_lib_freestanding_cwchar 202306L // freestanding, also in <cwchar>
506
+ #define __cpp_lib_freestanding_errc 202306L
507
+ // freestanding, also in <cerrno>, <system_error>
508
+ #define __cpp_lib_freestanding_execution 202502L // freestanding, also in <execution>
509
+ #define __cpp_lib_freestanding_expected 202311L // freestanding, also in <expected>
510
+ #define __cpp_lib_freestanding_feature_test_macros 202306L // freestanding
511
+ #define __cpp_lib_freestanding_functional 202306L // freestanding, also in <functional>
512
+ #define __cpp_lib_freestanding_iterator 202306L // freestanding, also in <iterator>
513
+ #define __cpp_lib_freestanding_mdspan 202311L // freestanding, also in <mdspan>
514
+ #define __cpp_lib_freestanding_memory 202502L // freestanding, also in <memory>
515
+ #define __cpp_lib_freestanding_numeric 202502L // freestanding, also in <numeric>
516
+ #define __cpp_lib_freestanding_operator_new see below // freestanding, also in <new>
517
+ #define __cpp_lib_freestanding_optional 202506L // freestanding, also in <optional>
518
+ #define __cpp_lib_freestanding_random 202502L // freestanding, also in <random>
519
+ #define __cpp_lib_freestanding_ranges 202306L // freestanding, also in <ranges>
520
+ #define __cpp_lib_freestanding_ratio 202306L // freestanding, also in <ratio>
521
+ #define __cpp_lib_freestanding_string_view 202311L // freestanding, also in <string_view>
522
+ #define __cpp_lib_freestanding_tuple 202306L // freestanding, also in <tuple>
523
+ #define __cpp_lib_freestanding_utility 202306L // freestanding, also in <utility>
524
+ #define __cpp_lib_freestanding_variant 202311L // freestanding, also in <variant>
525
+ #define __cpp_lib_fstream_native_handle 202306L // also in <fstream>
526
+ #define __cpp_lib_function_ref 202306L // also in <functional>
527
  #define __cpp_lib_gcd_lcm 201606L // also in <numeric>
528
  #define __cpp_lib_generator 202207L // also in <generator>
529
  #define __cpp_lib_generic_associative_lookup 201304L // also in <map>, <set>
530
  #define __cpp_lib_generic_unordered_lookup 201811L
531
  // also in <unordered_map>, <unordered_set>
532
+ #define __cpp_lib_hardware_interference_size 201703L // freestanding, also in <new>
533
+ #define __cpp_lib_has_unique_object_representations 201606L // freestanding, also in <type_traits>
534
+ #define __cpp_lib_hazard_pointer 202306L // also in <hazard_pointer>
535
+ #define __cpp_lib_hive 202502L // also in <hive>
536
  #define __cpp_lib_hypot 201603L // also in <cmath>
537
  #define __cpp_lib_incomplete_container_elements 201505L
538
  // also in <forward_list>, <list>, <vector>
539
+ #define __cpp_lib_indirect 202502L // also in <memory>
540
+ #define __cpp_lib_inplace_vector 202406L // also in <inplace_vector>
541
+ #define __cpp_lib_int_pow2 202002L // freestanding, also in <bit>
542
  #define __cpp_lib_integer_comparison_functions 202002L // also in <utility>
543
+ #define __cpp_lib_integer_sequence 201304L // freestanding, also in <utility>
544
+ #define __cpp_lib_integral_constant_callable 201304L // freestanding, also in <type_traits>
545
  #define __cpp_lib_interpolate 201902L // also in <cmath>, <numeric>
546
+ #define __cpp_lib_invoke 201411L // freestanding, also in <functional>
547
+ #define __cpp_lib_invoke_r 202106L // freestanding, also in <functional>
548
  #define __cpp_lib_ios_noreplace 202207L // also in <ios>
549
+ #define __cpp_lib_is_aggregate 201703L // freestanding, also in <type_traits>
550
+ #define __cpp_lib_is_constant_evaluated 201811L // freestanding, also in <type_traits>
551
+ #define __cpp_lib_is_final 201402L // freestanding, also in <type_traits>
552
+ #define __cpp_lib_is_implicit_lifetime 202302L // freestanding, also in <type_traits>
553
+ #define __cpp_lib_is_invocable 201703L // freestanding, also in <type_traits>
554
+ #define __cpp_lib_is_layout_compatible 201907L // freestanding, also in <type_traits>
555
+ #define __cpp_lib_is_nothrow_convertible 201806L // freestanding, also in <type_traits>
556
+ #define __cpp_lib_is_null_pointer 201309L // freestanding, also in <type_traits>
557
+ #define __cpp_lib_is_pointer_interconvertible 201907L // freestanding, also in <type_traits>
558
+ #define __cpp_lib_is_scoped_enum 202011L // freestanding, also in <type_traits>
559
+ #define __cpp_lib_is_sufficiently_aligned 202411L // also in <memory>
560
+ #define __cpp_lib_is_swappable 201603L // freestanding, also in <type_traits>
561
+ #define __cpp_lib_is_virtual_base_of 202406L // freestanding, also in <type_traits>
562
+ #define __cpp_lib_is_within_lifetime 202306L // freestanding, also in <type_traits>
563
  #define __cpp_lib_jthread 201911L // also in <stop_token>, <thread>
564
  #define __cpp_lib_latch 201907L // also in <latch>
565
+ #define __cpp_lib_launder 201606L // freestanding, also in <new>
566
+ #define __cpp_lib_linalg 202412L // also in <linalg>
567
  #define __cpp_lib_list_remove_return_type 201806L // also in <forward_list>, <list>
568
+ #define __cpp_lib_logical_traits 201510L // freestanding, also in <type_traits>
569
+ #define __cpp_lib_make_from_tuple 201606L // freestanding, also in <tuple>
570
+ #define __cpp_lib_make_reverse_iterator 201402L // freestanding, also in <iterator>
571
  #define __cpp_lib_make_unique 201304L // also in <memory>
572
  #define __cpp_lib_map_try_emplace 201411L // also in <map>
573
  #define __cpp_lib_math_constants 201907L // also in <numbers>
574
  #define __cpp_lib_math_special_functions 201603L // also in <cmath>
575
+ #define __cpp_lib_mdspan 202406L // freestanding, also in <mdspan>
576
  #define __cpp_lib_memory_resource 201603L // also in <memory_resource>
577
+ #define __cpp_lib_modules 202207L // freestanding
578
+ #define __cpp_lib_move_iterator_concept 202207L // freestanding, also in <iterator>
579
  #define __cpp_lib_move_only_function 202110L // also in <functional>
580
  #define __cpp_lib_node_extract 201606L
581
  // also in <map>, <set>, <unordered_map>, <unordered_set>
582
  #define __cpp_lib_nonmember_container_access 201411L
583
+ // freestanding, also in <array>, <deque>, <forward_list>, <iterator>, <list>, <map>, <regex>, <set>,
584
+ // <string>, <unordered_map>, <unordered_set>, <vector>
585
+ #define __cpp_lib_not_fn 202306L // freestanding, also in <functional>
586
+ #define __cpp_lib_null_iterators 201304L // freestanding, also in <iterator>
587
+ #define __cpp_lib_observable_checkpoint 202506L // freestanding, also in <utility>
588
+ #define __cpp_lib_optional 202506L // also in <optional>
589
+ #define __cpp_lib_optional_range_support 202406L // freestanding, also in <optional>
590
+ #define __cpp_lib_out_ptr 202311L // freestanding, also in <memory>
591
+ #define __cpp_lib_parallel_algorithm 202506L
592
+ // also in <algorithm>, <numeric>, <memory>
593
+ #define __cpp_lib_parallel_scheduler 202506L // also in <execution>
594
+ #define __cpp_lib_philox_engine 202406L // also in <random>
595
+ #define __cpp_lib_polymorphic 202502L // also in <memory>
596
  #define __cpp_lib_polymorphic_allocator 201902L // also in <memory_resource>
597
+ #define __cpp_lib_print 202406L // also in <print>, <ostream>
598
  #define __cpp_lib_quoted_string_io 201304L // also in <iomanip>
599
+ #define __cpp_lib_ranges 202406L
600
  // also in <algorithm>, <functional>, <iterator>, <memory>, <ranges>
601
+ #define __cpp_lib_ranges_as_const 202311L // freestanding, also in <ranges>
602
+ #define __cpp_lib_ranges_as_rvalue 202207L // freestanding, also in <ranges>
603
+ #define __cpp_lib_ranges_cache_latest 202411L // freestanding, also in <ranges>
604
+ #define __cpp_lib_ranges_cartesian_product 202207L // freestanding, also in <ranges>
605
+ #define __cpp_lib_ranges_chunk 202202L // freestanding, also in <ranges>
606
+ #define __cpp_lib_ranges_chunk_by 202202L // freestanding, also in <ranges>
607
+ #define __cpp_lib_ranges_concat 202403L // freestanding, also in <ranges>
608
  #define __cpp_lib_ranges_contains 202207L // also in <algorithm>
609
+ #define __cpp_lib_ranges_enumerate 202302L // also in <ranges>
610
  #define __cpp_lib_ranges_find_last 202207L // also in <algorithm>
611
  #define __cpp_lib_ranges_fold 202207L // also in <algorithm>
612
+ #define __cpp_lib_ranges_generate_random 202403L // also in <random>
613
+ #define __cpp_lib_ranges_indices 202506L // also in <ranges>
614
  #define __cpp_lib_ranges_iota 202202L // also in <numeric>
615
+ #define __cpp_lib_ranges_join_with 202202L // freestanding, also in <ranges>
616
+ #define __cpp_lib_ranges_repeat 202207L // freestanding, also in <ranges>
617
+ #define __cpp_lib_ranges_reserve_hint 202502L // also in <ranges>
618
+ #define __cpp_lib_ranges_slide 202202L // freestanding, also in <ranges>
619
  #define __cpp_lib_ranges_starts_ends_with 202106L // also in <algorithm>
620
+ #define __cpp_lib_ranges_stride 202207L // freestanding, also in <ranges>
621
+ #define __cpp_lib_ranges_to_container 202202L // freestanding, also in <ranges>
622
+ #define __cpp_lib_ranges_to_input 202502L // freestanding, also in <ranges>
623
+ #define __cpp_lib_ranges_zip 202110L
624
+ // freestanding, also in <ranges>, <tuple>, <utility>
625
+ #define __cpp_lib_ratio 202306L // freestanding, also in <ratio>
626
+ #define __cpp_lib_raw_memory_algorithms 202411L // also in <memory>
627
+ #define __cpp_lib_rcu 202306L // also in <rcu>
628
+ #define __cpp_lib_reference_from_temporary 202202L // freestanding, also in <type_traits>
629
+ #define __cpp_lib_reference_wrapper 202403L // freestanding, also in <functional>
630
+ #define __cpp_lib_reflection 202506L // also in <meta>
631
+ #define __cpp_lib_remove_cvref 201711L // freestanding, also in <type_traits>
632
+ #define __cpp_lib_result_of_sfinae 201210L
633
+ // freestanding, also in <functional>, <type_traits>
634
  #define __cpp_lib_robust_nonmodifying_seq_ops 201304L // also in <algorithm>
635
  #define __cpp_lib_sample 201603L // also in <algorithm>
636
+ #define __cpp_lib_saturation_arithmetic 202311L // also in <numeric>
637
  #define __cpp_lib_scoped_lock 201703L // also in <mutex>
638
  #define __cpp_lib_semaphore 201907L // also in <semaphore>
639
+ #define __cpp_lib_senders 202506L // also in <execution>
640
  #define __cpp_lib_shared_mutex 201505L // also in <shared_mutex>
641
  #define __cpp_lib_shared_ptr_arrays 201707L // also in <memory>
642
  #define __cpp_lib_shared_ptr_weak_type 201606L // also in <memory>
643
  #define __cpp_lib_shared_timed_mutex 201402L // also in <shared_mutex>
644
  #define __cpp_lib_shift 202202L // also in <algorithm>
645
+ #define __cpp_lib_simd 202506L // also in <simd>
646
+ #define __cpp_lib_simd_complex 202502L // also in <simd>
647
+ #define __cpp_lib_simd_permutations 202506L // also in <simd>
648
  #define __cpp_lib_smart_ptr_for_overwrite 202002L // also in <memory>
649
+ #define __cpp_lib_smart_ptr_owner_equality 202306L // also in <memory>
650
+ #define __cpp_lib_source_location 201907L // freestanding, also in <source_location>
651
+ #define __cpp_lib_span 202311L // freestanding, also in <span>
652
+ #define __cpp_lib_span_initializer_list 202311L // freestanding, also in <span>
653
  #define __cpp_lib_spanstream 202106L // also in <spanstream>
654
+ #define __cpp_lib_ssize 201902L // freestanding, also in <iterator>
655
+ #define __cpp_lib_sstream_from_string_view 202306L // also in <sstream>
656
  #define __cpp_lib_stacktrace 202011L // also in <stacktrace>
657
+ #define __cpp_lib_start_lifetime_as 202207L // freestanding, also in <memory>
658
  #define __cpp_lib_starts_ends_with 201711L // also in <string>, <string_view>
659
  #define __cpp_lib_stdatomic_h 202011L // also in <stdatomic.h>
660
  #define __cpp_lib_string_contains 202011L // also in <string>, <string_view>
661
  #define __cpp_lib_string_resize_and_overwrite 202110L // also in <string>
662
+ #define __cpp_lib_string_subview 202506L // also in <string>, <string_view>
663
  #define __cpp_lib_string_udls 201304L // also in <string>
664
+ #define __cpp_lib_string_view 202403L // also in <string>, <string_view>
665
+ #define __cpp_lib_submdspan 202411L // freestanding, also in <mdspan>
666
  #define __cpp_lib_syncbuf 201803L // also in <syncstream>
667
+ #define __cpp_lib_task 202506L // also in <execution>
668
+ #define __cpp_lib_text_encoding 202306L // also in <text_encoding>
669
+ #define __cpp_lib_three_way_comparison 201907L // freestanding, also in <compare>
670
+ #define __cpp_lib_to_address 201711L // freestanding, also in <memory>
671
+ #define __cpp_lib_to_array 201907L // freestanding, also in <array>
672
+ #define __cpp_lib_to_chars 202306L // also in <charconv>
673
+ #define __cpp_lib_to_string 202306L // also in <string>
674
+ #define __cpp_lib_to_underlying 202102L // freestanding, also in <utility>
675
+ #define __cpp_lib_transformation_trait_aliases 201304L // freestanding, also in <type_traits>
676
+ #define __cpp_lib_transparent_operators 201510L
677
+ // freestanding, also in <memory>, <functional>
678
+ #define __cpp_lib_trivially_relocatable 202502L
679
+ // freestanding, also in <memory>, <type_traits>
680
+ #define __cpp_lib_tuple_element_t 201402L // freestanding, also in <tuple>
681
+ #define __cpp_lib_tuple_like 202311L
682
  // also in <utility>, <tuple>, <map>, <unordered_map>
683
+ #define __cpp_lib_tuples_by_type 201304L // freestanding, also in <utility>, <tuple>
684
+ #define __cpp_lib_type_identity 201806L // freestanding, also in <type_traits>
685
+ #define __cpp_lib_type_order 202506L // also in <compare>
686
+ #define __cpp_lib_type_trait_variable_templates 201510L // freestanding, also in <type_traits>
687
+ #define __cpp_lib_uncaught_exceptions 201411L // freestanding, also in <exception>
688
  #define __cpp_lib_unordered_map_try_emplace 201411L // also in <unordered_map>
689
+ #define __cpp_lib_unreachable 202202L // freestanding, also in <utility>
690
+ #define __cpp_lib_unwrap_ref 201811L // freestanding, also in <type_traits>
691
+ #define __cpp_lib_variant 202306L // also in <variant>
692
+ #define __cpp_lib_void_t 201411L // freestanding, also in <type_traits>
693
  ```
694
 
695
+ Additionally, each of the following macros is defined in a hardened
696
+ implementation:
697
+
698
+ ``` cpp
699
+ #define __cpp_lib_hardened_array 202502L // also in <array>
700
+ #define __cpp_lib_hardened_basic_stacktrace 202506L // also in <stacktrace>
701
+ #define __cpp_lib_hardened_basic_string 202502L // also in <string>
702
+ #define __cpp_lib_hardened_basic_string_view 202502L // also in <string_view>
703
+ #define __cpp_lib_hardened_bitset 202502L // also in <bitset>
704
+ #define __cpp_lib_hardened_common_iterator 202506L // also in <iterator>
705
+ #define __cpp_lib_hardened_counted_iterator 202506L // also in <iterator>
706
+ #define __cpp_lib_hardened_deque 202502L // also in <deque>
707
+ #define __cpp_lib_hardened_expected 202502L // also in <expected>
708
+ #define __cpp_lib_hardened_forward_list 202502L // also in <forward_list>
709
+ #define __cpp_lib_hardened_inplace_vector 202502L // also in <inplace_vector>
710
+ #define __cpp_lib_hardened_list 202502L // also in <list>
711
+ #define __cpp_lib_hardened_mdspan 202502L // also in <mdspan>
712
+ #define __cpp_lib_hardened_optional 202502L // also in <optional>
713
+ #define __cpp_lib_hardened_shared_ptr_array 202506L // also in <memory>
714
+ #define __cpp_lib_hardened_span 202502L // also in <span>
715
+ #define __cpp_lib_hardened_valarray 202502L // also in <valarray>
716
+ #define __cpp_lib_hardened_vector 202502L // also in <vector>
717
+ #define __cpp_lib_hardened_view_interface 202506L // also in <ranges>
718
+ ```
719
+
720
+ The macro `__cpp_lib_freestanding_operator_new` is defined to the
721
+ integer literal `202306L` if all the default versions of the replaceable
722
+ global allocation functions meet the requirements of a hosted
723
+ implementation, and to the integer literal `0` otherwise [[new.delete]].
724
+
725
+ *Recommended practice:* Freestanding implementations should only define
726
+ a macro from `<version>` if the implementation provides the
727
+ corresponding facility in its entirety.
728
+
729
+ *Recommended practice:* A non-hardened implementation should not define
730
+ macros from `<version>` required for hardened implementations.
731
+
732
  ### Header `<limits>` synopsis <a id="limits.syn">[[limits.syn]]</a>
733
 
734
  ``` cpp
735
  // all freestanding
736
  namespace std {
 
871
  #### `numeric_limits` members <a id="numeric.limits.members">[[numeric.limits.members]]</a>
872
 
873
  Each member function defined in this subclause is signal-safe
874
  [[support.signal]].
875
 
876
+ [*Note 1*: The arithmetic specification described in ISO/IEC
877
+ 10967-1:2012 is commonly termed LIA-1. — *end note*]
878
+
879
  ``` cpp
880
  static constexpr T min() noexcept;
881
  ```
882
 
883
  Minimum finite value.[^3]
 
912
  Number of `radix` digits that can be represented without change.
913
 
914
  For integer types, the number of non-sign bits in the representation.
915
 
916
  For floating-point types, the number of `radix` digits in the
917
+ significand.[^6]
918
 
919
  ``` cpp
920
  static constexpr int digits10;
921
  ```
922
 
 
1093
 
1094
  ``` cpp
1095
  static constexpr bool is_iec559;
1096
  ```
1097
 
1098
+ `true` if and only if the type adheres to ISO/IEC 60559.[^22]
1099
 
1100
  [*Note 1*: The value is `true` for any of the types `float16_t`,
1101
  `float32_t`, `float64_t`, or `float128_t`, if
1102
  present [[basic.extended.fp]]. — *end note*]
1103
 
 
1265
 
1266
  ### Header `<climits>` synopsis <a id="climits.syn">[[climits.syn]]</a>
1267
 
1268
  ``` cpp
1269
  // all freestanding
1270
+ #define BOOL_WIDTH see below
1271
  #define CHAR_BIT see below
1272
+ #define CHAR_WIDTH see below
1273
+ #define SCHAR_WIDTH see below
1274
+ #define UCHAR_WIDTH see below
1275
+ #define USHRT_WIDTH see below
1276
+ #define SHRT_WIDTH see below
1277
+ #define UINT_WIDTH see below
1278
+ #define INT_WIDTH see below
1279
+ #define ULONG_WIDTH see below
1280
+ #define LONG_WIDTH see below
1281
+ #define ULLONG_WIDTH see below
1282
+ #define LLONG_WIDTH see below
1283
  #define SCHAR_MIN see below
1284
  #define SCHAR_MAX see below
1285
  #define UCHAR_MAX see below
1286
  #define CHAR_MIN see below
1287
  #define CHAR_MAX see below
 
1299
  #define LLONG_MAX see below
1300
  #define ULLONG_MAX see below
1301
  ```
1302
 
1303
  The header `<climits>` defines all macros the same as the C standard
1304
+ library header `<limits.h>`, except that it does not define the macro
1305
+ `BITINT_MAXWIDTH`.
1306
 
1307
+ [*Note 1*: Except for the `WIDTH` macros, `CHAR_BIT`, and `MB_LEN_MAX`,
1308
+ a macro referring to an integer type `T` defines a constant whose type
1309
+ is the promoted type of `T` [[conv.prom]]. — *end note*]
1310
 
1311
+ See also: ISO C 5.3.5.3.2
1312
 
1313
  ### Header `<cfloat>` synopsis <a id="cfloat.syn">[[cfloat.syn]]</a>
1314
 
1315
  ``` cpp
1316
  // all freestanding
1317
+ #define __STDC_VERSION_FLOAT_H__ 202311L
1318
+
1319
  #define FLT_ROUNDS see below
1320
  #define FLT_EVAL_METHOD see below
 
 
 
1321
  #define FLT_RADIX see below
1322
+ #define INFINITY see below
1323
+ #define NAN see below
1324
+ #define FLT_SNAN see below
1325
+ #define DBL_SNAN see below
1326
+ #define LDBL_SNAN see below
1327
  #define FLT_MANT_DIG see below
1328
  #define DBL_MANT_DIG see below
1329
  #define LDBL_MANT_DIG see below
1330
  #define FLT_DECIMAL_DIG see below
1331
  #define DBL_DECIMAL_DIG see below
1332
  #define LDBL_DECIMAL_DIG see below
 
1333
  #define FLT_DIG see below
1334
  #define DBL_DIG see below
1335
  #define LDBL_DIG see below
1336
  #define FLT_MIN_EXP see below
1337
  #define DBL_MIN_EXP see below
 
1360
  ```
1361
 
1362
  The header `<cfloat>` defines all macros the same as the C standard
1363
  library header `<float.h>`.
1364
 
1365
+ See also: ISO C 5.3.5.3.3
1366
 
1367
  ## Arithmetic types <a id="support.arith.types">[[support.arith.types]]</a>
1368
 
1369
  ### Header `<cstdint>` synopsis <a id="cstdint.syn">[[cstdint.syn]]</a>
1370
 
1371
  The header `<cstdint>` supplies integer types having specified widths,
1372
  and macros that specify limits of integer types.
1373
 
1374
  ``` cpp
1375
  // all freestanding
1376
+ #define __STDC_VERSION_STDINT_H__ 202311L
1377
+
1378
  namespace std {
1379
  using int8_t = signed integer type; // optional
1380
  using int16_t = signed integer type; // optional
1381
  using int32_t = signed integer type; // optional
1382
  using int64_t = signed integer type; // optional
 
1420
  }
1421
 
1422
  #define INTN_MIN see below
1423
  #define INTN_MAX see below
1424
  #define UINTN_MAX see below
1425
+ #define INTN_WIDTH see below
1426
+ #define UINTN_WIDTH see below
1427
 
1428
  #define INT_FASTN_MIN see below
1429
  #define INT_FASTN_MAX see below
1430
  #define UINT_FASTN_MAX see below
1431
+ #define INT_FASTN_WIDTH see below
1432
+ #define UINT_FASTN_WIDTH see below
1433
 
1434
  #define INT_LEASTN_MIN see below
1435
  #define INT_LEASTN_MAX see below
1436
  #define UINT_LEASTN_MAX see below
1437
+ #define INT_LEASTN_WIDTH see below
1438
+ #define UINT_LEASTN_WIDTH see below
1439
 
1440
  #define INTMAX_MIN see below
1441
  #define INTMAX_MAX see below
1442
  #define UINTMAX_MAX see below
1443
+ #define INTMAX_WIDTH see below
1444
+ #define UINTMAX_WIDTH see below
1445
 
1446
  #define INTPTR_MIN see below // optional
1447
  #define INTPTR_MAX see below // optional
1448
  #define UINTPTR_MAX see below // optional
1449
+ #define INTPTR_WIDTH see below // optional
1450
+ #define UINTPTR_WIDTH see below // optional
1451
 
1452
  #define PTRDIFF_MIN see below
1453
  #define PTRDIFF_MAX see below
1454
+ #define PTRDIFF_WIDTH see below
1455
  #define SIZE_MAX see below
1456
+ #define SIZE_WIDTH see below
1457
 
1458
  #define SIG_ATOMIC_MIN see below
1459
  #define SIG_ATOMIC_MAX see below
1460
+ #define SIG_ATOMIC_WIDTH see below
1461
 
1462
  #define WCHAR_MIN see below
1463
  #define WCHAR_MAX see below
1464
+ #define WCHAR_WIDTH see below
1465
 
1466
  #define WINT_MIN see below
1467
  #define WINT_MAX see below
1468
+ #define WINT_WIDTH see below
1469
 
1470
  #define INTN_C(value) see below
1471
  #define UINTN_C(value) see below
1472
  #define INTMAX_C(value) see below
1473
  #define UINTMAX_C(value) see below
1474
  ```
1475
 
1476
  The header defines all types and macros the same as the C standard
1477
+ library header `<stdint.h>`. The types denoted by `intmax_t` and
1478
+ `uintmax_t` are not required to be able to represent all values of
1479
+ extended integer types wider than `long long` and `unsigned long long`,
1480
+ respectively.
1481
 
1482
+ See also: ISO C 7.22
1483
 
1484
  All types that use the placeholder *N* are optional when *N* is not `8`,
1485
  `16`, `32`, or `64`. The exact-width types `intN_t` and `uintN_t` for
1486
  *N* = `8`, `16`, `32`, and `64` are also optional; however, if an
1487
  implementation defines integer types with the corresponding width and no
 
1529
 
1530
  *Effects:* This function has the semantics specified in the C standard
1531
  library.
1532
 
1533
  *Remarks:* The program is terminated without executing destructors for
1534
+ objects with automatic, thread, or static storage duration and without
1535
  calling functions passed to `atexit()` [[basic.start.term]]. The
1536
  function `_Exit` is signal-safe [[support.signal]].
1537
 
1538
  ``` cpp
1539
  [[noreturn]] void abort() noexcept;
 
1637
  `_Exit(status)`.
1638
 
1639
  *Remarks:* The function `quick_exit` is signal-safe [[support.signal]]
1640
  when the functions registered with `at_quick_exit` are.
1641
 
1642
+ See also: ISO C 7.24.5
1643
 
1644
  ## Dynamic memory management <a id="support.dynamic">[[support.dynamic]]</a>
1645
 
1646
  ### General <a id="support.dynamic.general">[[support.dynamic.general]]</a>
1647
 
 
1677
  using new_handler = void (*)();
1678
  new_handler get_new_handler() noexcept;
1679
  new_handler set_new_handler(new_handler new_p) noexcept;
1680
 
1681
  // [ptr.launder], pointer optimization barrier
1682
+ template<class T> constexpr T* launder(T* p) noexcept;
1683
 
1684
  // [hardware.interference], hardware interference size
1685
  inline constexpr size_t hardware_destructive_interference_size = implementation-defined{};
1686
  inline constexpr size_t hardware_constructive_interference_size = implementation-defined{};
1687
  }
1688
 
1689
  // [new.delete], storage allocation and deallocation
1690
+ void* operator new(std::size_t size);
1691
+ void* operator new(std::size_t size, std::align_val_t alignment);
1692
+ void* operator new(std::size_t size, const std::nothrow_t&) noexcept;
1693
+ void* operator new(std::size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept;
 
1694
 
1695
  void operator delete(void* ptr) noexcept;
1696
  void operator delete(void* ptr, std::size_t size) noexcept;
1697
  void operator delete(void* ptr, std::align_val_t alignment) noexcept;
1698
  void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
1699
  void operator delete(void* ptr, const std::nothrow_t&) noexcept;
1700
  void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
1701
 
1702
+ void* operator new[](std::size_t size);
1703
+ void* operator new[](std::size_t size, std::align_val_t alignment);
1704
+ void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
1705
+ void* operator new[](std::size_t size, std::align_val_t alignment,
1706
  const std::nothrow_t&) noexcept;
1707
 
1708
  void operator delete[](void* ptr) noexcept;
1709
  void operator delete[](void* ptr, std::size_t size) noexcept;
1710
  void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
1711
  void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
1712
  void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
1713
  void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
1714
 
1715
+ constexpr void* operator new (std::size_t size, void* ptr) noexcept;
1716
+ constexpr void* operator new[](std::size_t size, void* ptr) noexcept;
1717
  void operator delete (void* ptr, void*) noexcept;
1718
  void operator delete[](void* ptr, void*) noexcept;
1719
  ```
1720
 
1721
  ### Storage allocation and deallocation <a id="new.delete">[[new.delete]]</a>
 
1726
  [[basic.stc.dynamic]] apply to the library versions of `operator new`
1727
  and `operator
1728
  delete`. If the value of an alignment argument passed to any of these
1729
  functions is not a valid alignment value, the behavior is undefined.
1730
 
1731
+ On freestanding implementations, it is *implementation-defined* whether
1732
+ the default versions of the replaceable global allocation functions
1733
+ satisfy the required behaviors described in [[new.delete.single]] and
1734
+ [[new.delete.array]].
1735
+
1736
+ [*Note 1*: A freestanding implementation’s default versions of the
1737
+ replaceable global allocation functions can cause undefined behavior
1738
+ when invoked. During constant evaluation, the behaviors of those default
1739
+ versions are irrelevant, as those calls are omitted
1740
+ [[expr.new]]. — *end note*]
1741
+
1742
+ *Recommended practice:* If any of the default versions of the
1743
+ replaceable global allocation functions meet the requirements of a
1744
+ hosted implementation, they all should.
1745
+
1746
  #### Single-object forms <a id="new.delete.single">[[new.delete.single]]</a>
1747
 
1748
  ``` cpp
1749
+ void* operator new(std::size_t size);
1750
+ void* operator new(std::size_t size, std::align_val_t alignment);
1751
  ```
1752
 
1753
  *Effects:* The allocation functions [[basic.stc.dynamic.allocation]]
1754
  called by a *new-expression*[[expr.new]] to allocate `size` bytes of
1755
  storage. The second form is called for a type with new-extended
1756
  alignment, and the first form is called otherwise.
1757
 
 
 
 
 
1758
  *Required behavior:* Return a non-null pointer to suitably aligned
1759
  storage [[basic.stc.dynamic]], or else throw a `bad_alloc` exception.
1760
  This requirement is binding on any replacement versions of these
1761
  functions.
1762
 
 
1773
  function [[new.handler]]. If the called function returns, the loop
1774
  repeats.
1775
  - The loop terminates when an attempt to allocate the requested storage
1776
  is successful or when a called `new_handler` function does not return.
1777
 
1778
+ *Remarks:* This function is replaceable [[term.replaceable.function]].
1779
+
1780
  ``` cpp
1781
+ void* operator new(std::size_t size, const std::nothrow_t&) noexcept;
1782
+ void* operator new(std::size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept;
 
1783
  ```
1784
 
1785
  *Effects:* Same as above, except that these are called by a placement
1786
  version of a *new-expression* when a C++ program prefers a null pointer
1787
  result as an error indication, instead of a `bad_alloc` exception.
1788
 
 
 
 
 
1789
  *Required behavior:* Return a non-null pointer to suitably aligned
1790
  storage [[basic.stc.dynamic]], or else return a null pointer. Each of
1791
  these nothrow versions of `operator new` returns a pointer obtained as
1792
  if acquired from the (possibly replaced) corresponding non-placement
1793
  function. This requirement is binding on any replacement versions of
 
1805
  T* p2 = new(nothrow) T; // returns nullptr if it fails
1806
  ```
1807
 
1808
  — *end example*]
1809
 
1810
+ *Remarks:* This function is replaceable [[term.replaceable.function]].
1811
+
1812
  ``` cpp
1813
  void operator delete(void* ptr) noexcept;
1814
  void operator delete(void* ptr, std::size_t size) noexcept;
1815
  void operator delete(void* ptr, std::align_val_t alignment) noexcept;
1816
  void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
 
1831
 
1832
  *Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
1833
  called by a *delete-expression*[[expr.delete]] to render the value of
1834
  `ptr` invalid.
1835
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1836
  *Required behavior:* A call to an `operator delete` with a `size`
1837
  parameter may be changed to a call to the corresponding
1838
  `operator delete` without a `size` parameter, without affecting memory
1839
  allocation.
1840
 
1841
+ [*Note 1*: A conforming implementation is for
1842
  `operator delete(void* ptr, std::size_t size)` to simply call
1843
  `operator delete(ptr)`. — *end note*]
1844
 
1845
  *Default behavior:* The functions that have a `size` parameter forward
1846
  their other parameters to the corresponding function without a `size`
1847
  parameter.
1848
 
1849
+ [*Note 2*: See the note in the below *Remarks:*
1850
  paragraph. — *end note*]
1851
 
1852
  *Default behavior:* If `ptr` is null, does nothing. Otherwise, reclaims
1853
  the storage allocated by the earlier call to `operator new`.
1854
 
1855
  *Remarks:* It is unspecified under what conditions part or all of such
1856
  reclaimed storage will be allocated by subsequent calls to
1857
  `operator new` or any of `aligned_alloc`, `calloc`, `malloc`, or
1858
+ `realloc`, declared in `<cstdlib>`. This function is
1859
+ replaceable [[term.replaceable.function]]. If a replacement function
1860
+ without a `size` parameter is defined by the program, the program should
1861
+ also define the corresponding function with a `size` parameter. If a
1862
+ replacement function with a `size` parameter is defined by the program,
1863
+ the program shall also define the corresponding version without the
1864
+ `size` parameter.
1865
+
1866
+ [*Note 3*: The default behavior above might change in the future, which
1867
+ will require replacing both deallocation functions when replacing the
1868
+ allocation function. — *end note*]
1869
 
1870
  ``` cpp
1871
  void operator delete(void* ptr, const std::nothrow_t&) noexcept;
1872
  void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
1873
  ```
 
1886
  *Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
1887
  called by the implementation to render the value of `ptr` invalid when
1888
  the constructor invoked from a nothrow placement version of the
1889
  *new-expression* throws an exception.
1890
 
 
 
 
 
1891
  *Default behavior:* Calls `operator delete(ptr)`, or
1892
  `operator delete(ptr, alignment)`, respectively.
1893
 
1894
+ *Remarks:* This function is replaceable [[term.replaceable.function]].
1895
+
1896
  #### Array forms <a id="new.delete.array">[[new.delete.array]]</a>
1897
 
1898
  ``` cpp
1899
+ void* operator new[](std::size_t size);
1900
+ void* operator new[](std::size_t size, std::align_val_t alignment);
1901
  ```
1902
 
1903
  *Effects:* The allocation functions [[basic.stc.dynamic.allocation]]
1904
  called by the array form of a *new-expression*[[expr.new]] to allocate
1905
  `size` bytes of storage. The second form is called for a type with
1906
  new-extended alignment, and the first form is called otherwise.[^31]
1907
 
 
 
 
 
1908
  *Required behavior:* Same as for the corresponding single-object forms.
1909
  This requirement is binding on any replacement versions of these
1910
  functions.
1911
 
1912
  *Default behavior:* Returns `operator new(size)`, or
1913
  `operator new(size, alignment)`, respectively.
1914
 
1915
+ *Remarks:* This function is replaceable [[term.replaceable.function]].
1916
+
1917
  ``` cpp
1918
+ void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
1919
+ void* operator new[](std::size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept;
 
1920
  ```
1921
 
1922
  *Effects:* Same as above, except that these are called by a placement
1923
  version of a *new-expression* when a C++ program prefers a null pointer
1924
  result as an error indication, instead of a `bad_alloc` exception.
1925
 
 
 
 
 
1926
  *Required behavior:* Return a non-null pointer to suitably aligned
1927
  storage [[basic.stc.dynamic]], or else return a null pointer. Each of
1928
  these nothrow versions of `operator new[]` returns a pointer obtained as
1929
  if acquired from the (possibly replaced) corresponding non-placement
1930
  function. This requirement is binding on any replacement versions of
 
1933
  *Default behavior:* Calls `operator new[](size)`, or
1934
  `operator new[](size, alignment)`, respectively. If the call returns
1935
  normally, returns the result of that call. Otherwise, returns a null
1936
  pointer.
1937
 
1938
+ *Remarks:* This function is replaceable [[term.replaceable.function]].
1939
+
1940
  ``` cpp
1941
  void operator delete[](void* ptr) noexcept;
1942
  void operator delete[](void* ptr, std::size_t size) noexcept;
1943
  void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
1944
  void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
 
1959
 
1960
  *Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
1961
  called by the array form of a *delete-expression* to render the value of
1962
  `ptr` invalid.
1963
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1964
  *Required behavior:* A call to an `operator delete[]` with a `size`
1965
  parameter may be changed to a call to the corresponding
1966
  `operator delete[]` without a `size` parameter, without affecting memory
1967
  allocation.
1968
 
1969
+ [*Note 1*: A conforming implementation is for
1970
  `operator delete[](void* ptr, std::size_t size)` to simply call
1971
  `operator delete[](ptr)`. — *end note*]
1972
 
1973
  *Default behavior:* The functions that have a `size` parameter forward
1974
  their other parameters to the corresponding function without a `size`
1975
  parameter. The functions that do not have a `size` parameter forward
1976
  their parameters to the corresponding `operator delete` (single-object)
1977
  function.
1978
 
1979
+ *Remarks:* This function is replaceable [[term.replaceable.function]].
1980
+ If a replacement function without a `size` parameter is defined by the
1981
+ program, the program should also define the corresponding function with
1982
+ a `size` parameter. If a replacement function with a `size` parameter is
1983
+ defined by the program, the program shall also define the corresponding
1984
+ version without the `size` parameter.
1985
+
1986
+ [*Note 2*: The default behavior above might change in the future, which
1987
+ will require replacing both deallocation functions when replacing the
1988
+ allocation function. — *end note*]
1989
+
1990
  ``` cpp
1991
  void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
1992
  void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
1993
  ```
1994
 
 
2006
  *Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
2007
  called by the implementation to render the value of `ptr` invalid when
2008
  the constructor invoked from a nothrow placement version of the array
2009
  *new-expression* throws an exception.
2010
 
 
 
 
 
2011
  *Default behavior:* Calls `operator delete[](ptr)`, or
2012
  `operator delete[](ptr, alignment)`, respectively.
2013
 
2014
+ *Remarks:* This function is replaceable [[term.replaceable.function]].
2015
+
2016
  #### Non-allocating forms <a id="new.delete.placement">[[new.delete.placement]]</a>
2017
 
2018
  These functions are reserved; a C++ program may not define functions
2019
  that displace the versions in the C++ standard library [[constraints]].
2020
  The provisions of  [[basic.stc.dynamic]] do not apply to these reserved
2021
  placement forms of `operator new` and `operator delete`.
2022
 
2023
  ``` cpp
2024
+ constexpr void* operator new(std::size_t size, void* ptr) noexcept;
2025
  ```
2026
 
2027
  *Returns:* `ptr`.
2028
 
2029
  *Remarks:* Intentionally performs no other action.
 
2038
  ```
2039
 
2040
  — *end example*]
2041
 
2042
  ``` cpp
2043
+ constexpr void* operator new[](std::size_t size, void* ptr) noexcept;
2044
  ```
2045
 
2046
  *Returns:* `ptr`.
2047
 
2048
  *Remarks:* Intentionally performs no other action.
 
2087
  ``` cpp
2088
  namespace std {
2089
  class bad_alloc : public exception {
2090
  public:
2091
  // see [exception] for the specification of the special member functions
2092
+ constexpr const char* what() const noexcept override;
2093
  };
2094
  }
2095
  ```
2096
 
2097
  The class `bad_alloc` defines the type of objects thrown as exceptions
2098
  by the implementation to report a failure to allocate storage.
2099
 
2100
  ``` cpp
2101
+ constexpr const char* what() const noexcept override;
2102
  ```
2103
 
2104
  *Returns:* An *implementation-defined* NTBS.
2105
 
2106
  #### Class `bad_array_new_length` <a id="new.badlength">[[new.badlength]]</a>
 
2108
  ``` cpp
2109
  namespace std {
2110
  class bad_array_new_length : public bad_alloc {
2111
  public:
2112
  // see [exception] for the specification of the special member functions
2113
+ constexpr const char* what() const noexcept override;
2114
  };
2115
  }
2116
  ```
2117
 
2118
  The class `bad_array_new_length` defines the type of objects thrown as
2119
  exceptions by the implementation to report an attempt to allocate an
2120
  array of size less than zero or greater than an *implementation-defined*
2121
  limit [[expr.new]].
2122
 
2123
  ``` cpp
2124
+ constexpr const char* what() const noexcept override;
2125
  ```
2126
 
2127
  *Returns:* An *implementation-defined* NTBS.
2128
 
2129
  #### Type `new_handler` <a id="new.handler">[[new.handler]]</a>
 
2167
  [*Note 1*: This can be a null pointer value. — *end note*]
2168
 
2169
  ### Pointer optimization barrier <a id="ptr.launder">[[ptr.launder]]</a>
2170
 
2171
  ``` cpp
2172
+ template<class T> constexpr T* launder(T* p) noexcept;
2173
  ```
2174
 
2175
  *Mandates:* `!is_function_v<T> && !is_void_v<T>` is `true`.
2176
 
2177
  *Preconditions:* `p` represents the address *A* of a byte in memory. An
 
2257
 
2258
  ### General <a id="support.rtti.general">[[support.rtti.general]]</a>
2259
 
2260
  The header `<typeinfo>` defines a type associated with type information
2261
  generated by the implementation. It also defines two types for reporting
2262
+ dynamic type identification errors. The header `<typeindex>` defines a
2263
+ wrapper type for use as an index type in associative containers
2264
+ [[associative]] and in unordered associative containers [[unord]].
2265
 
2266
  ### Header `<typeinfo>` synopsis <a id="typeinfo.syn">[[typeinfo.syn]]</a>
2267
 
2268
  ``` cpp
2269
  // all freestanding
 
2284
  constexpr bool operator==(const type_info& rhs) const noexcept;
2285
  bool before(const type_info& rhs) const noexcept;
2286
  size_t hash_code() const noexcept;
2287
  const char* name() const noexcept;
2288
 
2289
+ type_info(const type_info&) = delete;
2290
+ type_info& operator=(const type_info&) = delete;
2291
  };
2292
  }
2293
  ```
2294
 
2295
  The class `type_info` describes type information generated by the
 
2342
  ``` cpp
2343
  namespace std {
2344
  class bad_cast : public exception {
2345
  public:
2346
  // see [exception] for the specification of the special member functions
2347
+ constexpr const char* what() const noexcept override;
2348
  };
2349
  }
2350
  ```
2351
 
2352
  The class `bad_cast` defines the type of objects thrown as exceptions by
2353
  the implementation to report the execution of an invalid `dynamic_cast`
2354
  expression [[expr.dynamic.cast]].
2355
 
2356
  ``` cpp
2357
+ constexpr const char* what() const noexcept override;
2358
  ```
2359
 
2360
  *Returns:* An *implementation-defined* NTBS.
2361
 
2362
  ### Class `bad_typeid` <a id="bad.typeid">[[bad.typeid]]</a>
 
2364
  ``` cpp
2365
  namespace std {
2366
  class bad_typeid : public exception {
2367
  public:
2368
  // see [exception] for the specification of the special member functions
2369
+ constexpr const char* what() const noexcept override;
2370
  };
2371
  }
2372
  ```
2373
 
2374
  The class `bad_typeid` defines the type of objects thrown as exceptions
2375
  by the implementation to report a null pointer in a `typeid` expression
2376
  [[expr.typeid]].
2377
 
2378
  ``` cpp
2379
+ constexpr const char* what() const noexcept override;
2380
  ```
2381
 
2382
  *Returns:* An *implementation-defined* NTBS.
2383
 
2384
+ ### Header `<typeindex>` synopsis <a id="type.index.synopsis">[[type.index.synopsis]]</a>
2385
+
2386
+ ``` cpp
2387
+ #include <compare> // see [compare.syn]
2388
+
2389
+ namespace std {
2390
+ class type_index;
2391
+ template<class T> struct hash;
2392
+ template<> struct hash<type_index>;
2393
+ }
2394
+ ```
2395
+
2396
+ ### Class `type_index` <a id="type.index">[[type.index]]</a>
2397
+
2398
+ ``` cpp
2399
+ namespace std {
2400
+ class type_index {
2401
+ public:
2402
+ type_index(const type_info& rhs) noexcept;
2403
+ bool operator==(const type_index& rhs) const noexcept;
2404
+ bool operator< (const type_index& rhs) const noexcept;
2405
+ bool operator> (const type_index& rhs) const noexcept;
2406
+ bool operator<=(const type_index& rhs) const noexcept;
2407
+ bool operator>=(const type_index& rhs) const noexcept;
2408
+ strong_ordering operator<=>(const type_index& rhs) const noexcept;
2409
+ size_t hash_code() const noexcept;
2410
+ const char* name() const noexcept;
2411
+
2412
+ private:
2413
+ const type_info* target; // exposition only
2414
+ // Note that the use of a pointer here, rather than a reference,
2415
+ // means that the default copy/move constructor and assignment
2416
+ // operators will be provided and work as expected.
2417
+ };
2418
+ }
2419
+ ```
2420
+
2421
+ The class `type_index` provides a simple wrapper for `type_info` which
2422
+ can be used as an index type in associative containers [[associative]]
2423
+ and in unordered associative containers [[unord]].
2424
+
2425
+ ``` cpp
2426
+ type_index(const type_info& rhs) noexcept;
2427
+ ```
2428
+
2429
+ *Effects:* Constructs a `type_index` object, the equivalent of
2430
+ `target = &rhs`.
2431
+
2432
+ ``` cpp
2433
+ bool operator==(const type_index& rhs) const noexcept;
2434
+ ```
2435
+
2436
+ *Returns:* `*target == *rhs.target`.
2437
+
2438
+ ``` cpp
2439
+ bool operator<(const type_index& rhs) const noexcept;
2440
+ ```
2441
+
2442
+ *Returns:* `target->before(*rhs.target)`.
2443
+
2444
+ ``` cpp
2445
+ bool operator>(const type_index& rhs) const noexcept;
2446
+ ```
2447
+
2448
+ *Returns:* `rhs.target->before(*target)`.
2449
+
2450
+ ``` cpp
2451
+ bool operator<=(const type_index& rhs) const noexcept;
2452
+ ```
2453
+
2454
+ *Returns:* `!rhs.target->before(*target)`.
2455
+
2456
+ ``` cpp
2457
+ bool operator>=(const type_index& rhs) const noexcept;
2458
+ ```
2459
+
2460
+ *Returns:* `!target->before(*rhs.target)`.
2461
+
2462
+ ``` cpp
2463
+ strong_ordering operator<=>(const type_index& rhs) const noexcept;
2464
+ ```
2465
+
2466
+ *Effects:* Equivalent to:
2467
+
2468
+ ``` cpp
2469
+ if (*target == *rhs.target) return strong_ordering::equal;
2470
+ if (target->before(*rhs.target)) return strong_ordering::less;
2471
+ return strong_ordering::greater;
2472
+ ```
2473
+
2474
+ ``` cpp
2475
+ size_t hash_code() const noexcept;
2476
+ ```
2477
+
2478
+ *Returns:* `target->hash_code()`.
2479
+
2480
+ ``` cpp
2481
+ const char* name() const noexcept;
2482
+ ```
2483
+
2484
+ *Returns:* `target->name()`.
2485
+
2486
+ ``` cpp
2487
+ template<> struct hash<type_index>;
2488
+ ```
2489
+
2490
+ For an object `index` of type `type_index`, `hash<type_index>()(index)`
2491
+ shall evaluate to the same result as `index.hash_code()`.
2492
+
2493
  ## Source location <a id="support.srcloc">[[support.srcloc]]</a>
2494
 
2495
  ### Header `<source_location>` synopsis <a id="source.location.syn">[[source.location.syn]]</a>
2496
 
2497
  The header `<source_location>` defines the class `source_location` that
 
2577
  [[support.srcloc.current]].
2578
  - Otherwise, when invoked in some other way, returns a `source_location`
2579
  whose data members are initialized with valid but unspecified values.
2580
 
2581
  *Remarks:* Any call to `current` that appears as a default member
2582
+ initializer [[class.mem.general]], or as a subexpression thereof, should
2583
  correspond to the location of the constructor definition or aggregate
2584
  initialization that uses the default member initializer. Any call to
2585
  `current` that appears as a default argument [[dcl.fct.default]], or as
2586
  a subexpression thereof, should correspond to the location of the
2587
  invocation of the function that uses the default argument [[expr.call]].
 
2667
  using terminate_handler = void (*)();
2668
  terminate_handler get_terminate() noexcept;
2669
  terminate_handler set_terminate(terminate_handler f) noexcept;
2670
  [[noreturn]] void terminate() noexcept;
2671
 
2672
+ constexpr int uncaught_exceptions() noexcept;
2673
 
2674
  using exception_ptr = unspecified;
2675
 
2676
+ constexpr exception_ptr current_exception() noexcept;
2677
+ [[noreturn]] constexpr void rethrow_exception(exception_ptr p);
2678
+ template<class E> constexpr exception_ptr make_exception_ptr(E e) noexcept;
2679
+ template<class E> constexpr const E* exception_ptr_cast(const exception_ptr& p) noexcept;
2680
+ template<class E> void exception_ptr_cast(const exception_ptr&&) = delete;
2681
 
2682
+ template<class T> [[noreturn]] constexpr void throw_with_nested(T&& t);
2683
+ template<class E> constexpr void rethrow_if_nested(const E& e);
2684
  }
2685
  ```
2686
 
2687
  ### Class `exception` <a id="exception">[[exception]]</a>
2688
 
2689
  ``` cpp
2690
  namespace std {
2691
  class exception {
2692
  public:
2693
+ constexpr exception() noexcept;
2694
+ constexpr exception(const exception&) noexcept;
2695
+ constexpr exception& operator=(const exception&) noexcept;
2696
+ constexpr virtual ~exception();
2697
+ constexpr virtual const char* what() const noexcept;
2698
  };
2699
  }
2700
  ```
2701
 
2702
  The class `exception` defines the base class for the types of objects
2703
  thrown as exceptions by C++ standard library components, and certain
2704
  expressions, to report errors detected during program execution.
2705
 
2706
+ Except where explicitly specified otherwise, each standard library class
2707
+ `T` that derives from class `exception` has the following publicly
2708
+ accessible member functions, each of them having a non-throwing
2709
+ exception specification [[except.spec]]:
2710
 
2711
  - default constructor (unless the class synopsis shows other
2712
  constructors)
2713
  - copy constructor
2714
  - copy assignment operator
 
2718
  and `lhs` is a copy of `rhs`, then `strcmp(lhs.what(), rhs.what())` is
2719
  equal to `0`. The `what()` member function of each such `T` satisfies
2720
  the constraints specified for `exception::what()` (see below).
2721
 
2722
  ``` cpp
2723
+ constexpr exception(const exception& rhs) noexcept;
2724
+ constexpr exception& operator=(const exception& rhs) noexcept;
2725
  ```
2726
 
2727
  *Ensures:* If `*this` and `rhs` both have dynamic type `exception` then
2728
  the value of the expression `strcmp(what(), rhs.what())` shall equal 0.
2729
 
2730
  ``` cpp
2731
+ constexpr virtual ~exception();
2732
  ```
2733
 
2734
  *Effects:* Destroys an object of class `exception`.
2735
 
2736
  ``` cpp
2737
+ constexpr virtual const char* what() const noexcept;
2738
  ```
2739
 
2740
+ *Returns:* An *implementation-defined* NTBS, which during constant
2741
+ evaluation is encoded with the ordinary literal encoding [[lex.ccon]].
2742
 
2743
  *Remarks:* The message may be a null-terminated multibyte
2744
  string [[multibyte.strings]], suitable for conversion and display as a
2745
  `wstring` [[string.classes]], [[locale.codecvt]]. The return value
2746
  remains valid until the exception object from which it is obtained is
 
2752
  ``` cpp
2753
  namespace std {
2754
  class bad_exception : public exception {
2755
  public:
2756
  // see [exception] for the specification of the special member functions
2757
+ constexpr const char* what() const noexcept override;
2758
  };
2759
  }
2760
  ```
2761
 
2762
  The class `bad_exception` defines the type of the object referenced by
2763
  the `exception_ptr` returned from a call to `current_exception`
2764
  [[propagation]] when the currently active exception object fails to
2765
  copy.
2766
 
2767
  ``` cpp
2768
+ constexpr const char* what() const noexcept override;
2769
  ```
2770
 
2771
  *Returns:* An *implementation-defined* NTBS.
2772
 
2773
  ### Abnormal termination <a id="exception.terminate">[[exception.terminate]]</a>
 
2830
  called directly by the program.
2831
 
2832
  ### `uncaught_exceptions` <a id="uncaught.exceptions">[[uncaught.exceptions]]</a>
2833
 
2834
  ``` cpp
2835
+ constexpr int uncaught_exceptions() noexcept;
2836
  ```
2837
 
2838
+ *Returns:* The number of uncaught exceptions [[except.throw]] in the
2839
+ current thread.
2840
 
2841
  *Remarks:* When `uncaught_exceptions() > 0`, throwing an exception can
2842
  result in a call of the function `std::terminate` [[except.terminate]].
2843
 
2844
  ### Exception propagation <a id="propagation">[[propagation]]</a>
 
2865
  as `exception_ptr`. — *end note*]
2866
 
2867
  For purposes of determining the presence of a data race, operations on
2868
  `exception_ptr` objects shall access and modify only the `exception_ptr`
2869
  objects themselves and not the exceptions they refer to. Use of
2870
+ `rethrow_exception` or `exception_ptr_cast` on `exception_ptr` objects
2871
+ that refer to the same exception object shall not introduce a data race.
2872
 
2873
  [*Note 2*: If `rethrow_exception` rethrows the same exception object
2874
  (rather than a copy), concurrent access to that rethrown exception
2875
  object can introduce a data race. Changes in the number of
2876
  `exception_ptr` objects that refer to a particular exception do not
2877
  introduce a data race. — *end note*]
2878
 
2879
+ All member functions are marked `constexpr`.
2880
+
2881
  ``` cpp
2882
+ constexpr exception_ptr current_exception() noexcept;
2883
  ```
2884
 
2885
  *Returns:* An `exception_ptr` object that refers to the currently
2886
  handled exception [[except.handle]] or a copy of the currently handled
2887
  exception, or a null `exception_ptr` object if no exception is being
 
2899
  the function returns an `exception_ptr` object that refers to the thrown
2900
  exception or, if this is not possible, to an instance of
2901
  `bad_exception`.
2902
 
2903
  [*Note 4*: The copy constructor of the thrown exception can also fail,
2904
+ so the implementation can substitute a `bad_exception` object to avoid
2905
+ infinite recursion. — *end note*]
2906
 
2907
  ``` cpp
2908
+ [[noreturn]] constexpr void rethrow_exception(exception_ptr p);
2909
  ```
2910
 
2911
  *Preconditions:* `p` is not a null pointer.
2912
 
2913
  *Effects:* Let u be the exception object to which `p` refers, or a copy
 
2919
  - otherwise, if copying the exception to which `p` refers to form u
2920
  throws an exception, throws that exception;
2921
  - otherwise, throws u.
2922
 
2923
  ``` cpp
2924
+ template<class E> constexpr exception_ptr make_exception_ptr(E e) noexcept;
2925
  ```
2926
 
2927
  *Effects:* Creates an `exception_ptr` object that refers to a copy of
2928
  `e`, as if:
2929
 
 
2936
  ```
2937
 
2938
  [*Note 5*: This function is provided for convenience and efficiency
2939
  reasons. — *end note*]
2940
 
2941
+ ``` cpp
2942
+ template<class E> constexpr const E* exception_ptr_cast(const exception_ptr& p) noexcept;
2943
+ ```
2944
+
2945
+ *Mandates:* `E` is a cv-unqualified complete object type. `E` is not an
2946
+ array type. `E` is not a pointer or pointer-to-member type.
2947
+
2948
+ [*Note 6*: When `E` is a pointer or pointer-to-member type, a handler
2949
+ of type `const E&` can match without binding to the exception object
2950
+ itself. — *end note*]
2951
+
2952
+ *Returns:* A pointer to the exception object referred to by `p`, if `p`
2953
+ is not null and a handler of type `const E&` would be a
2954
+ match [[except.handle]] for that exception object. Otherwise, `nullptr`.
2955
+
2956
  ### `nested_exception` <a id="except.nested">[[except.nested]]</a>
2957
 
2958
  ``` cpp
2959
  namespace std {
2960
  class nested_exception {
2961
  public:
2962
+ constexpr nested_exception() noexcept;
2963
+ constexpr nested_exception(const nested_exception&) noexcept = default;
2964
+ constexpr nested_exception& operator=(const nested_exception&) noexcept = default;
2965
+ constexpr virtual ~nested_exception() = default;
2966
 
2967
  // access functions
2968
+ [[noreturn]] constexpr void rethrow_nested() const;
2969
+ constexpr exception_ptr nested_ptr() const noexcept;
2970
  };
2971
 
2972
+ template<class T> [[noreturn]] constexpr void throw_with_nested(T&& t);
2973
+ template<class E> constexpr void rethrow_if_nested(const E& e);
2974
  }
2975
  ```
2976
 
2977
  The class `nested_exception` is designed for use as a mixin through
2978
  multiple inheritance. It captures the currently handled exception and
 
2981
  [*Note 1*: `nested_exception` has a virtual destructor to make it a
2982
  polymorphic class. Its presence can be tested for with
2983
  `dynamic_cast`. — *end note*]
2984
 
2985
  ``` cpp
2986
+ constexpr nested_exception() noexcept;
2987
  ```
2988
 
2989
  *Effects:* The constructor calls `current_exception()` and stores the
2990
  returned value.
2991
 
2992
  ``` cpp
2993
+ [[noreturn]] constexpr void rethrow_nested() const;
2994
  ```
2995
 
2996
  *Effects:* If `nested_ptr()` returns a null pointer, the function calls
2997
  the function `std::terminate`. Otherwise, it throws the stored exception
2998
  captured by `*this`.
2999
 
3000
  ``` cpp
3001
+ constexpr exception_ptr nested_ptr() const noexcept;
3002
  ```
3003
 
3004
  *Returns:* The stored exception captured by this `nested_exception`
3005
  object.
3006
 
3007
  ``` cpp
3008
+ template<class T> [[noreturn]] constexpr void throw_with_nested(T&& t);
3009
  ```
3010
 
3011
  Let `U` be `decay_t<T>`.
3012
 
3013
  *Preconditions:* `U` meets the *Cpp17CopyConstructible* requirements.
 
3017
  is `true`, an exception of unspecified type that is publicly derived
3018
  from both `U` and `nested_exception` and constructed from
3019
  `std::forward<T>(t)`, otherwise `std::forward<T>(t)`.
3020
 
3021
  ``` cpp
3022
+ template<class E> constexpr void rethrow_if_nested(const E& e);
3023
  ```
3024
 
3025
  *Effects:* If `E` is not a polymorphic class type, or if
3026
  `nested_exception` is an inaccessible or ambiguous base class of `E`,
3027
  there is no effect. Otherwise, performs:
 
3029
  ``` cpp
3030
  if (auto p = dynamic_cast<const nested_exception*>(addressof(e)))
3031
  p->rethrow_nested();
3032
  ```
3033
 
3034
+ ## Contract-violation handling <a id="support.contract">[[support.contract]]</a>
3035
+
3036
+ ### Header `<contracts>` synopsis <a id="contracts.syn">[[contracts.syn]]</a>
3037
+
3038
+ The header `<contracts>` defines types for reporting information about
3039
+ contract violations [[basic.contract.eval]].
3040
+
3041
+ ``` cpp
3042
+ // all freestanding
3043
+ namespace std::contracts {
3044
+
3045
+ enum class assertion_kind : unspecified {
3046
+ pre = 1,
3047
+ post = 2,
3048
+ assert = 3
3049
+ };
3050
+
3051
+ enum class evaluation_semantic : unspecified {
3052
+ ignore = 1,
3053
+ observe = 2,
3054
+ enforce = 3,
3055
+ quick_enforce = 4
3056
+ };
3057
+
3058
+ enum class detection_mode : unspecified {
3059
+ predicate_false = 1,
3060
+ evaluation_exception = 2
3061
+ };
3062
+
3063
+ class contract_violation {
3064
+ // no user-accessible constructor
3065
+ public:
3066
+ contract_violation(const contract_violation&) = delete;
3067
+ contract_violation& operator=(const contract_violation&) = delete;
3068
+
3069
+ see below ~contract_violation();
3070
+
3071
+ const char* comment() const noexcept;
3072
+ contracts::detection_mode detection_mode() const noexcept;
3073
+ exception_ptr evaluation_exception() const noexcept;
3074
+ bool is_terminating() const noexcept;
3075
+ assertion_kind kind() const noexcept;
3076
+ source_location location() const noexcept;
3077
+ evaluation_semantic semantic() const noexcept;
3078
+ };
3079
+
3080
+ void invoke_default_contract_violation_handler(const contract_violation&);
3081
+ }
3082
+ ```
3083
+
3084
+ ### Enumerations <a id="support.contract.enum">[[support.contract.enum]]</a>
3085
+
3086
+ *Recommended practice:* For all enumerations in
3087
+ [[support.contract.enum]], if implementation-defined enumerators are
3088
+ provided, they should have a minimum value of 1000.
3089
+
3090
+ The enumerators of `assertion_kind` correspond to the syntactic forms of
3091
+ a contract assertion [[basic.contract.general]], with meanings listed in
3092
+ Table  [[tab:support.contract.enum.kind]].
3093
+
3094
+ **Table: Enum `assertion_kind`** <a id="support.contract.enum.kind">[support.contract.enum.kind]</a>
3095
+
3096
+ | Name | Meaning |
3097
+ | -------- | ------------------------- |
3098
+ | `pre` | A precondition assertion |
3099
+ | `post` | A postcondition assertion |
3100
+ | `assert` | An *assertion-statement* |
3101
+
3102
+
3103
+ The enumerators of `evaluation_semantic` correspond to the evaluation
3104
+ semantics with which a contract assertion may be evaluated
3105
+ [[basic.contract.eval]], with meanings listed in Table 
3106
+ [[tab:support.contract.enum.semantic]].
3107
+
3108
+ **Table: Enum `evaluation_semantic`** <a id="support.contract.enum.semantic">[support.contract.enum.semantic]</a>
3109
+
3110
+ | Name | Meaning |
3111
+ | --------------- | --------------------------------- |
3112
+ | `ignore` | Ignore evaluation semantic |
3113
+ | `observe` | Observe evaluation semantic |
3114
+ | `enforce` | Enforce evaluation semantic |
3115
+ | `quick_enforce` | Quick-enforce evaluation semantic |
3116
+
3117
+
3118
+ The enumerators of `detection_mode` correspond to the manners in which a
3119
+ contract violation can be identified [[basic.contract.eval]], with
3120
+ meanings listed in Table~ [[tab:support.contract.enum.detection]].
3121
+
3122
+ **Table: Enum `detection_mode`** <a id="support.contract.enum.detection">[support.contract.enum.detection]</a>
3123
+
3124
+ | Name | Meaning |
3125
+ | ---------------------- | ------------------------------------------------------------------------------------------------ |
3126
+ | `predicate_false` | The predicate of the contract assertion evaluated to `false` or would have evaluated to `false`. |
3127
+ | `evaluation_exception` | An uncaught exception occurred during evaluation of the contract assertion. |
3128
+
3129
+
3130
+ ### Class `contract_violation` <a id="support.contract.violation">[[support.contract.violation]]</a>
3131
+
3132
+ The class `contract_violation` defines the type of objects used to
3133
+ represent a contract violation that has been detected during the
3134
+ evaluation of a contract assertion with a particular evaluation semantic
3135
+ [[basic.contract.eval]]. Objects of this type can be created only by the
3136
+ implementation. It is *implementation-defined* whether the destructor is
3137
+ virtual.
3138
+
3139
+ ``` cpp
3140
+ const char* comment() const noexcept;
3141
+ ```
3142
+
3143
+ *Returns:* An *implementation-defined* NTMBS in the ordinary literal
3144
+ encoding [[lex.charset]].
3145
+
3146
+ *Recommended practice:* The string returned should contain a textual
3147
+ representation of the predicate of the violated contract assertion or an
3148
+ empty string if storing a textual representation is undesired.
3149
+
3150
+ [*Note 1*: The string can represent a truncated, reformatted, or
3151
+ summarized rendering of the predicate, before or after
3152
+ preprocessing. — *end note*]
3153
+
3154
+ ``` cpp
3155
+ contracts::detection_mode detection_mode() const noexcept;
3156
+ ```
3157
+
3158
+ *Returns:* The enumerator value corresponding to the manner in which the
3159
+ contract violation was identified.
3160
+
3161
+ ``` cpp
3162
+ exception_ptr evaluation_exception() const noexcept;
3163
+ ```
3164
+
3165
+ *Returns:* If the contract violation occurred because the evaluation of
3166
+ the predicate exited via an exception, an `exception_ptr` object that
3167
+ refers to that exception or a copy of that exception; otherwise, a null
3168
+ `exception_ptr` object.
3169
+
3170
+ ``` cpp
3171
+ bool is_terminating() const noexcept;
3172
+ ```
3173
+
3174
+ *Returns:* `true` if the evaluation semantic is a terminating
3175
+ semantic [[basic.contract.eval]]; otherwise, `false`.
3176
+
3177
+ ``` cpp
3178
+ assertion_kind kind() const noexcept;
3179
+ ```
3180
+
3181
+ *Returns:* The enumerator value corresponding to the syntactic form of
3182
+ the violated contract assertion.
3183
+
3184
+ ``` cpp
3185
+ source_location location() const noexcept;
3186
+ ```
3187
+
3188
+ *Returns:* A `source_location` object with *implementation-defined*
3189
+ value.
3190
+
3191
+ *Recommended practice:* The value returned should be a default
3192
+ constructed `source_location` object or a value identifying the violated
3193
+ contract assertion:
3194
+
3195
+ - When possible, if the violated contract assertion was a precondition,
3196
+ the source location of the function invocation should be returned.
3197
+ - Otherwise, the source location of the contract assertion should be
3198
+ returned.
3199
+
3200
+ ``` cpp
3201
+ evaluation_semantic semantic() const noexcept;
3202
+ ```
3203
+
3204
+ *Returns:* The enumerator value corresponding to the evaluation semantic
3205
+ with which the violated contract assertion was evaluated.
3206
+
3207
+ ### Invoke default handler <a id="support.contract.invoke">[[support.contract.invoke]]</a>
3208
+
3209
+ ``` cpp
3210
+ void invoke_default_contract_violation_handler(const contract_violation& v);
3211
+ ```
3212
+
3213
+ *Effects:* Invokes the default contract-violation
3214
+ handler [[basic.contract.handler]] with the argument `v`.
3215
+
3216
  ## Initializer lists <a id="support.initlist">[[support.initlist]]</a>
3217
 
3218
  ### General <a id="support.initlist.general">[[support.initlist.general]]</a>
3219
 
3220
  The header `<initializer_list>` defines a class template and several
 
3254
  objects of type `const E`.
3255
 
3256
  [*Note 1*: A pair of pointers or a pointer plus a length would be
3257
  obvious representations for `initializer_list`. `initializer_list` is
3258
  used to implement initializer lists as specified in  [[dcl.init.list]].
3259
+ Copying an `initializer_list` does not copy the underlying
3260
  elements. — *end note*]
3261
 
3262
  If an explicit specialization or partial specialization of
3263
  `initializer_list` is declared, the program is ill-formed.
3264
 
 
3336
  template<class... Ts>
3337
  struct common_comparison_category {
3338
  using type = see below;
3339
  };
3340
  template<class... Ts>
3341
+ using common_comparison_category_t = common_comparison_category<Ts...>::type;
3342
 
3343
  // [cmp.concept], concept three_way_comparable
3344
  template<class T, class Cat = partial_ordering>
3345
  concept three_way_comparable = see below;
3346
  template<class T, class U, class Cat = partial_ordering>
 
3348
 
3349
  // [cmp.result], result of three-way comparison
3350
  template<class T, class U = T> struct compare_three_way_result;
3351
 
3352
  template<class T, class U = T>
3353
+ using compare_three_way_result_t = compare_three_way_result<T, U>::type;
3354
 
3355
  // [comparisons.three.way], class compare_three_way
3356
  struct compare_three_way;
3357
 
3358
  // [cmp.alg], comparison algorithms
 
3362
  inline constexpr unspecified partial_order = unspecified;
3363
  inline constexpr unspecified compare_strong_order_fallback = unspecified;
3364
  inline constexpr unspecified compare_weak_order_fallback = unspecified;
3365
  inline constexpr unspecified compare_partial_order_fallback = unspecified;
3366
  }
3367
+
3368
+ // [compare.type], type ordering
3369
+ template<class T, class U>
3370
+ struct type_order;
3371
+
3372
+ template<class T, class U>
3373
+ constexpr strong_ordering type_order_v = type_order<T, U>::value;
3374
  }
3375
  ```
3376
 
3377
  ### Comparison category types <a id="cmp.categories">[[cmp.categories]]</a>
3378
 
 
3406
  — *end example*]
3407
 
3408
  In this context, the behavior of a program that supplies an argument
3409
  other than a literal `0` is undefined.
3410
 
3411
+ For the purposes of [[cmp.categories]], *substitutability* is the
3412
+ property that `f(a) == f(b)` is `true` whenever `a == b` is `true`,
3413
  where `f` denotes a function that reads only comparison-salient state
3414
  that is accessible via the argument’s public const members.
3415
 
3416
  #### Class `partial_ordering` <a id="cmp.partialord">[[cmp.partialord]]</a>
3417
 
 
3423
 
3424
  ``` cpp
3425
  namespace std {
3426
  class partial_ordering {
3427
  int value; // exposition only
3428
+ bool is-ordered; // exposition only
3429
 
3430
  // exposition-only constructors
3431
  constexpr explicit
3432
+ partial_ordering(ord v) noexcept : value(int(v)), is-ordered(true) {} // exposition only
3433
  constexpr explicit
3434
+ partial_ordering(ncmp v) noexcept : value(int(v)), is-ordered(false) {} // exposition only
3435
 
3436
  public:
3437
  // valid values
3438
  static const partial_ordering less;
3439
  static const partial_ordering equivalent;
 
3469
  constexpr bool operator> (partial_ordering v, unspecified) noexcept;
3470
  constexpr bool operator<=(partial_ordering v, unspecified) noexcept;
3471
  constexpr bool operator>=(partial_ordering v, unspecified) noexcept;
3472
  ```
3473
 
3474
+ *Returns:* For `operator`, `v.`*`is-ordered`*` && v.`*`value`*` 0`.
3475
 
3476
  ``` cpp
3477
  constexpr bool operator< (unspecified, partial_ordering v) noexcept;
3478
  constexpr bool operator> (unspecified, partial_ordering v) noexcept;
3479
  constexpr bool operator<=(unspecified, partial_ordering v) noexcept;
3480
  constexpr bool operator>=(unspecified, partial_ordering v) noexcept;
3481
  ```
3482
 
3483
+ *Returns:* For `operator`, `v.`*`is-ordered`*` && 0 v.`*`value`*.
3484
 
3485
  ``` cpp
3486
  constexpr partial_ordering operator<=>(partial_ordering v, unspecified) noexcept;
3487
  ```
3488
 
 
3559
  constexpr bool operator> (weak_ordering v, unspecified) noexcept;
3560
  constexpr bool operator<=(weak_ordering v, unspecified) noexcept;
3561
  constexpr bool operator>=(weak_ordering v, unspecified) noexcept;
3562
  ```
3563
 
3564
+ *Returns:* `v.`*`value`*` 0` for `operator`.
3565
 
3566
  ``` cpp
3567
  constexpr bool operator< (unspecified, weak_ordering v) noexcept;
3568
  constexpr bool operator> (unspecified, weak_ordering v) noexcept;
3569
  constexpr bool operator<=(unspecified, weak_ordering v) noexcept;
3570
  constexpr bool operator>=(unspecified, weak_ordering v) noexcept;
3571
  ```
3572
 
3573
+ *Returns:* `0 v.`*`value`* for `operator`.
3574
 
3575
  ``` cpp
3576
  constexpr weak_ordering operator<=>(weak_ordering v, unspecified) noexcept;
3577
  ```
3578
 
 
3664
  constexpr bool operator> (strong_ordering v, unspecified) noexcept;
3665
  constexpr bool operator<=(strong_ordering v, unspecified) noexcept;
3666
  constexpr bool operator>=(strong_ordering v, unspecified) noexcept;
3667
  ```
3668
 
3669
+ *Returns:* `v.`*`value`*` 0` for `operator`.
3670
 
3671
  ``` cpp
3672
  constexpr bool operator< (unspecified, strong_ordering v) noexcept;
3673
  constexpr bool operator> (unspecified, strong_ordering v) noexcept;
3674
  constexpr bool operator<=(unspecified, strong_ordering v) noexcept;
3675
  constexpr bool operator>=(unspecified, strong_ordering v) noexcept;
3676
  ```
3677
 
3678
+ *Returns:* `0 v.`*`value`* for `operator`.
3679
 
3680
  ``` cpp
3681
  constexpr strong_ordering operator<=>(strong_ordering v, unspecified) noexcept;
3682
  ```
3683
 
 
3736
  };
3737
  ```
3738
 
3739
  Let `t` and `u` be lvalues of types `const remove_reference_t<T>` and
3740
  `const remove_reference_t<U>`, respectively. `T` and `U` model
3741
+ `partially-ordered-with<T, U>` only if
3742
 
3743
  - `t < u`, `t <= u`, `t > u`, `t >= u`, `u < t`, `u <= t`, `u > t`, and
3744
+ `u >= t` have the same domain,
3745
  - `bool(t < u) == bool(u > t)` is `true`,
3746
  - `bool(u < t) == bool(t > u)` is `true`,
3747
  - `bool(t <= u) == bool(u >= t)` is `true`, and
3748
  - `bool(u <= t) == bool(t >= u)` is `true`.
3749
 
 
3756
  { a <=> b } -> compares-as<Cat>;
3757
  };
3758
  ```
3759
 
3760
  Let `a` and `b` be lvalues of type `const remove_reference_t<T>`. `T`
3761
+ and `Cat` model `three_way_comparable<T, Cat>` only if
3762
 
3763
  - `(a <=> b == 0) == bool(a == b)` is `true`,
3764
  - `(a <=> b != 0) == bool(a != b)` is `true`,
3765
  - `((a <=> b) <=> 0)` and `(0 <=> (b <=> a))` are equal,
3766
  - `(a <=> b < 0) == bool(a < b)` is `true`,
 
3792
  `const remove_reference_t<U>` and `remove_cvref_t<U>`, respectively. Let
3793
  `C` be
3794
  `common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>`.
3795
  Let `CONVERT_TO_LVALUE<C>(E)` be defined as in
3796
  [[concepts.compare.general]]. `T`, `U`, and `Cat` model
3797
+ `three_way_comparable_with<T, U, Cat>` only if
3798
 
3799
  - `t <=> u` and `u <=> t` have the same domain,
3800
  - `((t <=> u) <=> 0)` and `(0 <=> (u <=> t))` are equal,
3801
  - `(t <=> u == 0) == bool(t == u)` is `true`,
3802
  - `(t <=> u != 0) == bool(t != u)` is `true`,
 
3838
  [[basic.lookup.argdep]].
3839
  - Otherwise, if the decayed type `T` of `E` is a floating-point type,
3840
  yields a value of type `strong_ordering` that is consistent with the
3841
  ordering observed by `T`’s comparison operators, and if
3842
  `numeric_limits<T>::is_iec559` is `true`, is additionally consistent
3843
+ with the `totalOrder` operation as specified in ISO/IEC 60559.
3844
  - Otherwise, `strong_ordering(compare_three_way()(E, F))` if it is a
3845
  well-formed expression.
3846
  - Otherwise, `strong_order(E, F)` is ill-formed.
3847
 
3848
  [*Note 1*: Ill-formed cases above result in substitution failure when
 
3960
 
3961
  - If the decayed types of `E` and `F` differ,
3962
  `compare_partial_order_fallback(E, F)` is ill-formed.
3963
  - Otherwise, `partial_order(E, F)` if it is a well-formed expression.
3964
  - Otherwise, if the expressions `E == F`, `E < F`, and `F < E` are all
3965
+ well-formed and each of `decltype(E == F)`, `decltype(E < F)`, and
3966
+ `decltype(F < E)` models `boolean-testable`,
3967
  ``` cpp
3968
  E == F ? partial_ordering::equivalent :
3969
  E < F ? partial_ordering::less :
3970
  F < E ? partial_ordering::greater :
3971
  partial_ordering::unordered
 
3976
 
3977
  [*Note 6*: Ill-formed cases above result in substitution failure when
3978
  `compare_partial_order_fallback(E, F)` appears in the immediate context
3979
  of a template instantiation. — *end note*]
3980
 
3981
+ ### Type Ordering <a id="compare.type">[[compare.type]]</a>
3982
+
3983
+ There is an *implementation-defined* total ordering of all types. For
3984
+ any (possibly incomplete) types `X` and `Y`, the expression
3985
+ `TYPE-ORDER(X, Y)` is a constant expression [[expr.const]] of type
3986
+ `strong_ordering` [[cmp.strongord]]. Its value is
3987
+ `strong_ordering::less` if `X` precedes `Y` in this
3988
+ implementation-defined total order, `strong_ordering::greater` if `Y`
3989
+ precedes `X`, and `strong_ordering::equal` if they are the same type.
3990
+
3991
+ [*Note 1*: `int`, `const int` and `int&` are different
3992
+ types. — *end note*]
3993
+
3994
+ [*Note 2*: This ordering need not be consistent with the one induced by
3995
+ `type_info::before`. — *end note*]
3996
+
3997
+ [*Note 3*: The ordering of TU-local types from different translation
3998
+ units is not observable, because the necessary specialization of
3999
+ `type_order` is impossible to name. — *end note*]
4000
+
4001
+ ``` cpp
4002
+ template<class T, class U>
4003
+ struct type_order;
4004
+ ```
4005
+
4006
+ The name `type_order` denotes a *Cpp17BinaryTypeTrait*[[meta.rqmts]]
4007
+ with a base characteristic of
4008
+ `integral_constant<strong_ordering, `*`TYPE-ORDER`*`(T, U)>`.
4009
+
4010
+ *Recommended practice:* The order should be lexicographical on
4011
+ parameter-type-lists and template argument lists.
4012
+
4013
  ## Coroutines <a id="support.coroutine">[[support.coroutine]]</a>
4014
 
4015
  ### General <a id="support.coroutine.general">[[support.coroutine.general]]</a>
4016
 
4017
  The header `<coroutine>` defines several types providing compile and
 
4069
  *qualified-id* `R::promise_type` is valid and denotes a type
4070
  [[temp.deduct]], then `coroutine_traits<R, ArgTypes...>` has the
4071
  following publicly accessible member:
4072
 
4073
  ``` cpp
4074
+ using promise_type = R::promise_type;
4075
  ```
4076
 
4077
  Otherwise, `coroutine_traits<R, ArgTypes...>` has no members.
4078
 
4079
  Program-defined specializations of this template shall define a publicly
 
4309
  The class `noop_coroutine_promise` defines the promise type for the
4310
  coroutine referred to by `noop_coroutine_handle` [[coroutine.syn]].
4311
 
4312
  #### Class `coroutine_handle<noop_coroutine_promise>` <a id="coroutine.handle.noop">[[coroutine.handle.noop]]</a>
4313
 
4314
+ ##### General <a id="coroutine.handle.noop.general">[[coroutine.handle.noop.general]]</a>
4315
+
4316
  ``` cpp
4317
  namespace std {
4318
  template<>
4319
  struct coroutine_handle<noop_coroutine_promise>
4320
  {
 
4456
 
4457
  ### Header `<cstdarg>` synopsis <a id="cstdarg.syn">[[cstdarg.syn]]</a>
4458
 
4459
  ``` cpp
4460
  // all freestanding
4461
+ #define __STDC_VERSION_STDARG_H__ 202311L
4462
+
4463
  namespace std {
4464
  using va_list = see below;
4465
  }
4466
 
4467
  #define va_arg(V, P) see below
4468
  #define va_copy(VDST, VSRC) see below
4469
  #define va_end(V) see below
4470
+ #define va_start(V, ...) see below
4471
  ```
4472
 
4473
  The contents of the header `<cstdarg>` are the same as the C standard
4474
  library header `<stdarg.h>`, with the following changes:
4475
 
4476
+ - In lieu of the default argument promotions specified in ISO/IEC
4477
+ 9899:2018 (C) 6.5.3.3, the definition in  [[expr.call]] applies.
4478
+ - The preprocessing tokens comprising the second and subsequent
4479
+ arguments to `va_start` (if any) are discarded. \[*Note 1*: `va_start`
4480
+ accepts a second argument for compatibility with prior revisions of
4481
+ C++. *end note*]
 
 
 
 
 
 
4482
 
4483
+ See also: ISO C 7.16
4484
 
4485
  ### Header `<csetjmp>` synopsis <a id="csetjmp.syn">[[csetjmp.syn]]</a>
4486
 
4487
  ``` cpp
4488
+ #define __STDC_VERSION_SETJMP_H__ 202311L
4489
+
4490
  namespace std {
4491
  using jmp_buf = see below;
4492
  [[noreturn]] void longjmp(jmp_buf env, int val);
4493
  }
4494
 
 
4563
  - an access to an object with thread storage duration;
4564
  - a `dynamic_cast` expression;
4565
  - throwing of an exception;
4566
  - control entering a *try-block* or *function-try-block*;
4567
  - initialization of a variable with static storage duration requiring
4568
+ dynamic initialization [[basic.start.dynamic]], [[stmt.dcl]][^33] ; or
4569
  - waiting for the completion of the initialization of a variable with
4570
  static storage duration [[stmt.dcl]].
4571
 
4572
  A signal handler invocation has undefined behavior if it includes an
4573
  evaluation that is not signal-safe.
 
4584
 
4585
  For compatibility with the C standard library, the C++ standard library
4586
  provides the *C headers* shown in [[c.headers]]. The intended use of
4587
  these headers is for interoperability only. It is possible that C++
4588
  source files need to include one of these headers in order to be valid
4589
+ C. Source files that are not intended to also be valid C should not use
4590
+ any of the C headers.
4591
 
4592
  [*Note 1*: The C headers either have no effect, such as `<stdbool.h>`
4593
  and `<stdalign.h>`, or otherwise the corresponding header of the form
4594
  `<cname>` provides the same facilities and assuredly defines them in
4595
  namespace `std`. — *end note*]
4596
 
4597
  [*Example 1*:
4598
 
4599
+ The following source file is both valid C++ and valid C. Viewed as C++,
4600
+ it declares a function with C language linkage; viewed as C it simply
4601
+ declares a function (and provides a prototype).
4602
 
4603
  ``` cpp
4604
+ #include <uchar.h> // for char8_t in C, not necessary in C++{}
4605
  #include <stddef.h> // for size_t
4606
 
4607
  #ifdef __cplusplus // see [cpp.predefined]
4608
  extern "C" // see [dcl.link]
4609
  #endif
4610
+ void f(char8_t s[], size_t n);
4611
  ```
4612
 
4613
  — *end example*]
4614
 
4615
  ### Header `<complex.h>` synopsis <a id="complex.h.syn">[[complex.h.syn]]</a>
 
4633
  [[lex.key]]. — *end note*]
4634
 
4635
  ### Header `<stdalign.h>` synopsis <a id="stdalign.h.syn">[[stdalign.h.syn]]</a>
4636
 
4637
  The contents of the C++ header `<stdalign.h>` are the same as the C
4638
+ standard library header `<stdalign.h>`.
 
4639
 
4640
  See also: ISO C 7.15
4641
 
4642
  ### Header `<stdbool.h>` synopsis <a id="stdbool.h.syn">[[stdbool.h.syn]]</a>
4643
 
4644
  The contents of the C++ header `<stdbool.h>` are the same as the C
4645
+ standard library header `<stdbool.h>`.
 
 
4646
 
4647
+ See also: ISO C 7.19
4648
 
4649
  ### Header `<tgmath.h>` synopsis <a id="tgmath.h.syn">[[tgmath.h.syn]]</a>
4650
 
4651
  ``` cpp
4652
  #include <cmath>
 
4665
  `<tgmath.h>`. — *end note*]
4666
 
4667
  ### Other C headers <a id="support.c.headers.other">[[support.c.headers.other]]</a>
4668
 
4669
  Every C header other than `<complex.h>`, `<iso646.h>`, `<stdalign.h>`,
4670
+ `<stdatomic.h>`, `<stdbit.h>`, `<stdbool.h>`, `<stdckdint.h>`, and
4671
+ `<tgmath.h>`, each of which has a name of the form `<name.h>`, behaves
4672
+ as if each name placed in the standard library namespace by the
4673
+ corresponding `<cname>` header is placed within the global namespace
4674
+ scope, except for the functions described in [[sf.cmath]], the
4675
+ `std::lerp` function overloads [[c.math.lerp]], the declaration of
4676
+ `std::byte` [[cstddef.syn]], and the functions and function templates
4677
+ described in [[support.types.byteops]]. It is unspecified whether these
4678
+ names are first declared or defined within namespace scope
4679
+ [[basic.scope.namespace]] of the namespace `std` and are then injected
4680
+ into the global namespace scope by explicit *using-declaration*s
4681
+ [[namespace.udecl]].
4682
 
4683
  [*Example 1*: The header `<cstdlib>` assuredly provides its
4684
  declarations and definitions within the namespace `std`. It may also
4685
  provide these names within the global namespace. The header `<stdlib.h>`
4686
  assuredly provides the same declarations and definitions within the
4687
+ global namespace, much as in \IsoCUndated. It may also provide these
4688
  names within the namespace `std`. — *end example*]
4689
 
4690
  <!-- Link reference definitions -->
4691
  [alg.c.library]: algorithms.md#alg.c.library
4692
  [alloc.errors]: #alloc.errors
4693
+ [associative]: containers.md#associative
4694
  [atomics]: thread.md#atomics
4695
  [bad.alloc]: #bad.alloc
4696
  [bad.cast]: #bad.cast
4697
  [bad.exception]: #bad.exception
4698
  [bad.typeid]: #bad.typeid
4699
  [basic.align]: basic.md#basic.align
4700
  [basic.compound]: basic.md#basic.compound
4701
+ [basic.contract.eval]: basic.md#basic.contract.eval
4702
+ [basic.contract.general]: basic.md#basic.contract.general
4703
+ [basic.contract.handler]: basic.md#basic.contract.handler
4704
  [basic.extended.fp]: basic.md#basic.extended.fp
4705
  [basic.fundamental]: basic.md#basic.fundamental
4706
  [basic.life]: basic.md#basic.life
4707
  [basic.lookup.argdep]: basic.md#basic.lookup.argdep
4708
  [basic.scope.namespace]: basic.md#basic.scope.namespace
 
4710
  [basic.start.term]: basic.md#basic.start.term
4711
  [basic.stc.dynamic]: basic.md#basic.stc.dynamic
4712
  [basic.stc.dynamic.allocation]: basic.md#basic.stc.dynamic.allocation
4713
  [basic.stc.dynamic.deallocation]: basic.md#basic.stc.dynamic.deallocation
4714
  [c.headers]: #c.headers
4715
+ [c.locales]: text.md#c.locales
4716
  [c.malloc]: mem.md#c.malloc
4717
  [c.math.abs]: numerics.md#c.math.abs
4718
  [c.math.lerp]: numerics.md#c.math.lerp
4719
  [c.math.rand]: numerics.md#c.math.rand
4720
+ [c.mb.wcs]: text.md#c.mb.wcs
4721
  [cfloat.syn]: #cfloat.syn
4722
+ [class.mem.general]: class.md#class.mem.general
4723
  [class.prop]: class.md#class.prop
4724
  [class.spaceship]: class.md#class.spaceship
4725
  [climits.syn]: #climits.syn
4726
  [cmp]: #cmp
4727
  [cmp.alg]: #cmp.alg
 
4732
  [cmp.partialord]: #cmp.partialord
4733
  [cmp.result]: #cmp.result
4734
  [cmp.strongord]: #cmp.strongord
4735
  [cmp.weakord]: #cmp.weakord
4736
  [compare.syn]: #compare.syn
4737
+ [compare.type]: #compare.type
4738
  [complex]: numerics.md#complex
4739
  [complex.h.syn]: #complex.h.syn
4740
  [concept.totallyordered]: concepts.md#concept.totallyordered
4741
  [concepts.compare.general]: concepts.md#concepts.compare.general
4742
  [constraints]: library.md#constraints
4743
+ [contracts.syn]: #contracts.syn
4744
  [conv.prom]: expr.md#conv.prom
4745
  [conv.ptr]: expr.md#conv.ptr
4746
  [conv.qual]: expr.md#conv.qual
4747
  [conv.rank]: basic.md#conv.rank
4748
  [coroutine.handle]: #coroutine.handle
 
4753
  [coroutine.handle.general]: #coroutine.handle.general
4754
  [coroutine.handle.hash]: #coroutine.handle.hash
4755
  [coroutine.handle.noop]: #coroutine.handle.noop
4756
  [coroutine.handle.noop.address]: #coroutine.handle.noop.address
4757
  [coroutine.handle.noop.conv]: #coroutine.handle.noop.conv
4758
+ [coroutine.handle.noop.general]: #coroutine.handle.noop.general
4759
  [coroutine.handle.noop.observers]: #coroutine.handle.noop.observers
4760
  [coroutine.handle.noop.promise]: #coroutine.handle.noop.promise
4761
  [coroutine.handle.noop.resumption]: #coroutine.handle.noop.resumption
4762
  [coroutine.handle.observers]: #coroutine.handle.observers
4763
  [coroutine.handle.promise]: #coroutine.handle.promise
 
4785
  [defns.expression.equivalent]: intro.md#defns.expression.equivalent
4786
  [except.handle]: except.md#except.handle
4787
  [except.nested]: #except.nested
4788
  [except.spec]: except.md#except.spec
4789
  [except.terminate]: except.md#except.terminate
4790
+ [except.throw]: except.md#except.throw
4791
  [exception]: #exception
4792
  [exception.syn]: #exception.syn
4793
  [exception.terminate]: #exception.terminate
4794
  [expr.add]: expr.md#expr.add
4795
  [expr.await]: expr.md#expr.await
4796
  [expr.call]: expr.md#expr.call
4797
+ [expr.const]: expr.md#expr.const
4798
  [expr.context]: expr.md#expr.context
4799
  [expr.delete]: expr.md#expr.delete
4800
  [expr.dynamic.cast]: expr.md#expr.dynamic.cast
4801
  [expr.eq]: expr.md#expr.eq
4802
  [expr.new]: expr.md#expr.new
 
4803
  [expr.rel]: expr.md#expr.rel
4804
  [expr.sizeof]: expr.md#expr.sizeof
4805
  [expr.spaceship]: expr.md#expr.spaceship
4806
  [expr.typeid]: expr.md#expr.typeid
4807
  [get.new.handler]: #get.new.handler
4808
  [get.terminate]: #get.terminate
4809
  [hardware.interference]: #hardware.interference
4810
  [initializer.list.syn]: #initializer.list.syn
4811
  [intro.multithread]: basic.md#intro.multithread
4812
  [iso646.h.syn]: #iso646.h.syn
4813
+ [lex.ccon]: lex.md#lex.ccon
4814
+ [lex.charset]: lex.md#lex.charset
4815
  [lex.key]: lex.md#lex.key
4816
  [library.c]: library.md#library.c
4817
  [limits.syn]: #limits.syn
4818
+ [locale.codecvt]: text.md#locale.codecvt
4819
+ [meta.rqmts]: meta.md#meta.rqmts
4820
  [multibyte.strings]: library.md#multibyte.strings
4821
  [namespace.udecl]: dcl.md#namespace.udecl
4822
  [new.badlength]: #new.badlength
4823
  [new.delete]: #new.delete
4824
  [new.delete.array]: #new.delete.array
 
4848
  [support]: #support
4849
  [support.arith.types]: #support.arith.types
4850
  [support.c.headers]: #support.c.headers
4851
  [support.c.headers.general]: #support.c.headers.general
4852
  [support.c.headers.other]: #support.c.headers.other
4853
+ [support.contract]: #support.contract
4854
+ [support.contract.enum]: #support.contract.enum
4855
+ [support.contract.invoke]: #support.contract.invoke
4856
+ [support.contract.violation]: #support.contract.violation
4857
  [support.coroutine]: #support.coroutine
4858
  [support.coroutine.general]: #support.coroutine.general
4859
  [support.dynamic]: #support.dynamic
4860
  [support.dynamic.general]: #support.dynamic.general
4861
  [support.exception]: #support.exception
 
4884
  [support.types]: #support.types
4885
  [support.types.byteops]: #support.types.byteops
4886
  [support.types.layout]: #support.types.layout
4887
  [support.types.nullptr]: #support.types.nullptr
4888
  [swappable.requirements]: library.md#swappable.requirements
4889
+ [tab:support.contract.enum.detection]: #tab:support.contract.enum.detection
4890
+ [tab:support.contract.enum.kind]: #tab:support.contract.enum.kind
4891
+ [tab:support.contract.enum.semantic]: #tab:support.contract.enum.semantic
4892
  [temp.deduct]: temp.md#temp.deduct
4893
  [temp.dep.constexpr]: temp.md#temp.dep.constexpr
4894
  [temp.dep.expr]: temp.md#temp.dep.expr
 
4895
  [term.odr.use]: basic.md#term.odr.use
4896
+ [term.replaceable.function]: dcl.md#term.replaceable.function
4897
  [terminate]: #terminate
4898
  [terminate.handler]: #terminate.handler
4899
  [tgmath.h.syn]: #tgmath.h.syn
4900
+ [type.index]: #type.index
4901
+ [type.index.synopsis]: #type.index.synopsis
4902
  [type.info]: #type.info
4903
  [typeinfo.syn]: #typeinfo.syn
4904
  [uncaught.exceptions]: #uncaught.exceptions
4905
+ [unord]: containers.md#unord
4906
  [unord.hash]: utilities.md#unord.hash
4907
  [utility.arg.requirements]: library.md#utility.arg.requirements
4908
  [version.syn]: #version.syn
4909
 
4910
  [^1]: Possible definitions include `0` and `0L`, but not `(void*)0`.
 
4928
 
4929
  [^9]: Distinguishes types with bases other than 2 (e.g., BCD).
4930
 
4931
  [^10]: Equivalent to `FLT_EPSILON`, `DBL_EPSILON`, `LDBL_EPSILON`.
4932
 
4933
+ [^11]: Rounding error is described in ISO/IEC 10967-1:2012 Section 5.2.4
4934
+ and Annex C Rationale Section C.5.2.4 — Rounding and rounding
4935
+ constants.
4936
 
4937
  [^12]: Equivalent to `FLT_MIN_EXP`, `DBL_MIN_EXP`, `LDBL_MIN_EXP`.
4938
 
4939
  [^13]: Equivalent to `FLT_MIN_10_EXP`, `DBL_MIN_10_EXP`,
4940
  `LDBL_MIN_10_EXP`.
 
4942
  [^14]: Equivalent to `FLT_MAX_EXP`, `DBL_MAX_EXP`, `LDBL_MAX_EXP`.
4943
 
4944
  [^15]: Equivalent to `FLT_MAX_10_EXP`, `DBL_MAX_10_EXP`,
4945
  `LDBL_MAX_10_EXP`.
4946
 
4947
+ [^16]: Required by ISO/IEC 10967-1:2012.
4948
 
4949
+ [^17]: Required by ISO/IEC 10967-1:2012.
4950
 
4951
+ [^18]: Required by ISO/IEC 10967-1:2012.
4952
 
4953
+ [^19]: Required by ISO/IEC 10967-1:2012.
4954
 
4955
+ [^20]: Required by ISO/IEC 10967-1:2012.
4956
 
4957
+ [^21]: Required by ISO/IEC 10967-1:2012.
4958
 
4959
+ [^22]: ISO/IEC 60559:2020 is the same as IEEE 754-2019.
4960
 
4961
+ [^23]: Required by ISO/IEC 10967-1:2012.
4962
 
4963
+ [^24]: Required by ISO/IEC 10967-1:2012.
4964
 
4965
+ [^25]: Required by ISO/IEC 10967-1:2012.
4966
 
4967
+ [^26]: Refer to ISO/IEC 60559. Required by ISO/IEC 10967-1:2012.
4968
 
4969
+ [^27]: Equivalent to `FLT_ROUNDS`. Required by ISO/IEC 10967-1:2012.
4970
 
4971
  [^28]: A function is called for every time it is registered.
4972
 
4973
  [^29]: Objects with automatic storage duration are all destroyed in a
4974
  program whose `main` function [[basic.start.main]] contains no
 
4986
  however, increase the `size` argument to `operator new[]` to obtain
4987
  space to store supplemental information.
4988
 
4989
  [^32]: That is, `a < b`, `a == b`, and `a > b` might all be `false`.
4990
 
4991
+ [^33]: Such initialization can occur because it is the first odr-use
 
 
 
4992
  [[term.odr.use]] of that variable.