- tmp/tmpihl8vs9l/{from.md → to.md} +210 -143
tmp/tmpihl8vs9l/{from.md → to.md}
RENAMED
|
@@ -3,365 +3,416 @@
|
|
| 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`,
|
| 9 |
-
various function templates that operate
|
| 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 {
|
| 44 |
-
|
|
|
|
|
|
|
| 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 |
-
|
| 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
|
| 57 |
template<class T, class Alloc, class Tuple1, class Tuple2>
|
| 58 |
-
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 59 |
-
|
| 60 |
-
|
| 61 |
template<class T, class Alloc>
|
| 62 |
-
constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept
|
| 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
|
| 66 |
template<class T, class Alloc, class U, class V>
|
| 67 |
-
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 68 |
-
|
| 69 |
template<class T, class Alloc, class U, class V>
|
| 70 |
-
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
|
| 71 |
-
pair<U,V>&
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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,
|
| 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
|
| 96 |
template<class I>
|
| 97 |
-
concept
|
| 98 |
template<class S, class I>
|
| 99 |
-
concept
|
| 100 |
template<class R>
|
| 101 |
-
concept
|
| 102 |
template<class R>
|
| 103 |
-
concept
|
| 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<
|
| 122 |
requires default_initializable<iter_value_t<I>>
|
| 123 |
-
I uninitialized_default_construct(I first, S last);
|
| 124 |
-
template<
|
| 125 |
requires default_initializable<range_value_t<R>>
|
| 126 |
-
borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
|
| 127 |
|
| 128 |
-
template<
|
| 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<
|
| 150 |
requires default_initializable<iter_value_t<I>>
|
| 151 |
-
I uninitialized_value_construct(I first, S last);
|
| 152 |
-
template<
|
| 153 |
requires default_initializable<range_value_t<R>>
|
| 154 |
-
borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
|
| 155 |
|
| 156 |
-
template<
|
| 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,
|
|
|
|
| 163 |
NoThrowForwardIterator result);
|
| 164 |
-
template<class ExecutionPolicy, class
|
| 165 |
NoThrowForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 166 |
-
|
| 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
|
|
|
|
| 172 |
NoThrowForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 173 |
-
|
| 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 |
-
|
| 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,
|
| 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,
|
| 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,
|
|
|
|
| 195 |
}
|
| 196 |
|
| 197 |
template<class InputIterator, class NoThrowForwardIterator>
|
| 198 |
-
NoThrowForwardIterator uninitialized_move(InputIterator first,
|
|
|
|
| 199 |
NoThrowForwardIterator result);
|
| 200 |
-
template<class ExecutionPolicy, class
|
| 201 |
NoThrowForwardIterator uninitialized_move(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 202 |
-
|
| 203 |
NoThrowForwardIterator result);
|
| 204 |
template<class InputIterator, class Size, class NoThrowForwardIterator>
|
| 205 |
pair<InputIterator, NoThrowForwardIterator>
|
| 206 |
-
uninitialized_move_n(InputIterator first, Size n,
|
| 207 |
-
|
| 208 |
-
|
|
|
|
|
|
|
| 209 |
uninitialized_move_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 210 |
-
|
| 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 |
-
|
| 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,
|
| 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 |
-
|
| 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,
|
|
|
|
| 232 |
}
|
| 233 |
|
| 234 |
template<class NoThrowForwardIterator, class T>
|
| 235 |
-
void uninitialized_fill(NoThrowForwardIterator first,
|
| 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<
|
| 251 |
requires constructible_from<iter_value_t<I>, const T&>
|
| 252 |
-
I uninitialized_fill(I first, S last, const T& x);
|
| 253 |
-
template<
|
| 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<
|
| 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,
|
|
|
|
| 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,
|
|
|
|
| 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<
|
| 290 |
requires destructible<iter_value_t<I>>
|
| 291 |
-
constexpr I destroy(I first, S last) noexcept;
|
| 292 |
-
template<
|
| 293 |
requires destructible<range_value_t<R>>
|
| 294 |
-
constexpr borrowed_iterator_t<R> destroy(R&& r) noexcept;
|
| 295 |
|
| 296 |
-
template<
|
| 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);
|
| 309 |
template<class T>
|
| 310 |
-
unique_ptr<T> make_unique(size_t n);
|
| 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();
|
| 316 |
template<class T>
|
| 317 |
-
unique_ptr<T> make_unique_for_overwrite(size_t n);
|
| 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,
|
|
|
|
| 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
|
| 361 |
-
compare_three_way_result_t<typename unique_ptr<T, D>::pointer
|
| 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
|
|
@@ -459,16 +510,32 @@ namespace std {
|
|
| 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 |
|
|
|
|
| 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`,
|
| 9 |
+
`out_ptr_t`, `inout_ptr_t`, and various function templates that operate
|
| 10 |
+
on objects of these types [[smartptr]].
|
| 11 |
+
|
| 12 |
+
Let `POINTER_OF(T)` denote a type that is
|
| 13 |
+
|
| 14 |
+
- `T::pointer` if the *qualified-id* `T::pointer` is valid and denotes a
|
| 15 |
+
type,
|
| 16 |
+
- otherwise, `T::element_type*` if the *qualified-id* `T::element_type`
|
| 17 |
+
is valid and denotes a type,
|
| 18 |
+
- otherwise, `pointer_traits<T>::element_type*`.
|
| 19 |
+
|
| 20 |
+
Let `POINTER_OF_OR(T, U)` denote a type that is:
|
| 21 |
+
|
| 22 |
+
- `POINTER_OF(T)` if `POINTER_OF(T)` is valid and denotes a type,
|
| 23 |
+
- otherwise, `U`.
|
| 24 |
|
| 25 |
``` cpp
|
| 26 |
#include <compare> // see [compare.syn]
|
| 27 |
|
| 28 |
namespace std {
|
| 29 |
// [pointer.traits], pointer traits
|
| 30 |
+
template<class Ptr> struct pointer_traits; // freestanding
|
| 31 |
+
template<class T> struct pointer_traits<T*>; // freestanding
|
| 32 |
|
| 33 |
// [pointer.conversion], pointer conversion
|
| 34 |
template<class T>
|
| 35 |
+
constexpr T* to_address(T* p) noexcept; // freestanding
|
| 36 |
template<class Ptr>
|
| 37 |
+
constexpr auto to_address(const Ptr& p) noexcept; // freestanding
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
// [ptr.align], pointer alignment
|
| 40 |
+
void* align(size_t alignment, size_t size, void*& ptr, size_t& space); // freestanding
|
| 41 |
template<size_t N, class T>
|
| 42 |
+
[[nodiscard]] constexpr T* assume_aligned(T* ptr); // freestanding
|
| 43 |
+
|
| 44 |
+
// [obj.lifetime], explicit lifetime management
|
| 45 |
+
template<class T>
|
| 46 |
+
T* start_lifetime_as(void* p) noexcept; // freestanding
|
| 47 |
+
template<class T>
|
| 48 |
+
const T* start_lifetime_as(const void* p) noexcept; // freestanding
|
| 49 |
+
template<class T>
|
| 50 |
+
volatile T* start_lifetime_as(volatile void* p) noexcept; // freestanding
|
| 51 |
+
template<class T>
|
| 52 |
+
const volatile T* start_lifetime_as(const volatile void* p) noexcept; // freestanding
|
| 53 |
+
template<class T>
|
| 54 |
+
T* start_lifetime_as_array(void* p, size_t n) noexcept; // freestanding
|
| 55 |
+
template<class T>
|
| 56 |
+
const T* start_lifetime_as_array(const void* p, size_t n) noexcept; // freestanding
|
| 57 |
+
template<class T>
|
| 58 |
+
volatile T* start_lifetime_as_array(volatile void* p, size_t n) noexcept; // freestanding
|
| 59 |
+
template<class T>
|
| 60 |
+
const volatile T* start_lifetime_as_array(const volatile void* p, // freestanding
|
| 61 |
+
size_t n) noexcept;
|
| 62 |
|
| 63 |
// [allocator.tag], allocator argument tag
|
| 64 |
+
struct allocator_arg_t { // freestanding
|
| 65 |
+
explicit allocator_arg_t() = default; // freestanding
|
| 66 |
+
};
|
| 67 |
+
inline constexpr allocator_arg_t allocator_arg{}; // freestanding
|
| 68 |
|
| 69 |
// [allocator.uses], uses_allocator
|
| 70 |
+
template<class T, class Alloc> struct uses_allocator; // freestanding
|
| 71 |
|
| 72 |
// [allocator.uses.trait], uses_allocator
|
| 73 |
template<class T, class Alloc>
|
| 74 |
+
constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value; // freestanding
|
| 75 |
|
| 76 |
// [allocator.uses.construction], uses-allocator construction
|
| 77 |
template<class T, class Alloc, class... Args>
|
| 78 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding
|
| 79 |
+
Args&&... args) noexcept;
|
| 80 |
template<class T, class Alloc, class Tuple1, class Tuple2>
|
| 81 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding
|
| 82 |
+
piecewise_construct_t,
|
| 83 |
+
Tuple1&& x, Tuple2&& y) noexcept;
|
| 84 |
template<class T, class Alloc>
|
| 85 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept; // freestanding
|
| 86 |
template<class T, class Alloc, class U, class V>
|
| 87 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding
|
| 88 |
+
U&& u, V&& v) noexcept;
|
| 89 |
template<class T, class Alloc, class U, class V>
|
| 90 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding
|
| 91 |
+
pair<U, V>& pr) noexcept;
|
| 92 |
template<class T, class Alloc, class U, class V>
|
| 93 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding
|
| 94 |
+
const pair<U, V>& pr) noexcept;
|
| 95 |
+
template<class T, class Alloc, class U, class V>
|
| 96 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding
|
| 97 |
+
pair<U, V>&& pr) noexcept;
|
| 98 |
+
template<class T, class Alloc, class U, class V>
|
| 99 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding
|
| 100 |
+
const pair<U, V>&& pr) noexcept;
|
| 101 |
+
template<class T, class Alloc, pair-like P>
|
| 102 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding
|
| 103 |
+
P&& p) noexcept;
|
| 104 |
+
template<class T, class Alloc, class U>
|
| 105 |
+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding
|
| 106 |
+
U&& u) noexcept;
|
| 107 |
template<class T, class Alloc, class... Args>
|
| 108 |
+
constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args); // freestanding
|
| 109 |
template<class T, class Alloc, class... Args>
|
| 110 |
+
constexpr T* uninitialized_construct_using_allocator(T* p, // freestanding
|
| 111 |
+
const Alloc& alloc, Args&&... args);
|
| 112 |
|
| 113 |
// [allocator.traits], allocator traits
|
| 114 |
+
template<class Alloc> struct allocator_traits; // freestanding
|
| 115 |
+
|
| 116 |
+
template<class Pointer, class SizeType = size_t>
|
| 117 |
+
struct allocation_result { // freestanding
|
| 118 |
+
Pointer ptr;
|
| 119 |
+
SizeType count;
|
| 120 |
+
};
|
| 121 |
|
| 122 |
// [default.allocator], the default allocator
|
| 123 |
template<class T> class allocator;
|
| 124 |
template<class T, class U>
|
| 125 |
constexpr bool operator==(const allocator<T>&, const allocator<U>&) noexcept;
|
| 126 |
|
| 127 |
// [specialized.addressof], addressof
|
| 128 |
template<class T>
|
| 129 |
+
constexpr T* addressof(T& r) noexcept; // freestanding
|
| 130 |
template<class T>
|
| 131 |
+
const T* addressof(const T&&) = delete; // freestanding
|
| 132 |
|
| 133 |
// [specialized.algorithms], specialized algorithms
|
| 134 |
// [special.mem.concepts], special memory concepts
|
| 135 |
template<class I>
|
| 136 |
+
concept nothrow-input-iterator = see below; // exposition only
|
| 137 |
template<class I>
|
| 138 |
+
concept nothrow-forward-iterator = see below; // exposition only
|
| 139 |
template<class S, class I>
|
| 140 |
+
concept nothrow-sentinel-for = see below; // exposition only
|
| 141 |
template<class R>
|
| 142 |
+
concept nothrow-input-range = see below; // exposition only
|
| 143 |
template<class R>
|
| 144 |
+
concept nothrow-forward-range = see below; // exposition only
|
| 145 |
|
| 146 |
template<class NoThrowForwardIterator>
|
| 147 |
+
void uninitialized_default_construct(NoThrowForwardIterator first, // freestanding
|
| 148 |
NoThrowForwardIterator last);
|
| 149 |
template<class ExecutionPolicy, class NoThrowForwardIterator>
|
| 150 |
void uninitialized_default_construct(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 151 |
NoThrowForwardIterator first,
|
| 152 |
NoThrowForwardIterator last);
|
| 153 |
template<class NoThrowForwardIterator, class Size>
|
| 154 |
NoThrowForwardIterator
|
| 155 |
+
uninitialized_default_construct_n(NoThrowForwardIterator first, Size n); // freestanding
|
| 156 |
template<class ExecutionPolicy, class NoThrowForwardIterator, class Size>
|
| 157 |
NoThrowForwardIterator
|
| 158 |
uninitialized_default_construct_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 159 |
NoThrowForwardIterator first, Size n);
|
| 160 |
|
| 161 |
namespace ranges {
|
| 162 |
+
template<nothrow-forward-iterator I, nothrow-sentinel-for<I> S>
|
| 163 |
requires default_initializable<iter_value_t<I>>
|
| 164 |
+
I uninitialized_default_construct(I first, S last); // freestanding
|
| 165 |
+
template<nothrow-forward-range R>
|
| 166 |
requires default_initializable<range_value_t<R>>
|
| 167 |
+
borrowed_iterator_t<R> uninitialized_default_construct(R&& r); // freestanding
|
| 168 |
|
| 169 |
+
template<nothrow-forward-iterator I>
|
| 170 |
requires default_initializable<iter_value_t<I>>
|
| 171 |
+
I uninitialized_default_construct_n(I first, iter_difference_t<I> n); // freestanding
|
| 172 |
}
|
| 173 |
|
| 174 |
template<class NoThrowForwardIterator>
|
| 175 |
+
void uninitialized_value_construct(NoThrowForwardIterator first, // freestanding
|
| 176 |
NoThrowForwardIterator last);
|
| 177 |
template<class ExecutionPolicy, class NoThrowForwardIterator>
|
| 178 |
void uninitialized_value_construct(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 179 |
NoThrowForwardIterator first,
|
| 180 |
NoThrowForwardIterator last);
|
| 181 |
template<class NoThrowForwardIterator, class Size>
|
| 182 |
NoThrowForwardIterator
|
| 183 |
+
uninitialized_value_construct_n(NoThrowForwardIterator first, Size n); // freestanding
|
| 184 |
template<class ExecutionPolicy, class NoThrowForwardIterator, class Size>
|
| 185 |
NoThrowForwardIterator
|
| 186 |
uninitialized_value_construct_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 187 |
NoThrowForwardIterator first, Size n);
|
| 188 |
|
| 189 |
namespace ranges {
|
| 190 |
+
template<nothrow-forward-iterator I, nothrow-sentinel-for<I> S>
|
| 191 |
requires default_initializable<iter_value_t<I>>
|
| 192 |
+
I uninitialized_value_construct(I first, S last); // freestanding
|
| 193 |
+
template<nothrow-forward-range R>
|
| 194 |
requires default_initializable<range_value_t<R>>
|
| 195 |
+
borrowed_iterator_t<R> uninitialized_value_construct(R&& r); // freestanding
|
| 196 |
|
| 197 |
+
template<nothrow-forward-iterator I>
|
| 198 |
requires default_initializable<iter_value_t<I>>
|
| 199 |
+
I uninitialized_value_construct_n(I first, iter_difference_t<I> n); // freestanding
|
| 200 |
}
|
| 201 |
|
| 202 |
template<class InputIterator, class NoThrowForwardIterator>
|
| 203 |
+
NoThrowForwardIterator uninitialized_copy(InputIterator first, // freestanding
|
| 204 |
+
InputIterator last,
|
| 205 |
NoThrowForwardIterator result);
|
| 206 |
+
template<class ExecutionPolicy, class ForwardIterator, class NoThrowForwardIterator>
|
| 207 |
NoThrowForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 208 |
+
ForwardIterator first, ForwardIterator last,
|
| 209 |
NoThrowForwardIterator result);
|
| 210 |
template<class InputIterator, class Size, class NoThrowForwardIterator>
|
| 211 |
+
NoThrowForwardIterator uninitialized_copy_n(InputIterator first, Size n, // freestanding
|
| 212 |
NoThrowForwardIterator result);
|
| 213 |
+
template<class ExecutionPolicy, class ForwardIterator, class Size,
|
| 214 |
+
class NoThrowForwardIterator>
|
| 215 |
NoThrowForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 216 |
+
ForwardIterator first, Size n,
|
| 217 |
NoThrowForwardIterator result);
|
| 218 |
|
| 219 |
namespace ranges {
|
| 220 |
template<class I, class O>
|
| 221 |
+
using uninitialized_copy_result = in_out_result<I, O>; // freestanding
|
| 222 |
template<input_iterator I, sentinel_for<I> S1,
|
| 223 |
+
nothrow-forward-iterator O, nothrow-sentinel-for<O> S2>
|
| 224 |
requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
|
| 225 |
uninitialized_copy_result<I, O>
|
| 226 |
+
uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast); // freestanding
|
| 227 |
+
template<input_range IR, nothrow-forward-range OR>
|
| 228 |
requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
|
| 229 |
uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
|
| 230 |
+
uninitialized_copy(IR&& in_range, OR&& out_range); // freestanding
|
| 231 |
|
| 232 |
template<class I, class O>
|
| 233 |
+
using uninitialized_copy_n_result = in_out_result<I, O>; // freestanding
|
| 234 |
+
template<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for<O> S>
|
| 235 |
requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
|
| 236 |
uninitialized_copy_n_result<I, O>
|
| 237 |
+
uninitialized_copy_n(I ifirst, iter_difference_t<I> n, // freestanding
|
| 238 |
+
O ofirst, S olast);
|
| 239 |
}
|
| 240 |
|
| 241 |
template<class InputIterator, class NoThrowForwardIterator>
|
| 242 |
+
NoThrowForwardIterator uninitialized_move(InputIterator first, // freestanding
|
| 243 |
+
InputIterator last,
|
| 244 |
NoThrowForwardIterator result);
|
| 245 |
+
template<class ExecutionPolicy, class ForwardIterator, class NoThrowForwardIterator>
|
| 246 |
NoThrowForwardIterator uninitialized_move(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 247 |
+
ForwardIterator first, ForwardIterator last,
|
| 248 |
NoThrowForwardIterator result);
|
| 249 |
template<class InputIterator, class Size, class NoThrowForwardIterator>
|
| 250 |
pair<InputIterator, NoThrowForwardIterator>
|
| 251 |
+
uninitialized_move_n(InputIterator first, Size n, // freestanding
|
| 252 |
+
NoThrowForwardIterator result);
|
| 253 |
+
template<class ExecutionPolicy, class ForwardIterator, class Size,
|
| 254 |
+
class NoThrowForwardIterator>
|
| 255 |
+
pair<ForwardIterator, NoThrowForwardIterator>
|
| 256 |
uninitialized_move_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 257 |
+
ForwardIterator first, Size n, NoThrowForwardIterator result);
|
| 258 |
|
| 259 |
namespace ranges {
|
| 260 |
template<class I, class O>
|
| 261 |
+
using uninitialized_move_result = in_out_result<I, O>; // freestanding
|
| 262 |
template<input_iterator I, sentinel_for<I> S1,
|
| 263 |
+
nothrow-forward-iterator O, nothrow-sentinel-for<O> S2>
|
| 264 |
requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
|
| 265 |
uninitialized_move_result<I, O>
|
| 266 |
+
uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast); // freestanding
|
| 267 |
+
template<input_range IR, nothrow-forward-range OR>
|
| 268 |
requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
|
| 269 |
uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
|
| 270 |
+
uninitialized_move(IR&& in_range, OR&& out_range); // freestanding
|
| 271 |
|
| 272 |
template<class I, class O>
|
| 273 |
+
using uninitialized_move_n_result = in_out_result<I, O>; // freestanding
|
| 274 |
template<input_iterator I,
|
| 275 |
+
nothrow-forward-iterator O, nothrow-sentinel-for<O> S>
|
| 276 |
requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
|
| 277 |
uninitialized_move_n_result<I, O>
|
| 278 |
+
uninitialized_move_n(I ifirst, iter_difference_t<I> n, // freestanding
|
| 279 |
+
O ofirst, S olast);
|
| 280 |
}
|
| 281 |
|
| 282 |
template<class NoThrowForwardIterator, class T>
|
| 283 |
+
void uninitialized_fill(NoThrowForwardIterator first, // freestanding
|
| 284 |
+
NoThrowForwardIterator last, const T& x);
|
| 285 |
template<class ExecutionPolicy, class NoThrowForwardIterator, class T>
|
| 286 |
void uninitialized_fill(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 287 |
NoThrowForwardIterator first, NoThrowForwardIterator last,
|
| 288 |
const T& x);
|
| 289 |
template<class NoThrowForwardIterator, class Size, class T>
|
| 290 |
NoThrowForwardIterator
|
| 291 |
+
uninitialized_fill_n(NoThrowForwardIterator first, Size n, const T& x); // freestanding
|
| 292 |
template<class ExecutionPolicy, class NoThrowForwardIterator, class Size, class T>
|
| 293 |
NoThrowForwardIterator
|
| 294 |
uninitialized_fill_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 295 |
NoThrowForwardIterator first, Size n, const T& x);
|
| 296 |
|
| 297 |
namespace ranges {
|
| 298 |
+
template<nothrow-forward-iterator I, nothrow-sentinel-for<I> S, class T>
|
| 299 |
requires constructible_from<iter_value_t<I>, const T&>
|
| 300 |
+
I uninitialized_fill(I first, S last, const T& x); // freestanding
|
| 301 |
+
template<nothrow-forward-range R, class T>
|
| 302 |
requires constructible_from<range_value_t<R>, const T&>
|
| 303 |
+
borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x); // freestanding
|
| 304 |
|
| 305 |
+
template<nothrow-forward-iterator I, class T>
|
| 306 |
requires constructible_from<iter_value_t<I>, const T&>
|
| 307 |
+
I uninitialized_fill_n(I first, iter_difference_t<I> n, const T& x); // freestanding
|
| 308 |
}
|
| 309 |
|
| 310 |
// [specialized.construct], construct_at
|
| 311 |
template<class T, class... Args>
|
| 312 |
+
constexpr T* construct_at(T* location, Args&&... args); // freestanding
|
| 313 |
|
| 314 |
namespace ranges {
|
| 315 |
template<class T, class... Args>
|
| 316 |
+
constexpr T* construct_at(T* location, Args&&... args); // freestanding
|
| 317 |
}
|
| 318 |
|
| 319 |
// [specialized.destroy], destroy
|
| 320 |
template<class T>
|
| 321 |
+
constexpr void destroy_at(T* location); // freestanding
|
| 322 |
template<class NoThrowForwardIterator>
|
| 323 |
+
constexpr void destroy(NoThrowForwardIterator first, // freestanding
|
| 324 |
+
NoThrowForwardIterator last);
|
| 325 |
template<class ExecutionPolicy, class NoThrowForwardIterator>
|
| 326 |
void destroy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 327 |
NoThrowForwardIterator first, NoThrowForwardIterator last);
|
| 328 |
template<class NoThrowForwardIterator, class Size>
|
| 329 |
+
constexpr NoThrowForwardIterator destroy_n(NoThrowForwardIterator first, // freestanding
|
| 330 |
+
Size n);
|
| 331 |
template<class ExecutionPolicy, class NoThrowForwardIterator, class Size>
|
| 332 |
NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads]
|
| 333 |
NoThrowForwardIterator first, Size n);
|
| 334 |
|
| 335 |
namespace ranges {
|
| 336 |
template<destructible T>
|
| 337 |
+
constexpr void destroy_at(T* location) noexcept; // freestanding
|
| 338 |
|
| 339 |
+
template<nothrow-input-iterator I, nothrow-sentinel-for<I> S>
|
| 340 |
requires destructible<iter_value_t<I>>
|
| 341 |
+
constexpr I destroy(I first, S last) noexcept; // freestanding
|
| 342 |
+
template<nothrow-input-range R>
|
| 343 |
requires destructible<range_value_t<R>>
|
| 344 |
+
constexpr borrowed_iterator_t<R> destroy(R&& r) noexcept; // freestanding
|
| 345 |
|
| 346 |
+
template<nothrow-input-iterator I>
|
| 347 |
requires destructible<iter_value_t<I>>
|
| 348 |
+
constexpr I destroy_n(I first, iter_difference_t<I> n) noexcept; // freestanding
|
| 349 |
}
|
| 350 |
|
| 351 |
// [unique.ptr], class template unique_ptr
|
| 352 |
+
template<class T> struct default_delete; // freestanding
|
| 353 |
+
template<class T> struct default_delete<T[]>; // freestanding
|
| 354 |
+
template<class T, class D = default_delete<T>> class unique_ptr; // freestanding
|
| 355 |
+
template<class T, class D> class unique_ptr<T[], D>; // freestanding
|
| 356 |
|
| 357 |
template<class T, class... Args>
|
| 358 |
+
constexpr unique_ptr<T> make_unique(Args&&... args); // T is not array
|
| 359 |
template<class T>
|
| 360 |
+
constexpr unique_ptr<T> make_unique(size_t n); // T is U[]
|
| 361 |
template<class T, class... Args>
|
| 362 |
unspecified make_unique(Args&&...) = delete; // T is U[N]
|
| 363 |
|
| 364 |
template<class T>
|
| 365 |
+
constexpr unique_ptr<T> make_unique_for_overwrite(); // T is not array
|
| 366 |
template<class T>
|
| 367 |
+
constexpr unique_ptr<T> make_unique_for_overwrite(size_t n); // T is U[]
|
| 368 |
template<class T, class... Args>
|
| 369 |
unspecified make_unique_for_overwrite(Args&&...) = delete; // T is U[N]
|
| 370 |
|
| 371 |
template<class T, class D>
|
| 372 |
+
constexpr void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept; // freestanding
|
| 373 |
|
| 374 |
template<class T1, class D1, class T2, class D2>
|
| 375 |
+
constexpr bool operator==(const unique_ptr<T1, D1>& x, // freestanding
|
| 376 |
+
const unique_ptr<T2, D2>& y);
|
| 377 |
template<class T1, class D1, class T2, class D2>
|
| 378 |
+
bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); // freestanding
|
| 379 |
template<class T1, class D1, class T2, class D2>
|
| 380 |
+
bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); // freestanding
|
| 381 |
template<class T1, class D1, class T2, class D2>
|
| 382 |
+
bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); // freestanding
|
| 383 |
template<class T1, class D1, class T2, class D2>
|
| 384 |
+
bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); // freestanding
|
| 385 |
template<class T1, class D1, class T2, class D2>
|
| 386 |
requires three_way_comparable_with<typename unique_ptr<T1, D1>::pointer,
|
| 387 |
typename unique_ptr<T2, D2>::pointer>
|
| 388 |
compare_three_way_result_t<typename unique_ptr<T1, D1>::pointer,
|
| 389 |
typename unique_ptr<T2, D2>::pointer>
|
| 390 |
+
operator<=>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); // freestanding
|
| 391 |
|
| 392 |
template<class T, class D>
|
| 393 |
+
constexpr bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept; // freestanding
|
| 394 |
template<class T, class D>
|
| 395 |
+
constexpr bool operator<(const unique_ptr<T, D>& x, nullptr_t); // freestanding
|
| 396 |
template<class T, class D>
|
| 397 |
+
constexpr bool operator<(nullptr_t, const unique_ptr<T, D>& y); // freestanding
|
| 398 |
template<class T, class D>
|
| 399 |
+
constexpr bool operator>(const unique_ptr<T, D>& x, nullptr_t); // freestanding
|
| 400 |
template<class T, class D>
|
| 401 |
+
constexpr bool operator>(nullptr_t, const unique_ptr<T, D>& y); // freestanding
|
| 402 |
template<class T, class D>
|
| 403 |
+
constexpr bool operator<=(const unique_ptr<T, D>& x, nullptr_t); // freestanding
|
| 404 |
template<class T, class D>
|
| 405 |
+
constexpr bool operator<=(nullptr_t, const unique_ptr<T, D>& y); // freestanding
|
| 406 |
template<class T, class D>
|
| 407 |
+
constexpr bool operator>=(const unique_ptr<T, D>& x, nullptr_t); // freestanding
|
| 408 |
template<class T, class D>
|
| 409 |
+
constexpr bool operator>=(nullptr_t, const unique_ptr<T, D>& y); // freestanding
|
| 410 |
template<class T, class D>
|
| 411 |
+
requires three_way_comparable<typename unique_ptr<T, D>::pointer>
|
| 412 |
+
constexpr compare_three_way_result_t<typename unique_ptr<T, D>::pointer>
|
| 413 |
+
operator<=>(const unique_ptr<T, D>& x, nullptr_t); // freestanding
|
| 414 |
|
| 415 |
template<class E, class T, class Y, class D>
|
| 416 |
basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const unique_ptr<Y, D>& p);
|
| 417 |
|
| 418 |
// [util.smartptr.weak.bad], class bad_weak_ptr
|
|
|
|
| 510 |
|
| 511 |
// [util.smartptr.enab], class template enable_shared_from_this
|
| 512 |
template<class T> class enable_shared_from_this;
|
| 513 |
|
| 514 |
// [util.smartptr.hash], hash support
|
| 515 |
+
template<class T> struct hash; // freestanding
|
| 516 |
+
template<class T, class D> struct hash<unique_ptr<T, D>>; // freestanding
|
| 517 |
template<class T> struct hash<shared_ptr<T>>;
|
| 518 |
|
| 519 |
// [util.smartptr.atomic], atomic smart pointers
|
| 520 |
+
template<class T> struct atomic; // freestanding
|
| 521 |
template<class T> struct atomic<shared_ptr<T>>;
|
| 522 |
template<class T> struct atomic<weak_ptr<T>>;
|
| 523 |
+
|
| 524 |
+
// [out.ptr.t], class template out_ptr_t
|
| 525 |
+
template<class Smart, class Pointer, class... Args>
|
| 526 |
+
class out_ptr_t;
|
| 527 |
+
|
| 528 |
+
// [out.ptr], function template out_ptr
|
| 529 |
+
template<class Pointer = void, class Smart, class... Args>
|
| 530 |
+
auto out_ptr(Smart& s, Args&&... args);
|
| 531 |
+
|
| 532 |
+
// [inout.ptr.t], class template inout_ptr_t
|
| 533 |
+
template<class Smart, class Pointer, class... Args>
|
| 534 |
+
class inout_ptr_t;
|
| 535 |
+
|
| 536 |
+
// [inout.ptr], function template inout_ptr
|
| 537 |
+
template<class Pointer = void, class Smart, class... Args>
|
| 538 |
+
auto inout_ptr(Smart& s, Args&&... args);
|
| 539 |
}
|
| 540 |
```
|
| 541 |
|