From Jason Turner

[memory.syn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpqfurjd17/{from.md → to.md} +105 -51
tmp/tmpqfurjd17/{from.md → to.md} RENAMED
@@ -1,11 +1,11 @@
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, and construct multiple objects
6
- 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
@@ -21,55 +21,106 @@ namespace std {
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(std::size_t alignment, std::size_t size,
27
- void*& ptr, std::size_t& space);
28
 
29
  // [allocator.tag], allocator argument tag
30
- struct allocator_arg_t { };
31
- constexpr allocator_arg_t allocator_arg{};
32
 
33
  // [allocator.uses], uses_allocator
34
  template <class T, class Alloc> struct uses_allocator;
35
 
36
  // [allocator.traits], allocator traits
37
  template <class Alloc> struct allocator_traits;
38
 
39
- // [default.allocator], the default allocator:
40
  template <class T> class allocator;
41
- template <> class allocator<void>;
42
  template <class T, class U>
43
  bool operator==(const allocator<T>&, const allocator<U>&) noexcept;
44
  template <class T, class U>
45
  bool operator!=(const allocator<T>&, const allocator<U>&) noexcept;
46
 
47
- // [storage.iterator], raw storage iterator:
48
- template <class OutputIterator, class T> class raw_storage_iterator;
49
-
50
- // [temporary.buffer], temporary buffers:
51
- template <class T>
52
- pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n) noexcept;
53
- template <class T>
54
- void return_temporary_buffer(T* p);
55
-
56
- // [specialized.algorithms], specialized algorithms:
57
- template <class T> T* addressof(T& r) noexcept;
 
 
 
 
 
 
 
 
 
 
 
 
58
  template <class InputIterator, class ForwardIterator>
59
  ForwardIterator uninitialized_copy(InputIterator first, InputIterator last,
60
  ForwardIterator result);
 
 
 
 
61
  template <class InputIterator, class Size, class ForwardIterator>
62
  ForwardIterator uninitialized_copy_n(InputIterator first, Size n,
63
  ForwardIterator result);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  template <class ForwardIterator, class T>
65
  void uninitialized_fill(ForwardIterator first, ForwardIterator last,
66
  const T& x);
 
 
 
 
67
  template <class ForwardIterator, class Size, class T>
68
  ForwardIterator uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
- // [unique.ptr] class template unique_ptr:
71
  template <class T> struct default_delete;
72
  template <class T> struct default_delete<T[]>;
73
  template <class T, class D = default_delete<T>> class unique_ptr;
74
  template <class T, class D> class unique_ptr<T[], D>;
75
 
@@ -115,34 +166,35 @@ namespace std {
115
  template <class T, class D>
116
  bool operator>=(const unique_ptr<T, D>& x, nullptr_t);
117
  template <class T, class D>
118
  bool operator>=(nullptr_t, const unique_ptr<T, D>& y);
119
 
120
- // [util.smartptr.weakptr], class bad_weak_ptr:
121
  class bad_weak_ptr;
122
 
123
- // [util.smartptr.shared], class template shared_ptr:
124
  template<class T> class shared_ptr;
125
 
126
  // [util.smartptr.shared.create], shared_ptr creation
127
- template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args);
 
128
  template<class T, class A, class... Args>
129
  shared_ptr<T> allocate_shared(const A& a, Args&&... args);
130
 
131
- // [util.smartptr.shared.cmp], shared_ptr comparisons:
132
  template<class T, class U>
133
- bool operator==(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;
134
  template<class T, class U>
135
- bool operator!=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;
136
  template<class T, class U>
137
- bool operator<(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;
138
  template<class T, class U>
139
- bool operator>(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;
140
  template<class T, class U>
141
- bool operator<=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;
142
  template<class T, class U>
143
- bool operator>=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;
144
 
145
  template <class T>
146
  bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept;
147
  template <class T>
148
  bool operator==(nullptr_t, const shared_ptr<T>& y) noexcept;
@@ -165,41 +217,43 @@ namespace std {
165
  template <class T>
166
  bool operator>=(const shared_ptr<T>& x, nullptr_t) noexcept;
167
  template <class T>
168
  bool operator>=(nullptr_t, const shared_ptr<T>& y) noexcept;
169
 
170
- // [util.smartptr.shared.spec], shared_ptr specialized algorithms:
171
- template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept;
 
172
 
173
- // [util.smartptr.shared.cast], shared_ptr casts:
174
  template<class T, class U>
175
- shared_ptr<T> static_pointer_cast(shared_ptr<U> const& r) noexcept;
176
  template<class T, class U>
177
- shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const& r) noexcept;
178
  template<class T, class U>
179
- shared_ptr<T> const_pointer_cast(shared_ptr<U> const& r) noexcept;
180
 
181
- // [util.smartptr.getdeleter], shared_ptr get_deleter:
182
- template<class D, class T> D* get_deleter(shared_ptr<T> const& p) noexcept;
 
183
 
184
- // [util.smartptr.shared.io], shared_ptr I/O:
185
  template<class E, class T, class Y>
186
- basic_ostream<E, T>& operator<< (basic_ostream<E, T>& os, shared_ptr<Y> const& p);
187
 
188
- // [util.smartptr.weak], class template weak_ptr:
189
  template<class T> class weak_ptr;
190
 
191
- // [util.smartptr.weak.spec], weak_ptr specialized algorithms:
192
  template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;
193
 
194
- // [util.smartptr.ownerless], class template owner_less:
195
- template<class T> class owner_less;
196
 
197
- // [util.smartptr.enab], class template enable_shared_from_this:
198
  template<class T> class enable_shared_from_this;
199
 
200
- // [util.smartptr.shared.atomic], shared_ptr atomic access:
201
  template<class T>
202
  bool atomic_is_lock_free(const shared_ptr<T>* p);
203
 
204
  template<class T>
205
  shared_ptr<T> atomic_load(const shared_ptr<T>* p);
@@ -212,12 +266,11 @@ namespace std {
212
  void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
213
 
214
  template<class T>
215
  shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r);
216
  template<class T>
217
- shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r,
218
- memory_order mo);
219
 
220
  template<class T>
221
  bool atomic_compare_exchange_weak(
222
  shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
223
  template<class T>
@@ -230,15 +283,16 @@ namespace std {
230
  template<class T>
231
  bool atomic_compare_exchange_strong_explicit(
232
  shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
233
  memory_order success, memory_order failure);
234
 
235
- // [util.smartptr.hash] hash support
236
  template <class T> struct hash;
237
  template <class T, class D> struct hash<unique_ptr<T, D>>;
238
  template <class T> struct hash<shared_ptr<T>>;
239
 
240
- // [depr.auto.ptr], auto_ptr (deprecated)
241
- template <class X> class auto_ptr;
 
242
  }
243
  ```
244
 
 
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
 
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
 
 
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;
 
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
 
238
+ // [util.smartptr.shared.io], shared_ptr I/O
239
  template<class E, class T, class Y>
240
+ basic_ostream<E, T>& operator<< (basic_ostream<E, T>& os, const shared_ptr<Y>& p);
241
 
242
+ // [util.smartptr.weak], class template weak_ptr
243
  template<class T> class weak_ptr;
244
 
245
+ // [util.smartptr.weak.spec], weak_ptr specialized algorithms
246
  template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;
247
 
248
+ // [util.smartptr.ownerless], class template owner_less
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);
 
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>
 
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