Files
cppdraft_translate/cppdraft/memory/syn.md
2025-10-25 03:02:53 +03:00

52 KiB
Raw Blame History

[memory.syn]

20 Memory management library [mem]

20.2 Memory [memory]

20.2.2 Header synopsis [memory.syn]

1

#

The header defines several types and function templates that describe properties of pointers and pointer-like types, manage memory for containers and other template types, destroy objects, and construct objects in uninitialized memory buffers ([pointer.traits]–[specialized.addressof] and [specialized.algorithms]).

The header also defines the templatesunique_ptr, shared_ptr, weak_ptr,out_ptr_t, inout_ptr_t, and various function templates that operate on objects of these types ([smartptr]).

2

#

Let POINTER_OF(T) denote a type that is

T::pointer if the qualified-id T::pointer is valid and denotes a type,

otherwise, T::element_type* if the qualified-id T::element_type is valid and denotes a type,

otherwise, pointer_traits::element_type*.

3

#

Let POINTER_OF_OR(T, U) denote a type that is:

POINTER_OF(T) if POINTER_OF(T) is valid and denotes a type,

otherwise, U.

#include // see [compare.syn]namespace std {// [pointer.traits], pointer traitstemplate struct pointer_traits; // freestandingtemplate struct pointer_traits<T*>; // freestanding// [pointer.conversion], pointer conversiontemplateconstexpr T* to_address(T* p) noexcept; // freestandingtemplateconstexpr auto to_address(const Ptr& p) noexcept; // freestanding// [ptr.align], pointer alignmentvoid* align(size_t alignment, size_t size, void*& ptr, size_t& space); // freestandingtemplate<size_t N, class T>constexpr T* assume_aligned(T* ptr); // freestandingtemplate<size_t Alignment, class T>bool is_sufficiently_aligned(T* ptr); // [obj.lifetime], explicit lifetime managementtemplate T* start_lifetime_as(void* p) noexcept; // freestandingtemplateconst T* start_lifetime_as(const void* p) noexcept; // freestandingtemplatevolatile T* start_lifetime_as(volatile void* p) noexcept; // freestandingtemplateconst volatile T* start_lifetime_as(const volatile void* p) noexcept; // freestandingtemplate T* start_lifetime_as_array(void* p, size_t n) noexcept; // freestandingtemplateconst T* start_lifetime_as_array(const void* p, size_t n) noexcept; // freestandingtemplatevolatile T* start_lifetime_as_array(volatile void* p, size_t n) noexcept; // freestandingtemplateconst volatile T* start_lifetime_as_array(const volatile void* p, // freestanding size_t n) noexcept; template T* trivially_relocate(T* first, T* last, T* result); // freestandingtemplateconstexpr T* relocate(T* first, T* last, T* result); // freestanding// [allocator.tag], allocator argument tagstruct allocator_arg_t { explicit allocator_arg_t() = default; }; // freestandinginline constexpr allocator_arg_t allocator_arg{}; // freestanding// [allocator.uses], uses_allocatortemplate<class T, class Alloc> struct uses_allocator; // freestanding// [allocator.uses.trait], uses_allocatortemplate<class T, class Alloc>constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value; // freestanding// [allocator.uses.construction], uses-allocator constructiontemplate<class T, class Alloc, class... Args>constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding Args&&... args) noexcept; template<class T, class Alloc, class Tuple1, class Tuple2>constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding piecewise_construct_t, Tuple1&& x, Tuple2&& y) noexcept; template<class T, class Alloc>constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept; // freestandingtemplate<class T, class Alloc, class U, class V>constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding U&& u, V&& v) noexcept; template<class T, class Alloc, class U, class V>constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding pair<U, V>& pr) noexcept; template<class T, class Alloc, class U, class V>constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestandingconst pair<U, V>& pr) noexcept; template<class T, class Alloc, class U, class V>constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding pair<U, V>&& pr) noexcept; template<class T, class Alloc, class U, class V>constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestandingconst pair<U, V>&& pr) noexcept; template<class T, class Alloc, pair-like P>constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding P&& p) noexcept; template<class T, class Alloc, class U>constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding U&& u) noexcept; template<class T, class Alloc, class... Args>constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args); // freestandingtemplate<class T, class Alloc, class... Args>constexpr T* uninitialized_construct_using_allocator(T* p, // freestandingconst Alloc& alloc, Args&&... args); // [allocator.traits], allocator traitstemplate struct allocator_traits; // freestandingtemplate<class Pointer, class SizeType = size_t>struct allocation_result { // freestanding Pointer ptr; SizeType count; }; // [default.allocator], the default allocatortemplate class allocator; template<class T, class U>constexpr bool operator==(const allocator&, const allocator&) noexcept; // [specialized.addressof], addressoftemplateconstexpr T* addressof(T& r) noexcept; // freestandingtemplateconst T* addressof(const T&&) = delete; // freestanding// [specialized.algorithms], specialized algorithms// [special.mem.concepts], special memory conceptstemplateconcept nothrow-input-iterator = see below; // exposition onlytemplateconcept nothrow-forward-iterator = see below; // exposition onlytemplateconcept nothrow-bidirectional-iterator = see below; // exposition onlytemplateconcept nothrow-random-access-iterator = see below; // exposition onlytemplate<class S, class I>concept nothrow-sentinel-for = see below; // exposition onlytemplate<class S, class I>concept nothrow-sized-sentinel-for = see below; // exposition onlytemplateconcept nothrow-input-range = see below; // exposition onlytemplateconcept nothrow-forward-range = see below; // exposition onlytemplateconcept nothrow-bidirectional-range = see below; // exposition onlytemplateconcept nothrow-random-access-range = see below; // exposition onlytemplateconcept nothrow-sized-random-access-range = see below; // exposition onlytemplateconstexpr void uninitialized_default_construct(NoThrowForwardIterator first, // freestanding NoThrowForwardIterator last); template<class ExecutionPolicy, class NoThrowForwardIterator>void uninitialized_default_construct(ExecutionPolicy&& exec, // freestanding-deleted, NoThrowForwardIterator first, // see [algorithms.parallel.overloads] NoThrowForwardIterator last); template<class NoThrowForwardIterator, class Size>constexpr NoThrowForwardIterator uninitialized_default_construct_n(NoThrowForwardIterator first, Size n); // freestandingtemplate<class ExecutionPolicy, class NoThrowForwardIterator, class Size> NoThrowForwardIterator uninitialized_default_construct_n(ExecutionPolicy&& exec, // freestanding-deleted, NoThrowForwardIterator first, // see [algorithms.parallel.overloads] Size n); namespace ranges {template<nothrow-forward-iterator I, nothrow-sentinel-for S>requires default_initializable<iter_value_t>constexpr I uninitialized_default_construct(I first, S last); // freestandingtemplate<nothrow-forward-range R>requires default_initializable<range_value_t>constexpr borrowed_iterator_t uninitialized_default_construct(R&& r); // freestandingtemplate<nothrow-forward-iterator I>requires default_initializable<iter_value_t>constexpr I uninitialized_default_construct_n(I first, // freestanding iter_difference_t n); template<execution-policy Ep, nothrow-random-access-iterator I, nothrow-sized-sentinel-for S>requires default_initializable<iter_value_t> I uninitialized_default_construct(Ep&& exec, I first, S last); // freestanding-deleted,// see [algorithms.parallel.overloads]template<execution-policy Ep, nothrow-sized-random-access-range R>requires default_initializable<range_value_t> borrowed_iterator_t uninitialized_default_construct(Ep&& exec, // freestanding-deleted, R&& r); // see [algorithms.parallel.overloads]template<execution-policy Ep, nothrow-random-access-iterator I>requires default_initializable<iter_value_t> I uninitialized_default_construct_n(Ep&& exec, I first, // freestanding-deleted, iter_difference_t n); // see [algorithms.parallel.overloads]}templateconstexpr void uninitialized_value_construct(NoThrowForwardIterator first, // freestanding NoThrowForwardIterator last); template<class ExecutionPolicy, class NoThrowForwardIterator>void uninitialized_value_construct(ExecutionPolicy&& exec, // freestanding-deleted, NoThrowForwardIterator first, // see [algorithms.parallel.overloads] NoThrowForwardIterator last); template<class NoThrowForwardIterator, class Size>constexpr NoThrowForwardIterator uninitialized_value_construct_n(NoThrowForwardIterator first, Size n); // freestandingtemplate<class ExecutionPolicy, class NoThrowForwardIterator, class Size> NoThrowForwardIterator uninitialized_value_construct_n(ExecutionPolicy&& exec, // freestanding-deleted, NoThrowForwardIterator first, // see [algorithms.parallel.overloads] Size n); namespace ranges {template<nothrow-forward-iterator I, nothrow-sentinel-for S>requires default_initializable<iter_value_t>constexpr I uninitialized_value_construct(I first, S last); // freestandingtemplate<nothrow-forward-range R>requires default_initializable<range_value_t>constexpr borrowed_iterator_t uninitialized_value_construct(R&& r); // freestandingtemplate<nothrow-forward-iterator I>requires default_initializable<iter_value_t>constexpr I uninitialized_value_construct_n(I first, // freestanding iter_difference_t n); template<execution-policy Ep, nothrow-random-access-iterator I, nothrow-sized-sentinel-for S>requires default_initializable<iter_value_t> I uninitialized_value_construct(Ep&& exec, I first, S last); // freestanding-deleted,// see [algorithms.parallel.overloads]template<execution-policy Ep, nothrow-sized-random-access-range R>requires default_initializable<range_value_t> borrowed_iterator_t uninitialized_value_construct(Ep&& exec, // freestanding-deleted, R&& r); // see [algorithms.parallel.overloads]template<execution-policy Ep, nothrow-random-access-iterator I>requires default_initializable<iter_value_t> I uninitialized_value_construct_n(Ep&& exec, I first, // freestanding-deleted, iter_difference_t n); // see [algorithms.parallel.overloads]}template<class InputIterator, class NoThrowForwardIterator>constexpr NoThrowForwardIterator uninitialized_copy(InputIterator first, // freestanding InputIterator last, NoThrowForwardIterator result); template<class ExecutionPolicy, class ForwardIterator, class NoThrowForwardIterator> NoThrowForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // freestanding-deleted, ForwardIterator first, // see [algorithms.parallel.overloads] ForwardIterator last, NoThrowForwardIterator result); template<class InputIterator, class Size, class NoThrowForwardIterator>constexpr NoThrowForwardIterator uninitialized_copy_n(InputIterator first, // freestanding Size n, NoThrowForwardIterator result); template<class ExecutionPolicy, class ForwardIterator, class Size, class NoThrowForwardIterator> NoThrowForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // freestanding-deleted, ForwardIterator first, // see [algorithms.parallel.overloads] Size n, NoThrowForwardIterator result); namespace ranges {template<class I, class O>using uninitialized_copy_result = in_out_result<I, O>; // freestandingtemplate<input_iterator I, sentinel_for S1, nothrow-forward-iterator O, nothrow-sentinel-for S2>requires constructible_from<iter_value_t, iter_reference_t>constexpr uninitialized_copy_result<I, O> uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast); // freestandingtemplate<input_range IR, nothrow-forward-range OR>requires constructible_from<range_value_t, range_reference_t>constexpr uninitialized_copy_result<borrowed_iterator_t, borrowed_iterator_t> uninitialized_copy(IR&& in_range, OR&& out_range); // freestandingtemplate<class I, class O>using uninitialized_copy_n_result = in_out_result<I, O>; // freestandingtemplate<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for S>requires constructible_from<iter_value_t, iter_reference_t>constexpr uninitialized_copy_n_result<I, O> uninitialized_copy_n(I ifirst, iter_difference_t n, // freestanding O ofirst, S olast); template<execution-policy Ep, random_access_iterator I, sized_sentinel_for S1, nothrow-random-access-iterator O, nothrow-sized-sentinel-for S2>requires constructible_from<iter_value_t, iter_reference_t> uninitialized_copy_result<I, O> uninitialized_copy(Ep&& exec, I ifirst, S1 ilast, // freestanding-deleted, O ofirst, S2 olast); // see [algorithms.parallel.overloads]template<execution-policy Ep, sized-random-access-range IR, nothrow-sized-random-access-range OR>requires constructible_from<range_value_t, range_reference_t> uninitialized_copy_result<borrowed_iterator_t, borrowed_iterator_t> uninitialized_copy(Ep&& exec, IR&& in_range, OR&& out_range); // freestanding-deleted,// see [algorithms.parallel.overloads]template<execution-policy Ep, random_access_iterator I, nothrow-random-access-iterator O, nothrow-sized-sentinel-for S>requires constructible_from<iter_value_t, iter_reference_t> uninitialized_copy_n_result<I, O> uninitialized_copy_n(Ep&& exec, I ifirst, iter_difference_t n, // freestanding-deleted, O ofirst, S olast); // see [algorithms.parallel.overloads]}template<class InputIterator, class NoThrowForwardIterator>constexpr NoThrowForwardIterator uninitialized_move(InputIterator first, // freestanding InputIterator last, NoThrowForwardIterator result); template<class ExecutionPolicy, class ForwardIterator, class NoThrowForwardIterator> NoThrowForwardIterator uninitialized_move(ExecutionPolicy&& exec, // freestanding-deleted, ForwardIterator first, // see [algorithms.parallel.overloads] ForwardIterator last, NoThrowForwardIterator result); template<class InputIterator, class Size, class NoThrowForwardIterator>constexpr pair<InputIterator, NoThrowForwardIterator> uninitialized_move_n(InputIterator first, Size n, // freestanding NoThrowForwardIterator result); template<class ExecutionPolicy, class ForwardIterator, class Size, class NoThrowForwardIterator> pair<ForwardIterator, NoThrowForwardIterator> uninitialized_move_n(ExecutionPolicy&& exec, // freestanding-deleted, ForwardIterator first, Size n, // see [algorithms.parallel.overloads] NoThrowForwardIterator result); namespace ranges {template<class I, class O>using uninitialized_move_result = in_out_result<I, O>; // freestandingtemplate<input_iterator I, sentinel_for S1, nothrow-forward-iterator O, nothrow-sentinel-for S2>requires constructible_from<iter_value_t, iter_rvalue_reference_t>constexpr uninitialized_move_result<I, O> uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast); // freestandingtemplate<input_range IR, nothrow-forward-range OR>requires constructible_from<range_value_t, range_rvalue_reference_t>constexpr uninitialized_move_result<borrowed_iterator_t, borrowed_iterator_t> uninitialized_move(IR&& in_range, OR&& out_range); // freestandingtemplate<class I, class O>using uninitialized_move_n_result = in_out_result<I, O>; // freestandingtemplate<input_iterator I, nothrow-forward-iterator O, nothrow-sentinel-for S>requires constructible_from<iter_value_t, iter_rvalue_reference_t>constexpr uninitialized_move_n_result<I, O> uninitialized_move_n(I ifirst, iter_difference_t n, // freestanding O ofirst, S olast); template<execution-policy Ep, random_access_iterator I, sized_sentinel_for S1, nothrow-random-access-iterator O, nothrow-sized-sentinel-for S2>requires constructible_from<iter_value_t, iter_rvalue_reference_t> uninitialized_move_result<I, O> uninitialized_move(Ep&& exec, I ifirst, S1 ilast, // freestanding-deleted, O ofirst, S2 olast); // see [algorithms.parallel.overloads]template<execution-policy Ep, sized-random-access-range IR, nothrow-sized-random-access-range OR>requires constructible_from<range_value_t, range_rvalue_reference_t> uninitialized_move_result<borrowed_iterator_t, borrowed_iterator_t> uninitialized_move(Ep&& exec, IR&& in_range, OR&& out_range); // freestanding-deleted,// see [algorithms.parallel.overloads]template<execution-policy Ep, random_access_iterator I, nothrow-random-access-iterator O, nothrow-sized-sentinel-for S>requires constructible_from<iter_value_t, iter_rvalue_reference_t> uninitialized_move_n_result<I, O> uninitialized_move_n(Ep&& exec, I ifirst, iter_difference_t n, // freestanding-deleted, O ofirst, S olast); // see [algorithms.parallel.overloads]}template<class NoThrowForwardIterator, class T>constexpr void uninitialized_fill(NoThrowForwardIterator first, // freestanding NoThrowForwardIterator last, const T& x); template<class ExecutionPolicy, class NoThrowForwardIterator, class T>void uninitialized_fill(ExecutionPolicy&& exec, // freestanding-deleted, NoThrowForwardIterator first, // see [algorithms.parallel.overloads] NoThrowForwardIterator last, const T& x); template<class NoThrowForwardIterator, class Size, class T>constexpr NoThrowForwardIterator uninitialized_fill_n(NoThrowForwardIterator first, Size n, const T& x); // freestandingtemplate<class ExecutionPolicy, class NoThrowForwardIterator, class Size, class T> NoThrowForwardIterator uninitialized_fill_n(ExecutionPolicy&& exec, // freestanding-deleted, NoThrowForwardIterator first, // see [algorithms.parallel.overloads] Size n, const T& x); namespace ranges {template<nothrow-forward-iterator I, nothrow-sentinel-for S, class T>requires constructible_from<iter_value_t, const T&>constexpr I uninitialized_fill(I first, S last, const T& x); // freestandingtemplate<nothrow-forward-range R, class T>requires constructible_from<range_value_t, const T&>constexpr borrowed_iterator_t uninitialized_fill(R&& r, const T& x); // freestandingtemplate<nothrow-forward-iterator I, class T>requires constructible_from<iter_value_t, const T&>constexpr I uninitialized_fill_n(I first, // freestanding iter_difference_t n, const T& x); template<execution-policy Ep, nothrow-random-access-iterator I, nothrow-sized-sentinel-for S, class T>requires constructible_from<iter_value_t, const T&> I uninitialized_fill(Ep&& exec, I first, S last, const T& x); // freestanding-deleted,// see [algorithms.parallel.overloads]template<execution-policy Ep, nothrow-sized-random-access-range R, class T>requires constructible_from<range_value_t, const T&> borrowed_iterator_t uninitialized_fill(Ep&& exec, R&& r, // freestanding-deleted,const T& x); // see [algorithms.parallel.overloads]template<execution-policy Ep, nothrow-random-access-iterator I, class T>requires constructible_from<iter_value_t, const T&> I uninitialized_fill_n(Ep&& exec, I first, // freestanding-deleted, iter_difference_t n, const T& x); // see [algorithms.parallel.overloads]}// [specialized.construct], construct_attemplate<class T, class... Args>constexpr T* construct_at(T* location, Args&&... args); // freestandingnamespace ranges {template<class T, class... Args>constexpr T* construct_at(T* location, Args&&... args); // freestanding}// [specialized.destroy], destroytemplateconstexpr void destroy_at(T* location); // freestandingtemplateconstexpr void destroy(NoThrowForwardIterator first, // freestanding NoThrowForwardIterator last); template<class ExecutionPolicy, class NoThrowForwardIterator>void destroy(ExecutionPolicy&& exec, // freestanding-deleted, NoThrowForwardIterator first, // see [algorithms.parallel.overloads] NoThrowForwardIterator last); template<class NoThrowForwardIterator, class Size>constexpr NoThrowForwardIterator destroy_n(NoThrowForwardIterator first, // freestanding Size n); template<class ExecutionPolicy, class NoThrowForwardIterator, class Size> NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // freestanding-deleted, NoThrowForwardIterator first, Size n); // see [algorithms.parallel.overloads]namespace ranges {template<destructible T>constexpr void destroy_at(T* location) noexcept; // freestandingtemplate<nothrow-input-iterator I, nothrow-sentinel-for S>requires destructible<iter_value_t>constexpr I destroy(I first, S last) noexcept; // freestandingtemplate<nothrow-input-range R>requires destructible<range_value_t>constexpr borrowed_iterator_t destroy(R&& r) noexcept; // freestandingtemplate<nothrow-input-iterator I>requires destructible<iter_value_t>constexpr I destroy_n(I first, iter_difference_t n) noexcept; // freestandingtemplate<execution-policy Ep, nothrow-random-access-iterator I, nothrow-sized-sentinel-for S>requires destructible<iter_value_t> I destroy(Ep&& exec, I first, S last) noexcept; // freestanding-deleted,// see [algorithms.parallel.overloads]template<execution-policy Ep, nothrow-sized-random-access-range R>requires destructible<range_value_t> borrowed_iterator_t destroy(Ep&& exec, R&& r) noexcept; // freestanding-deleted,// see [algorithms.parallel.overloads]template<execution-policy Ep, nothrow-random-access-iterator I>requires destructible<iter_value_t> I destroy_n(Ep&& exec, I first, iter_difference_t n) noexcept; // freestanding-deleted,// see [algorithms.parallel.overloads]}// [unique.ptr], class template unique_ptrtemplate struct default_delete; // freestandingtemplate struct default_delete<T[]>; // freestandingtemplate<class T, class D = default_delete> class unique_ptr; // freestandingtemplate<class T, class D> class unique_ptr<T[], D>; // freestandingtemplate<class T, class... Args>constexpr unique_ptr make_unique(Args&&... args); // T is not arraytemplateconstexpr unique_ptr make_unique(size_t n); // T is U[]template<class T, class... Args>unspecified make_unique(Args&&...) = delete; // T is U[N]templateconstexpr unique_ptr make_unique_for_overwrite(); // T is not arraytemplateconstexpr unique_ptr make_unique_for_overwrite(size_t n); // T is U[]template<class T, class... Args>unspecified make_unique_for_overwrite(Args&&...) = delete; // T is U[N]template<class T, class D>constexpr void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept; // freestandingtemplate<class T1, class D1, class T2, class D2>constexpr bool operator==(const unique_ptr<T1, D1>& x, // freestandingconst unique_ptr<T2, D2>& y); template<class T1, class D1, class T2, class D2>constexpr bool operator<(const unique_ptr<T1, D1>& x, // freestandingconst unique_ptr<T2, D2>& y); template<class T1, class D1, class T2, class D2>constexpr bool operator>(const unique_ptr<T1, D1>& x, // freestandingconst unique_ptr<T2, D2>& y); template<class T1, class D1, class T2, class D2>constexpr bool operator<=(const unique_ptr<T1, D1>& x, // freestandingconst unique_ptr<T2, D2>& y); template<class T1, class D1, class T2, class D2>constexpr bool operator>=(const unique_ptr<T1, D1>& x, // freestandingconst unique_ptr<T2, D2>& y); template<class T1, class D1, class T2, class D2>requires three_way_comparable_with<typename unique_ptr<T1, D1>::pointer, typename unique_ptr<T2, D2>::pointer>constexpr compare_three_way_result_t<typename unique_ptr<T1, D1>::pointer, typename unique_ptr<T2, D2>::pointer>operator<=>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); // freestandingtemplate<class T, class D>constexpr bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept; // freestandingtemplate<class T, class D>constexpr bool operator<(const unique_ptr<T, D>& x, nullptr_t); // freestandingtemplate<class T, class D>constexpr bool operator<(nullptr_t, const unique_ptr<T, D>& y); // freestandingtemplate<class T, class D>constexpr bool operator>(const unique_ptr<T, D>& x, nullptr_t); // freestandingtemplate<class T, class D>constexpr bool operator>(nullptr_t, const unique_ptr<T, D>& y); // freestandingtemplate<class T, class D>constexpr bool operator<=(const unique_ptr<T, D>& x, nullptr_t); // freestandingtemplate<class T, class D>constexpr bool operator<=(nullptr_t, const unique_ptr<T, D>& y); // freestandingtemplate<class T, class D>constexpr bool operator>=(const unique_ptr<T, D>& x, nullptr_t); // freestandingtemplate<class T, class D>constexpr bool operator>=(nullptr_t, const unique_ptr<T, D>& y); // freestandingtemplate<class T, class D>requires three_way_comparable<typename unique_ptr<T, D>::pointer>constexpr compare_three_way_result_t<typename unique_ptr<T, D>::pointer>operator<=>(const unique_ptr<T, D>& x, nullptr_t); // freestandingtemplate<class E, class T, class Y, class D> basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const unique_ptr<Y, D>& p); // [util.smartptr.weak.bad], class bad_weak_ptrclass bad_weak_ptr; // [util.smartptr.shared], class template shared_ptrtemplate class shared_ptr; // [util.smartptr.shared.create], shared_ptr creationtemplate<class T, class... Args>constexpr shared_ptr make_shared(Args&&... args); // T is not arraytemplate<class T, class A, class... Args>constexpr shared_ptr allocate_shared(const A& a, Args&&... args); // T is not arraytemplateconstexpr shared_ptr make_shared(size_t N); // T is U[]template<class T, class A>constexpr shared_ptr allocate_shared(const A& a, size_t N); // T is U[]templateconstexpr shared_ptr make_shared(); // T is U[N]template<class T, class A>constexpr shared_ptr allocate_shared(const A& a); // T is U[N]templateconstexpr shared_ptr make_shared(size_t N, const remove_extent_t& u); // T is U[]template<class T, class A>constexpr shared_ptr allocate_shared(const A& a, size_t N, const remove_extent_t& u); // T is U[]templateconstexpr shared_ptr make_shared(const remove_extent_t& u); // T is U[N]template<class T, class A>constexpr shared_ptr allocate_shared(const A& a, // T is U[N]const remove_extent_t& u); templateconstexpr shared_ptr make_shared_for_overwrite(); // T is not U[]template<class T, class A>constexpr shared_ptr allocate_shared_for_overwrite(const A& a); // T is not U[]templateconstexpr shared_ptr make_shared_for_overwrite(size_t N); // T is U[]template<class T, class A>constexpr shared_ptr allocate_shared_for_overwrite(const A& a, size_t N); // T is U[]// [util.smartptr.shared.cmp], shared_ptr comparisonstemplate<class T, class U>constexpr bool operator==(const shared_ptr& a, const shared_ptr& b) noexcept; template<class T, class U>constexpr strong_ordering operator<=>(const shared_ptr& a, const shared_ptr& b) noexcept; templateconstexpr bool operator==(const shared_ptr& x, nullptr_t) noexcept; templateconstexpr strong_ordering operator<=>(const shared_ptr& x, nullptr_t) noexcept; // [util.smartptr.shared.spec], shared_ptr specialized algorithmstemplateconstexpr void swap(shared_ptr& a, shared_ptr& b) noexcept; // [util.smartptr.shared.cast], shared_ptr caststemplate<class T, class U>constexpr shared_ptr static_pointer_cast(const shared_ptr& r) noexcept; template<class T, class U>constexpr shared_ptr static_pointer_cast(shared_ptr&& r) noexcept; template<class T, class U>constexpr shared_ptr dynamic_pointer_cast(const shared_ptr& r) noexcept; template<class T, class U>constexpr shared_ptr dynamic_pointer_cast(shared_ptr&& r) noexcept; template<class T, class U>constexpr shared_ptr const_pointer_cast(const shared_ptr& r) noexcept; template<class T, class U>constexpr shared_ptr const_pointer_cast(shared_ptr&& r) noexcept; template<class T, class U> shared_ptr reinterpret_pointer_cast(const shared_ptr& r) noexcept; template<class T, class U> shared_ptr reinterpret_pointer_cast(shared_ptr&& r) noexcept; // [util.smartptr.getdeleter], shared_ptr get_deletertemplate<class D, class T>constexpr D* get_deleter(const shared_ptr& p) noexcept; // [util.smartptr.shared.io], shared_ptr I/Otemplate<class E, class T, class Y> basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const shared_ptr& p); // [util.smartptr.weak], class template weak_ptrtemplate class weak_ptr; // [util.smartptr.weak.spec], weak_ptr specialized algorithmstemplate constexpr void swap(weak_ptr& a, weak_ptr& b) noexcept; // [util.smartptr.ownerless], class template owner_lesstemplate struct owner_less; // [util.smartptr.owner.hash], struct owner_hashstruct owner_hash; // [util.smartptr.owner.equal], struct owner_equalstruct owner_equal; // [util.smartptr.enab], class template enable_shared_from_thistemplate class enable_shared_from_this; // [util.smartptr.hash], hash supporttemplate struct hash; // freestandingtemplate<class T, class D> struct hash<unique_ptr<T, D>>; // freestandingtemplate struct hash<shared_ptr>; // [util.smartptr.atomic], atomic smart pointerstemplate struct atomic; // freestandingtemplate struct atomic<shared_ptr>; template struct atomic<weak_ptr>; // [out.ptr.t], class template out_ptr_ttemplate<class Smart, class Pointer, class... Args>class out_ptr_t; // freestanding// [out.ptr], function template out_ptrtemplate<class Pointer = void, class Smart, class... Args>constexpr auto out_ptr(Smart& s, Args&&... args); // freestanding// [inout.ptr.t], class template inout_ptr_ttemplate<class Smart, class Pointer, class... Args>class inout_ptr_t; // freestanding// [inout.ptr], function template inout_ptrtemplate<class Pointer = void, class Smart, class... Args>constexpr auto inout_ptr(Smart& s, Args&&... args); // freestanding// [indirect], class template indirecttemplate<class T, class Allocator = allocator>class indirect; // [indirect.hash], hash supporttemplate<class T, class Alloc> struct hash<indirect<T, Alloc>>; // [polymorphic], class template polymorphictemplate<class T, class Allocator = allocator>class polymorphic; namespace pmr {template using indirect = indirect<T, polymorphic_allocator>; template using polymorphic = polymorphic<T, polymorphic_allocator>; }}