From Jason Turner

[memory.syn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpimjr0brw/{from.md → to.md} +336 -160
tmp/tmpimjr0brw/{from.md → to.md} RENAMED
@@ -1,237 +1,446 @@
1
  ### Header `<memory>` synopsis <a id="memory.syn">[[memory.syn]]</a>
2
 
3
  The header `<memory>` defines several types and function templates that
4
  describe properties of pointers and pointer-like types, manage memory
5
  for containers and other template types, destroy objects, and construct
6
- multiple objects in uninitialized memory buffers ([[pointer.traits]]–
7
- [[specialized.algorithms]]). The header also defines the templates
8
- `unique_ptr`, `shared_ptr`, `weak_ptr`, and various function templates
9
- that operate on objects of these types ([[smartptr]]).
 
10
 
11
  ``` cpp
 
 
12
  namespace std {
13
  // [pointer.traits], pointer traits
14
  template<class Ptr> struct pointer_traits;
15
  template<class T> struct pointer_traits<T*>;
16
 
17
- // [util.dynamic.safety], pointer safety
 
 
 
 
 
 
 
 
18
  enum class pointer_safety { relaxed, preferred, strict };
19
  void declare_reachable(void* p);
20
- template <class T> T* undeclare_reachable(T* p);
 
21
  void declare_no_pointers(char* p, size_t n);
22
  void undeclare_no_pointers(char* p, size_t n);
23
  pointer_safety get_pointer_safety() noexcept;
24
 
25
- // [ptr.align], pointer alignment function
26
  void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
 
 
27
 
28
  // [allocator.tag], allocator argument tag
29
  struct allocator_arg_t { explicit allocator_arg_t() = default; };
30
  inline constexpr allocator_arg_t allocator_arg{};
31
 
32
  // [allocator.uses], uses_allocator
33
  template<class T, class Alloc> struct uses_allocator;
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  // [allocator.traits], allocator traits
36
  template<class Alloc> struct allocator_traits;
37
 
38
  // [default.allocator], the default allocator
39
  template<class T> class allocator;
40
  template<class T, class U>
41
- bool operator==(const allocator<T>&, const allocator<U>&) noexcept;
42
- template <class T, class U>
43
- bool operator!=(const allocator<T>&, const allocator<U>&) noexcept;
 
 
 
 
44
 
45
  // [specialized.algorithms], specialized algorithms
46
- template <class T> constexpr T* addressof(T& r) noexcept;
47
- template <class T> const T* addressof(const T&&) = delete;
48
- template <class ForwardIterator>
49
- void uninitialized_default_construct(ForwardIterator first, ForwardIterator last);
50
- template <class ExecutionPolicy, class ForwardIterator>
 
 
 
 
 
 
 
 
 
 
 
51
  void uninitialized_default_construct(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
52
- ForwardIterator first, ForwardIterator last);
53
- template <class ForwardIterator, class Size>
54
- ForwardIterator uninitialized_default_construct_n(ForwardIterator first, Size n);
55
- template <class ExecutionPolicy, class ForwardIterator, class Size>
56
- ForwardIterator uninitialized_default_construct_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
57
- ForwardIterator first, Size n);
58
- template <class ForwardIterator>
59
- void uninitialized_value_construct(ForwardIterator first, ForwardIterator last);
60
- template <class ExecutionPolicy, class ForwardIterator>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  void uninitialized_value_construct(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
62
- ForwardIterator first, ForwardIterator last);
63
- template <class ForwardIterator, class Size>
64
- ForwardIterator uninitialized_value_construct_n(ForwardIterator first, Size n);
65
- template <class ExecutionPolicy, class ForwardIterator, class Size>
66
- ForwardIterator uninitialized_value_construct_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
67
- ForwardIterator first, Size n);
68
- template <class InputIterator, class ForwardIterator>
69
- ForwardIterator uninitialized_copy(InputIterator first, InputIterator last,
70
- ForwardIterator result);
71
- template <class ExecutionPolicy, class InputIterator, class ForwardIterator>
72
- ForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  InputIterator first, InputIterator last,
74
- ForwardIterator result);
75
- template <class InputIterator, class Size, class ForwardIterator>
76
- ForwardIterator uninitialized_copy_n(InputIterator first, Size n,
77
- ForwardIterator result);
78
- template <class ExecutionPolicy, class InputIterator, class Size, class ForwardIterator>
79
- ForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
80
  InputIterator first, Size n,
81
- ForwardIterator result);
82
- template <class InputIterator, class ForwardIterator>
83
- ForwardIterator uninitialized_move(InputIterator first, InputIterator last,
84
- ForwardIterator result);
85
- template <class ExecutionPolicy, class InputIterator, class ForwardIterator>
86
- ForwardIterator uninitialized_move(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  InputIterator first, InputIterator last,
88
- ForwardIterator result);
89
- template <class InputIterator, class Size, class ForwardIterator>
90
- pair<InputIterator, ForwardIterator>
91
- uninitialized_move_n(InputIterator first, Size n, ForwardIterator result);
92
- template <class ExecutionPolicy, class InputIterator, class Size, class ForwardIterator>
93
- pair<InputIterator, ForwardIterator>
94
  uninitialized_move_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
95
- InputIterator first, Size n, ForwardIterator result);
96
- template <class ForwardIterator, class T>
97
- void uninitialized_fill(ForwardIterator first, ForwardIterator last,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  const T& x);
99
- template <class ExecutionPolicy, class ForwardIterator, class T>
100
  void uninitialized_fill(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
101
- ForwardIterator first, ForwardIterator last,
102
  const T& x);
103
- template <class ForwardIterator, class Size, class T>
104
- ForwardIterator uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
105
- template <class ExecutionPolicy, class ForwardIterator, class Size, class T>
106
- ForwardIterator uninitialized_fill_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
107
- ForwardIterator first, Size n, const T& x);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  template<class T>
109
- void destroy_at(T* location);
110
- template <class ForwardIterator>
111
- void destroy(ForwardIterator first, ForwardIterator last);
112
- template <class ExecutionPolicy, class ForwardIterator>
113
  void destroy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
114
- ForwardIterator first, ForwardIterator last);
115
- template <class ForwardIterator, class Size>
116
- ForwardIterator destroy_n(ForwardIterator first, Size n);
117
- template <class ExecutionPolicy, class ForwardIterator, class Size>
118
- ForwardIterator destroy_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
119
- ForwardIterator first, Size n);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  // [unique.ptr], class template unique_ptr
122
  template<class T> struct default_delete;
123
  template<class T> struct default_delete<T[]>;
124
  template<class T, class D = default_delete<T>> class unique_ptr;
125
  template<class T, class D> class unique_ptr<T[], D>;
126
 
127
- template <class T, class... Args> unique_ptr<T> make_unique(Args&&... args);
128
- template <class T> unique_ptr<T> make_unique(size_t n);
129
- template <class T, class... Args> unspecified make_unique(Args&&...) = delete;
 
 
 
130
 
131
- template <class T, class D> void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept;
 
 
 
 
 
 
 
 
132
 
133
  template<class T1, class D1, class T2, class D2>
134
  bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
135
- template <class T1, class D1, class T2, class D2>
136
- bool operator!=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
137
  template<class T1, class D1, class T2, class D2>
138
  bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
139
- template <class T1, class D1, class T2, class D2>
140
- bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
141
  template<class T1, class D1, class T2, class D2>
142
  bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
 
 
143
  template<class T1, class D1, class T2, class D2>
144
  bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
 
 
 
 
 
 
145
 
146
  template<class T, class D>
147
  bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept;
148
- template <class T, class D>
149
- bool operator==(nullptr_t, const unique_ptr<T, D>& y) noexcept;
150
- template <class T, class D>
151
- bool operator!=(const unique_ptr<T, D>& x, nullptr_t) noexcept;
152
- template <class T, class D>
153
- bool operator!=(nullptr_t, const unique_ptr<T, D>& y) noexcept;
154
  template<class T, class D>
155
  bool operator<(const unique_ptr<T, D>& x, nullptr_t);
156
  template<class T, class D>
157
  bool operator<(nullptr_t, const unique_ptr<T, D>& y);
158
- template <class T, class D>
159
- bool operator<=(const unique_ptr<T, D>& x, nullptr_t);
160
- template <class T, class D>
161
- bool operator<=(nullptr_t, const unique_ptr<T, D>& y);
162
  template<class T, class D>
163
  bool operator>(const unique_ptr<T, D>& x, nullptr_t);
164
  template<class T, class D>
165
  bool operator>(nullptr_t, const unique_ptr<T, D>& y);
 
 
 
 
166
  template<class T, class D>
167
  bool operator>=(const unique_ptr<T, D>& x, nullptr_t);
168
  template<class T, class D>
169
  bool operator>=(nullptr_t, const unique_ptr<T, D>& y);
 
 
 
 
 
 
 
170
 
171
  // [util.smartptr.weak.bad], class bad_weak_ptr
172
  class bad_weak_ptr;
173
 
174
  // [util.smartptr.shared], class template shared_ptr
175
  template<class T> class shared_ptr;
176
 
177
  // [util.smartptr.shared.create], shared_ptr creation
178
  template<class T, class... Args>
179
- shared_ptr<T> make_shared(Args&&... args);
180
  template<class T, class A, class... Args>
181
- shared_ptr<T> allocate_shared(const A& a, Args&&... args);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
 
183
  // [util.smartptr.shared.cmp], shared_ptr comparisons
184
  template<class T, class U>
185
  bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
186
  template<class T, class U>
187
- bool operator!=(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
188
- template<class T, class U>
189
- bool operator<(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
190
- template<class T, class U>
191
- bool operator>(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
192
- template<class T, class U>
193
- bool operator<=(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
194
- template<class T, class U>
195
- bool operator>=(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
196
 
197
  template<class T>
198
  bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept;
199
  template<class T>
200
- bool operator==(nullptr_t, const shared_ptr<T>& y) noexcept;
201
- template <class T>
202
- bool operator!=(const shared_ptr<T>& x, nullptr_t) noexcept;
203
- template <class T>
204
- bool operator!=(nullptr_t, const shared_ptr<T>& y) noexcept;
205
- template <class T>
206
- bool operator<(const shared_ptr<T>& x, nullptr_t) noexcept;
207
- template <class T>
208
- bool operator<(nullptr_t, const shared_ptr<T>& y) noexcept;
209
- template <class T>
210
- bool operator<=(const shared_ptr<T>& x, nullptr_t) noexcept;
211
- template <class T>
212
- bool operator<=(nullptr_t, const shared_ptr<T>& y) noexcept;
213
- template <class T>
214
- bool operator>(const shared_ptr<T>& x, nullptr_t) noexcept;
215
- template <class T>
216
- bool operator>(nullptr_t, const shared_ptr<T>& y) noexcept;
217
- template <class T>
218
- bool operator>=(const shared_ptr<T>& x, nullptr_t) noexcept;
219
- template <class T>
220
- bool operator>=(nullptr_t, const shared_ptr<T>& y) noexcept;
221
 
222
  // [util.smartptr.shared.spec], shared_ptr specialized algorithms
223
  template<class T>
224
  void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept;
225
 
226
  // [util.smartptr.shared.cast], shared_ptr casts
227
  template<class T, class U>
228
  shared_ptr<T> static_pointer_cast(const shared_ptr<U>& r) noexcept;
 
 
229
  template<class T, class U>
230
  shared_ptr<T> dynamic_pointer_cast(const shared_ptr<U>& r) noexcept;
 
 
231
  template<class T, class U>
232
  shared_ptr<T> const_pointer_cast(const shared_ptr<U>& r) noexcept;
 
 
 
 
 
 
233
 
234
  // [util.smartptr.getdeleter], shared_ptr get_deleter
235
  template<class D, class T>
236
  D* get_deleter(const shared_ptr<T>& p) noexcept;
237
 
@@ -249,50 +458,17 @@ namespace std {
249
  template<class T = void> struct owner_less;
250
 
251
  // [util.smartptr.enab], class template enable_shared_from_this
252
  template<class T> class enable_shared_from_this;
253
 
254
- // [util.smartptr.shared.atomic], shared_ptr atomic access
255
- template<class T>
256
- bool atomic_is_lock_free(const shared_ptr<T>* p);
257
-
258
- template<class T>
259
- shared_ptr<T> atomic_load(const shared_ptr<T>* p);
260
- template<class T>
261
- shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo);
262
-
263
- template<class T>
264
- void atomic_store(shared_ptr<T>* p, shared_ptr<T> r);
265
- template<class T>
266
- void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
267
-
268
- template<class T>
269
- shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r);
270
- template<class T>
271
- shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
272
-
273
- template<class T>
274
- bool atomic_compare_exchange_weak(
275
- shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
276
- template<class T>
277
- bool atomic_compare_exchange_strong(
278
- shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
279
- template<class T>
280
- bool atomic_compare_exchange_weak_explicit(
281
- shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
282
- memory_order success, memory_order failure);
283
- template<class T>
284
- bool atomic_compare_exchange_strong_explicit(
285
- shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
286
- memory_order success, memory_order failure);
287
-
288
  // [util.smartptr.hash], hash support
289
  template<class T> struct hash;
290
  template<class T, class D> struct hash<unique_ptr<T, D>>;
291
  template<class T> struct hash<shared_ptr<T>>;
292
 
293
- // [allocator.uses.trait], uses_allocator
294
- template <class T, class Alloc>
295
- inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;
 
296
  }
297
  ```
298
 
 
1
  ### Header `<memory>` synopsis <a id="memory.syn">[[memory.syn]]</a>
2
 
3
  The header `<memory>` defines several types and function templates that
4
  describe properties of pointers and pointer-like types, manage memory
5
  for containers and other template types, destroy objects, and construct
6
+ objects in uninitialized memory buffers ([[pointer.traits]]–
7
+ [[specialized.addressof]] and [[specialized.algorithms]]). The header
8
+ also defines the templates `unique_ptr`, `shared_ptr`, `weak_ptr`, and
9
+ various function templates that operate on objects of these types
10
+ [[smartptr]].
11
 
12
  ``` cpp
13
+ #include <compare> // see [compare.syn]
14
+
15
  namespace std {
16
  // [pointer.traits], pointer traits
17
  template<class Ptr> struct pointer_traits;
18
  template<class T> struct pointer_traits<T*>;
19
 
20
+ // [pointer.conversion], pointer conversion
21
+ template<class T>
22
+ constexpr T* to_address(T* p) noexcept;
23
+ template<class Ptr>
24
+ constexpr auto to_address(const Ptr& p) noexcept;
25
+
26
+ // [util.dynamic.safety], pointer safety%
27
+ %
28
+ {pointer_safety{pointer_safety{pointer_safety}
29
  enum class pointer_safety { relaxed, preferred, strict };
30
  void declare_reachable(void* p);
31
+ template<class T>
32
+ T* undeclare_reachable(T* p);
33
  void declare_no_pointers(char* p, size_t n);
34
  void undeclare_no_pointers(char* p, size_t n);
35
  pointer_safety get_pointer_safety() noexcept;
36
 
37
+ // [ptr.align], pointer alignment
38
  void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
39
+ template<size_t N, class T>
40
+ [[nodiscard]] constexpr T* assume_aligned(T* ptr);
41
 
42
  // [allocator.tag], allocator argument tag
43
  struct allocator_arg_t { explicit allocator_arg_t() = default; };
44
  inline constexpr allocator_arg_t allocator_arg{};
45
 
46
  // [allocator.uses], uses_allocator
47
  template<class T, class Alloc> struct uses_allocator;
48
 
49
+ // [allocator.uses.trait], uses_allocator
50
+ template<class T, class Alloc>
51
+ inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;
52
+
53
+ // [allocator.uses.construction], uses-allocator construction
54
+ template<class T, class Alloc, class... Args>
55
+ constexpr auto uses_allocator_construction_args(const Alloc& alloc,
56
+ Args&&... args) noexcept -> see below;
57
+ template<class T, class Alloc, class Tuple1, class Tuple2>
58
+ constexpr auto uses_allocator_construction_args(const Alloc& alloc, piecewise_construct_t,
59
+ Tuple1&& x, Tuple2&& y)
60
+ noexcept -> see below;
61
+ template<class T, class Alloc>
62
+ constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept -> see below;
63
+ template<class T, class Alloc, class U, class V>
64
+ constexpr auto uses_allocator_construction_args(const Alloc& alloc,
65
+ U&& u, V&& v) noexcept -> see below;
66
+ template<class T, class Alloc, class U, class V>
67
+ constexpr auto uses_allocator_construction_args(const Alloc& alloc,
68
+ const pair<U,V>& pr) noexcept -> see below;
69
+ template<class T, class Alloc, class U, class V>
70
+ constexpr auto uses_allocator_construction_args(const Alloc& alloc,
71
+ pair<U,V>&& pr) noexcept -> see below;
72
+ template<class T, class Alloc, class... Args>
73
+ constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args);
74
+ template<class T, class Alloc, class... Args>
75
+ constexpr T* uninitialized_construct_using_allocator(T* p, const Alloc& alloc,
76
+ Args&&... args);
77
+
78
  // [allocator.traits], allocator traits
79
  template<class Alloc> struct allocator_traits;
80
 
81
  // [default.allocator], the default allocator
82
  template<class T> class allocator;
83
  template<class T, class U>
84
+ constexpr bool operator==(const allocator<T>&, const allocator<U>&) noexcept;
85
+
86
+ // [specialized.addressof], addressof
87
+ template<class T>
88
+ constexpr T* addressof(T& r) noexcept;
89
+ template<class T>
90
+ const T* addressof(const T&&) = delete;
91
 
92
  // [specialized.algorithms], specialized algorithms
93
+ // [special.mem.concepts], special memory concepts
94
+ template<class I>
95
+ concept no-throw-input-iterator = see below; // exposition only
96
+ template<class I>
97
+ concept no-throw-forward-iterator = see below; // exposition only
98
+ template<class S, class I>
99
+ concept no-throw-sentinel = see below; // exposition only
100
+ template<class R>
101
+ concept no-throw-input-range = see below; // exposition only
102
+ template<class R>
103
+ concept no-throw-forward-range = see below; // exposition only
104
+
105
+ template<class NoThrowForwardIterator>
106
+ void uninitialized_default_construct(NoThrowForwardIterator first,
107
+ NoThrowForwardIterator last);
108
+ template<class ExecutionPolicy, class NoThrowForwardIterator>
109
  void uninitialized_default_construct(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
110
+ NoThrowForwardIterator first,
111
+ NoThrowForwardIterator last);
112
+ template<class NoThrowForwardIterator, class Size>
113
+ NoThrowForwardIterator
114
+ uninitialized_default_construct_n(NoThrowForwardIterator first, Size n);
115
+ template<class ExecutionPolicy, class NoThrowForwardIterator, class Size>
116
+ NoThrowForwardIterator
117
+ uninitialized_default_construct_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
118
+ NoThrowForwardIterator first, Size n);
119
+
120
+ namespace ranges {
121
+ template<no-throw-forward-iterator I, no-throw-sentinel<I> S>
122
+ requires default_initializable<iter_value_t<I>>
123
+ I uninitialized_default_construct(I first, S last);
124
+ template<no-throw-forward-range R>
125
+ requires default_initializable<range_value_t<R>>
126
+ borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
127
+
128
+ template<no-throw-forward-iterator I>
129
+ requires default_initializable<iter_value_t<I>>
130
+ I uninitialized_default_construct_n(I first, iter_difference_t<I> n);
131
+ }
132
+
133
+ template<class NoThrowForwardIterator>
134
+ void uninitialized_value_construct(NoThrowForwardIterator first,
135
+ NoThrowForwardIterator last);
136
+ template<class ExecutionPolicy, class NoThrowForwardIterator>
137
  void uninitialized_value_construct(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
138
+ NoThrowForwardIterator first,
139
+ NoThrowForwardIterator last);
140
+ template<class NoThrowForwardIterator, class Size>
141
+ NoThrowForwardIterator
142
+ uninitialized_value_construct_n(NoThrowForwardIterator first, Size n);
143
+ template<class ExecutionPolicy, class NoThrowForwardIterator, class Size>
144
+ NoThrowForwardIterator
145
+ uninitialized_value_construct_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
146
+ NoThrowForwardIterator first, Size n);
147
+
148
+ namespace ranges {
149
+ template<no-throw-forward-iterator I, no-throw-sentinel<I> S>
150
+ requires default_initializable<iter_value_t<I>>
151
+ I uninitialized_value_construct(I first, S last);
152
+ template<no-throw-forward-range R>
153
+ requires default_initializable<range_value_t<R>>
154
+ borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
155
+
156
+ template<no-throw-forward-iterator I>
157
+ requires default_initializable<iter_value_t<I>>
158
+ I uninitialized_value_construct_n(I first, iter_difference_t<I> n);
159
+ }
160
+
161
+ template<class InputIterator, class NoThrowForwardIterator>
162
+ NoThrowForwardIterator uninitialized_copy(InputIterator first, InputIterator last,
163
+ NoThrowForwardIterator result);
164
+ template<class ExecutionPolicy, class InputIterator, class NoThrowForwardIterator>
165
+ NoThrowForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
166
  InputIterator first, InputIterator last,
167
+ NoThrowForwardIterator result);
168
+ template<class InputIterator, class Size, class NoThrowForwardIterator>
169
+ NoThrowForwardIterator uninitialized_copy_n(InputIterator first, Size n,
170
+ NoThrowForwardIterator result);
171
+ template<class ExecutionPolicy, class InputIterator, class Size, class NoThrowForwardIterator>
172
+ NoThrowForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
173
  InputIterator first, Size n,
174
+ NoThrowForwardIterator result);
175
+
176
+ namespace ranges {
177
+ template<class I, class O>
178
+ using uninitialized_copy_result = in_out_result<I, O>;
179
+ template<input_iterator I, sentinel_for<I> S1,
180
+ no-throw-forward-iterator O, no-throw-sentinel<O> S2>
181
+ requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
182
+ uninitialized_copy_result<I, O>
183
+ uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast);
184
+ template<input_range IR, no-throw-forward-range OR>
185
+ requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
186
+ uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
187
+ uninitialized_copy(IR&& in_range, OR&& out_range);
188
+
189
+ template<class I, class O>
190
+ using uninitialized_copy_n_result = in_out_result<I, O>;
191
+ template<input_iterator I, no-throw-forward-iterator O, no-throw-sentinel<O> S>
192
+ requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
193
+ uninitialized_copy_n_result<I, O>
194
+ uninitialized_copy_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
195
+ }
196
+
197
+ template<class InputIterator, class NoThrowForwardIterator>
198
+ NoThrowForwardIterator uninitialized_move(InputIterator first, InputIterator last,
199
+ NoThrowForwardIterator result);
200
+ template<class ExecutionPolicy, class InputIterator, class NoThrowForwardIterator>
201
+ NoThrowForwardIterator uninitialized_move(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
202
  InputIterator first, InputIterator last,
203
+ NoThrowForwardIterator result);
204
+ template<class InputIterator, class Size, class NoThrowForwardIterator>
205
+ pair<InputIterator, NoThrowForwardIterator>
206
+ uninitialized_move_n(InputIterator first, Size n, NoThrowForwardIterator result);
207
+ template<class ExecutionPolicy, class InputIterator, class Size, class NoThrowForwardIterator>
208
+ pair<InputIterator, NoThrowForwardIterator>
209
  uninitialized_move_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
210
+ InputIterator first, Size n, NoThrowForwardIterator result);
211
+
212
+ namespace ranges {
213
+ template<class I, class O>
214
+ using uninitialized_move_result = in_out_result<I, O>;
215
+ template<input_iterator I, sentinel_for<I> S1,
216
+ no-throw-forward-iterator O, no-throw-sentinel<O> S2>
217
+ requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
218
+ uninitialized_move_result<I, O>
219
+ uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast);
220
+ template<input_range IR, no-throw-forward-range OR>
221
+ requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
222
+ uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
223
+ uninitialized_move(IR&& in_range, OR&& out_range);
224
+
225
+ template<class I, class O>
226
+ using uninitialized_move_n_result = in_out_result<I, O>;
227
+ template<input_iterator I,
228
+ no-throw-forward-iterator O, no-throw-sentinel<O> S>
229
+ requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
230
+ uninitialized_move_n_result<I, O>
231
+ uninitialized_move_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
232
+ }
233
+
234
+ template<class NoThrowForwardIterator, class T>
235
+ void uninitialized_fill(NoThrowForwardIterator first, NoThrowForwardIterator last,
236
  const T& x);
237
+ template<class ExecutionPolicy, class NoThrowForwardIterator, class T>
238
  void uninitialized_fill(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
239
+ NoThrowForwardIterator first, NoThrowForwardIterator last,
240
  const T& x);
241
+ template<class NoThrowForwardIterator, class Size, class T>
242
+ NoThrowForwardIterator
243
+ uninitialized_fill_n(NoThrowForwardIterator first, Size n, const T& x);
244
+ template<class ExecutionPolicy, class NoThrowForwardIterator, class Size, class T>
245
+ NoThrowForwardIterator
246
+ uninitialized_fill_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
247
+ NoThrowForwardIterator first, Size n, const T& x);
248
+
249
+ namespace ranges {
250
+ template<no-throw-forward-iterator I, no-throw-sentinel<I> S, class T>
251
+ requires constructible_from<iter_value_t<I>, const T&>
252
+ I uninitialized_fill(I first, S last, const T& x);
253
+ template<no-throw-forward-range R, class T>
254
+ requires constructible_from<range_value_t<R>, const T&>
255
+ borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
256
+
257
+ template<no-throw-forward-iterator I, class T>
258
+ requires constructible_from<iter_value_t<I>, const T&>
259
+ I uninitialized_fill_n(I first, iter_difference_t<I> n, const T& x);
260
+ }
261
+
262
+ // [specialized.construct], construct_at
263
+ template<class T, class... Args>
264
+ constexpr T* construct_at(T* location, Args&&... args);
265
+
266
+ namespace ranges {
267
+ template<class T, class... Args>
268
+ constexpr T* construct_at(T* location, Args&&... args);
269
+ }
270
+
271
+ // [specialized.destroy], destroy
272
  template<class T>
273
+ constexpr void destroy_at(T* location);
274
+ template<class NoThrowForwardIterator>
275
+ constexpr void destroy(NoThrowForwardIterator first, NoThrowForwardIterator last);
276
+ template<class ExecutionPolicy, class NoThrowForwardIterator>
277
  void destroy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
278
+ NoThrowForwardIterator first, NoThrowForwardIterator last);
279
+ template<class NoThrowForwardIterator, class Size>
280
+ constexpr NoThrowForwardIterator destroy_n(NoThrowForwardIterator first, Size n);
281
+ template<class ExecutionPolicy, class NoThrowForwardIterator, class Size>
282
+ NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
283
+ NoThrowForwardIterator first, Size n);
284
+
285
+ namespace ranges {
286
+ template<destructible T>
287
+ constexpr void destroy_at(T* location) noexcept;
288
+
289
+ template<no-throw-input-iterator I, no-throw-sentinel<I> S>
290
+ requires destructible<iter_value_t<I>>
291
+ constexpr I destroy(I first, S last) noexcept;
292
+ template<no-throw-input-range R>
293
+ requires destructible<range_value_t<R>>
294
+ constexpr borrowed_iterator_t<R> destroy(R&& r) noexcept;
295
+
296
+ template<no-throw-input-iterator I>
297
+ requires destructible<iter_value_t<I>>
298
+ constexpr I destroy_n(I first, iter_difference_t<I> n) noexcept;
299
+ }
300
 
301
  // [unique.ptr], class template unique_ptr
302
  template<class T> struct default_delete;
303
  template<class T> struct default_delete<T[]>;
304
  template<class T, class D = default_delete<T>> class unique_ptr;
305
  template<class T, class D> class unique_ptr<T[], D>;
306
 
307
+ template<class T, class... Args>
308
+ unique_ptr<T> make_unique(Args&&... args); // T is not array
309
+ template<class T>
310
+ unique_ptr<T> make_unique(size_t n); // T is U[]
311
+ template<class T, class... Args>
312
+ unspecified make_unique(Args&&...) = delete; // T is U[N]
313
 
314
+ template<class T>
315
+ unique_ptr<T> make_unique_for_overwrite(); // T is not array
316
+ template<class T>
317
+ unique_ptr<T> make_unique_for_overwrite(size_t n); // T is U[]
318
+ template<class T, class... Args>
319
+ unspecified make_unique_for_overwrite(Args&&...) = delete; // T is U[N]
320
+
321
+ template<class T, class D>
322
+ void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept;
323
 
324
  template<class T1, class D1, class T2, class D2>
325
  bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
 
 
326
  template<class T1, class D1, class T2, class D2>
327
  bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
 
 
328
  template<class T1, class D1, class T2, class D2>
329
  bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
330
+ template<class T1, class D1, class T2, class D2>
331
+ bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
332
  template<class T1, class D1, class T2, class D2>
333
  bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
334
+ template<class T1, class D1, class T2, class D2>
335
+ requires three_way_comparable_with<typename unique_ptr<T1, D1>::pointer,
336
+ typename unique_ptr<T2, D2>::pointer>
337
+ compare_three_way_result_t<typename unique_ptr<T1, D1>::pointer,
338
+ typename unique_ptr<T2, D2>::pointer>
339
+ operator<=>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
340
 
341
  template<class T, class D>
342
  bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept;
 
 
 
 
 
 
343
  template<class T, class D>
344
  bool operator<(const unique_ptr<T, D>& x, nullptr_t);
345
  template<class T, class D>
346
  bool operator<(nullptr_t, const unique_ptr<T, D>& y);
 
 
 
 
347
  template<class T, class D>
348
  bool operator>(const unique_ptr<T, D>& x, nullptr_t);
349
  template<class T, class D>
350
  bool operator>(nullptr_t, const unique_ptr<T, D>& y);
351
+ template<class T, class D>
352
+ bool operator<=(const unique_ptr<T, D>& x, nullptr_t);
353
+ template<class T, class D>
354
+ bool operator<=(nullptr_t, const unique_ptr<T, D>& y);
355
  template<class T, class D>
356
  bool operator>=(const unique_ptr<T, D>& x, nullptr_t);
357
  template<class T, class D>
358
  bool operator>=(nullptr_t, const unique_ptr<T, D>& y);
359
+ template<class T, class D>
360
+ requires three_way_comparable_with<typename unique_ptr<T, D>::pointer, nullptr_t>
361
+ compare_three_way_result_t<typename unique_ptr<T, D>::pointer, nullptr_t>
362
+ operator<=>(const unique_ptr<T, D>& x, nullptr_t);
363
+
364
+ template<class E, class T, class Y, class D>
365
+ basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const unique_ptr<Y, D>& p);
366
 
367
  // [util.smartptr.weak.bad], class bad_weak_ptr
368
  class bad_weak_ptr;
369
 
370
  // [util.smartptr.shared], class template shared_ptr
371
  template<class T> class shared_ptr;
372
 
373
  // [util.smartptr.shared.create], shared_ptr creation
374
  template<class T, class... Args>
375
+ shared_ptr<T> make_shared(Args&&... args); // T is not array
376
  template<class T, class A, class... Args>
377
+ shared_ptr<T> allocate_shared(const A& a, Args&&... args); // T is not array
378
+
379
+ template<class T>
380
+ shared_ptr<T> make_shared(size_t N); // T is U[]
381
+ template<class T, class A>
382
+ shared_ptr<T> allocate_shared(const A& a, size_t N); // T is U[]
383
+
384
+ template<class T>
385
+ shared_ptr<T> make_shared(); // T is U[N]
386
+ template<class T, class A>
387
+ shared_ptr<T> allocate_shared(const A& a); // T is U[N]
388
+
389
+ template<class T>
390
+ shared_ptr<T> make_shared(size_t N, const remove_extent_t<T>& u); // T is U[]
391
+ template<class T, class A>
392
+ shared_ptr<T> allocate_shared(const A& a, size_t N,
393
+ const remove_extent_t<T>& u); // T is U[]
394
+
395
+ template<class T>
396
+ shared_ptr<T> make_shared(const remove_extent_t<T>& u); // T is U[N]
397
+ template<class T, class A>
398
+ shared_ptr<T> allocate_shared(const A& a, const remove_extent_t<T>& u); // T is U[N]
399
+
400
+ template<class T>
401
+ shared_ptr<T> make_shared_for_overwrite(); // T is not U[]
402
+ template<class T, class A>
403
+ shared_ptr<T> allocate_shared_for_overwrite(const A& a); // T is not U[]
404
+
405
+ template<class T>
406
+ shared_ptr<T> make_shared_for_overwrite(size_t N); // T is U[]
407
+ template<class T, class A>
408
+ shared_ptr<T> allocate_shared_for_overwrite(const A& a, size_t N); // T is U[]
409
 
410
  // [util.smartptr.shared.cmp], shared_ptr comparisons
411
  template<class T, class U>
412
  bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
413
  template<class T, class U>
414
+ strong_ordering operator<=>(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
 
 
 
 
 
 
 
 
415
 
416
  template<class T>
417
  bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept;
418
  template<class T>
419
+ strong_ordering operator<=>(const shared_ptr<T>& x, nullptr_t) noexcept;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
 
421
  // [util.smartptr.shared.spec], shared_ptr specialized algorithms
422
  template<class T>
423
  void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept;
424
 
425
  // [util.smartptr.shared.cast], shared_ptr casts
426
  template<class T, class U>
427
  shared_ptr<T> static_pointer_cast(const shared_ptr<U>& r) noexcept;
428
+ template<class T, class U>
429
+ shared_ptr<T> static_pointer_cast(shared_ptr<U>&& r) noexcept;
430
  template<class T, class U>
431
  shared_ptr<T> dynamic_pointer_cast(const shared_ptr<U>& r) noexcept;
432
+ template<class T, class U>
433
+ shared_ptr<T> dynamic_pointer_cast(shared_ptr<U>&& r) noexcept;
434
  template<class T, class U>
435
  shared_ptr<T> const_pointer_cast(const shared_ptr<U>& r) noexcept;
436
+ template<class T, class U>
437
+ shared_ptr<T> const_pointer_cast(shared_ptr<U>&& r) noexcept;
438
+ template<class T, class U>
439
+ shared_ptr<T> reinterpret_pointer_cast(const shared_ptr<U>& r) noexcept;
440
+ template<class T, class U>
441
+ shared_ptr<T> reinterpret_pointer_cast(shared_ptr<U>&& r) noexcept;
442
 
443
  // [util.smartptr.getdeleter], shared_ptr get_deleter
444
  template<class D, class T>
445
  D* get_deleter(const shared_ptr<T>& p) noexcept;
446
 
 
458
  template<class T = void> struct owner_less;
459
 
460
  // [util.smartptr.enab], class template enable_shared_from_this
461
  template<class T> class enable_shared_from_this;
462
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
  // [util.smartptr.hash], hash support
464
  template<class T> struct hash;
465
  template<class T, class D> struct hash<unique_ptr<T, D>>;
466
  template<class T> struct hash<shared_ptr<T>>;
467
 
468
+ // [util.smartptr.atomic], atomic smart pointers
469
+ template<class T> struct atomic;
470
+ template<class T> struct atomic<shared_ptr<T>>;
471
+ template<class T> struct atomic<weak_ptr<T>>;
472
  }
473
  ```
474