Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/header/memory"

From cppreference.com
< cpp‎ | header
(List the operator<< for unique_ptr)
m (~ remove redundant dsc allocator_arg_t)
 
(7 intermediate revisions by 5 users not shown)
Line 5: Line 5:
  
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc h1 | Includes}}
+
{{dsc h1|Includes}}
{{dsc inc | cpp/header/dsc compare}}
+
{{dsc inc|cpp/header/dsc compare}}
  
{{dsc h1 | Classes}}
+
{{dsc h1|Classes}}
{{dsc h2 | Pointer traits}}
+
{{dsc h2|Pointer traits}}
{{dsc inc | cpp/memory/dsc pointer_traits}}
+
{{dsc inc|cpp/memory/dsc pointer_traits}}
  
{{dsc h2 | Garbage collector support}}
+
{{dsc h2|Garbage collector support}}
{{dsc inc | cpp/memory/gc/dsc pointer_safety}}
+
{{dsc inc|cpp/memory/gc/dsc pointer_safety}}
  
{{dsc h2 | Allocators}}
+
{{dsc h2|Allocators}}
{{dsc inc | cpp/memory/dsc allocator}}
+
{{dsc inc|cpp/memory/dsc allocator}}
{{dsc inc | cpp/memory/dsc allocator_traits}}
+
{{dsc inc|cpp/memory/dsc allocator_traits}}
{{dsc inc | cpp/memory/dsc allocation_result}}
+
{{dsc inc|cpp/memory/dsc allocation_result}}
{{dsc inc | cpp/memory/dsc allocator_arg_t}}
+
{{dsc inc|cpp/memory/dsc uses_allocator}}
{{dsc inc | cpp/memory/dsc uses_allocator}}
+
  
{{dsc h2 | Uninitialized storage}}
+
{{dsc h2|Uninitialized storage}}
{{dsc inc | cpp/memory/dsc raw_storage_iterator}}
+
{{dsc inc|cpp/memory/dsc raw_storage_iterator}}
  
{{dsc h2 | Smart pointers}}
+
{{dsc h2|Smart pointers}}
{{dsc inc | cpp/memory/dsc unique_ptr}}
+
{{dsc inc|cpp/memory/dsc unique_ptr}}
{{dsc inc | cpp/memory/dsc shared_ptr}}
+
{{dsc inc|cpp/memory/dsc shared_ptr}}
{{dsc inc | cpp/memory/dsc weak_ptr}}
+
{{dsc inc|cpp/memory/dsc weak_ptr}}
{{dsc inc | cpp/memory/dsc auto_ptr}}
+
{{dsc inc|cpp/memory/dsc auto_ptr}}
  
{{dsc h2 | Helper classes}}
+
{{dsc h2|Helper classes}}
{{dsc inc | cpp/memory/shared_ptr/dsc atomic2}}
+
{{dsc inc|cpp/memory/shared_ptr/dsc atomic2}}
{{dsc inc | cpp/memory/weak_ptr/dsc atomic2}}
+
{{dsc inc|cpp/memory/weak_ptr/dsc atomic2}}
{{dsc inc | cpp/memory/dsc owner_less}}
+
{{dsc inc|cpp/memory/dsc owner_less}}
{{dsc inc | cpp/memory/dsc enable_shared_from_this}}
+
{{dsc inc|cpp/memory/dsc owner_hash}}
{{dsc inc | cpp/memory/dsc bad_weak_ptr}}
+
{{dsc inc|cpp/memory/dsc owner_equal}}
{{dsc inc | cpp/memory/dsc default_delete}}
+
{{dsc inc|cpp/memory/dsc enable_shared_from_this}}
{{dsc inc | cpp/memory/unique_ptr/dsc hash}}
+
{{dsc inc|cpp/memory/dsc bad_weak_ptr}}
{{dsc inc | cpp/memory/shared_ptr/dsc hash}}
+
{{dsc inc|cpp/memory/dsc default_delete}}
 +
{{dsc inc|cpp/memory/unique_ptr/dsc hash}}
 +
{{dsc inc|cpp/memory/shared_ptr/dsc hash}}
  
{{dsc h2 | Smart pointer adaptors}}
+
{{dsc h2|Smart pointer adaptors}}
{{dsc inc | cpp/memory/dsc out_ptr_t}}
+
{{dsc inc|cpp/memory/dsc out_ptr_t}}
{{dsc inc | cpp/memory/dsc inout_ptr_t}}
+
{{dsc inc|cpp/memory/dsc inout_ptr_t}}
  
{{dsc h2 | Forward declarations}}
+
{{dsc h2|Forward declarations}}
{{dsc header | functional}}
+
{{dsc header|functional}}
{{dsc inc | cpp/utility/dsc hash}}
+
{{dsc inc|cpp/utility/dsc hash}}
{{dsc header | atomic}}
+
{{dsc header|atomic}}
{{dsc inc | cpp/atomic/dsc atomic}}
+
{{dsc inc|cpp/atomic/dsc atomic}}
  
{{dsc h1 | Constants}}
+
{{dsc h1|Tags}}
{{dsc inc | cpp/memory/dsc allocator_arg}}
+
{{dsc inc|cpp/memory/dsc allocator_arg}}
  
{{dsc h1 | Functions}}
+
{{dsc h1|Functions}}
{{dsc h2 | Miscellaneous}}
+
{{dsc h2|Uses-allocator construction}}
{{dsc inc | cpp/memory/dsc to_address}}
+
{{dsc inc|cpp/memory/dsc uses_allocator_construction_args}}
{{dsc inc | cpp/memory/dsc addressof}}
+
{{dsc inc|cpp/memory/dsc make_obj_using_allocator}}
{{dsc inc | cpp/memory/dsc align}}
+
{{dsc inc|cpp/memory/dsc uninitialized_construct_using_allocator}}
{{dsc inc | cpp/memory/dsc assume_aligned}}
+
  
{{dsc h2 | Garbage collector support}}
+
{{dsc h2|Miscellaneous}}
{{dsc inc | cpp/memory/gc/dsc declare_reachable}}
+
{{dsc inc|cpp/memory/dsc to_address}}
{{dsc inc | cpp/memory/gc/dsc undeclare_reachable}}
+
{{dsc inc|cpp/memory/dsc addressof}}
{{dsc inc | cpp/memory/gc/dsc declare_no_pointers}}
+
{{dsc inc|cpp/memory/dsc align}}
{{dsc inc | cpp/memory/gc/dsc undeclare_no_pointers}}
+
{{dsc inc|cpp/memory/dsc assume_aligned}}
{{dsc inc | cpp/memory/gc/dsc get_pointer_safety}}
+
  
{{dsc h2 | Uninitialized storage}}
+
{{dsc h2|Explicit lifetime management}}
{{dsc inc | cpp/memory/dsc uninitialized_copy}}
+
{{dsc inc|cpp/memory/dsc start_lifetime_as}}
{{dsc inc | cpp/memory/dsc uninitialized_copy_n}}
+
{{dsc inc | cpp/memory/dsc uninitialized_fill}}
+
{{dsc inc | cpp/memory/dsc uninitialized_fill_n}}
+
{{dsc inc | cpp/memory/dsc uninitialized_move}}
+
{{dsc inc | cpp/memory/dsc uninitialized_move_n}}
+
{{dsc inc | cpp/memory/dsc uninitialized_default_construct}}
+
{{dsc inc | cpp/memory/dsc uninitialized_default_construct_n}}
+
{{dsc inc | cpp/memory/dsc uninitialized_value_construct}}
+
{{dsc inc | cpp/memory/dsc uninitialized_value_construct_n}}
+
{{dsc inc | cpp/memory/dsc construct_at}}
+
{{dsc inc | cpp/memory/dsc destroy_at}}
+
{{dsc inc | cpp/memory/dsc destroy}}
+
{{dsc inc | cpp/memory/dsc destroy_n}}
+
{{dsc inc | cpp/memory/dsc get_temporary_buffer}}
+
{{dsc inc | cpp/memory/dsc return_temporary_buffer}}
+
  
{{dsc h2 | Smart pointer non-member operations}}
 
{{dsc inc | cpp/memory/unique_ptr/dsc make_unique}}
 
{{dsc inc | cpp/memory/unique_ptr/dsc operator_cmp}}
 
{{dsc inc | cpp/memory/shared_ptr/dsc make_shared}}
 
{{dsc inc | cpp/memory/shared_ptr/dsc allocate_shared}}
 
{{dsc inc | cpp/memory/shared_ptr/dsc pointer_cast}}
 
{{dsc inc | cpp/memory/shared_ptr/dsc get_deleter}}
 
{{dsc inc | cpp/memory/shared_ptr/dsc operator_cmp}}
 
{{dsc inc | cpp/memory/shared_ptr/dsc operator_ltlt}}
 
{{dsc inc | cpp/memory/unique_ptr/dsc operator_ltlt}}
 
{{dsc inc | cpp/memory/unique_ptr/dsc swap2}}
 
{{dsc inc | cpp/memory/shared_ptr/dsc swap2}}
 
{{dsc inc | cpp/memory/weak_ptr/dsc swap2}}
 
  
{{dsc h2 | Smart pointer adaptor creation}}
+
{{dsc h2|Garbage collector support}}
{{dsc inc | cpp/memory/out_ptr_t/dsc out_ptr}}
+
{{dsc inc|cpp/memory/gc/dsc declare_reachable}}
{{dsc inc | cpp/memory/inout_ptr_t/dsc inout_ptr}}
+
{{dsc inc|cpp/memory/gc/dsc undeclare_reachable}}
 +
{{dsc inc|cpp/memory/gc/dsc declare_no_pointers}}
 +
{{dsc inc|cpp/memory/gc/dsc undeclare_no_pointers}}
 +
{{dsc inc|cpp/memory/gc/dsc get_pointer_safety}}
 +
 
 +
{{dsc h2|Uninitialized storage}}
 +
{{dsc inc|cpp/memory/dsc uninitialized_copy}}
 +
{{dsc inc|cpp/memory/dsc uninitialized_copy_n}}
 +
{{dsc inc|cpp/memory/dsc uninitialized_fill}}
 +
{{dsc inc|cpp/memory/dsc uninitialized_fill_n}}
 +
{{dsc inc|cpp/memory/dsc uninitialized_move}}
 +
{{dsc inc|cpp/memory/dsc uninitialized_move_n}}
 +
{{dsc inc|cpp/memory/dsc uninitialized_default_construct}}
 +
{{dsc inc|cpp/memory/dsc uninitialized_default_construct_n}}
 +
{{dsc inc|cpp/memory/dsc uninitialized_value_construct}}
 +
{{dsc inc|cpp/memory/dsc uninitialized_value_construct_n}}
 +
{{dsc inc|cpp/memory/dsc construct_at}}
 +
{{dsc inc|cpp/memory/dsc destroy_at}}
 +
{{dsc inc|cpp/memory/dsc destroy}}
 +
{{dsc inc|cpp/memory/dsc destroy_n}}
 +
{{dsc inc|cpp/memory/dsc get_temporary_buffer}}
 +
{{dsc inc|cpp/memory/dsc return_temporary_buffer}}
 +
 
 +
{{dsc h2|Smart pointer non-member operations}}
 +
{{dsc inc|cpp/memory/unique_ptr/dsc make_unique}}
 +
{{dsc inc|cpp/memory/unique_ptr/dsc operator_cmp}}
 +
{{dsc inc|cpp/memory/shared_ptr/dsc make_shared}}
 +
{{dsc inc|cpp/memory/shared_ptr/dsc allocate_shared}}
 +
{{dsc inc|cpp/memory/shared_ptr/dsc pointer_cast}}
 +
{{dsc inc|cpp/memory/shared_ptr/dsc get_deleter}}
 +
{{dsc inc|cpp/memory/shared_ptr/dsc operator_cmp}}
 +
{{dsc inc|cpp/memory/shared_ptr/dsc operator_ltlt}}
 +
{{dsc inc|cpp/memory/unique_ptr/dsc operator_ltlt}}
 +
{{dsc inc|cpp/memory/unique_ptr/dsc swap2}}
 +
{{dsc inc|cpp/memory/shared_ptr/dsc swap2}}
 +
{{dsc inc|cpp/memory/weak_ptr/dsc swap2}}
 +
 
 +
{{dsc h2|Smart pointer adaptor creation}}
 +
{{dsc inc|cpp/memory/out_ptr_t/dsc out_ptr}}
 +
{{dsc inc|cpp/memory/inout_ptr_t/dsc inout_ptr}}
  
 
{{dsc break}}
 
{{dsc break}}
{{dsc inc | cpp/memory/shared_ptr/dsc atomic}}
+
{{dsc inc|cpp/memory/shared_ptr/dsc atomic}}
 
{{dsc break}}
 
{{dsc break}}
  
{{dsc h1 | Function-like entities}}
+
{{dsc h1|Function-like entities}}
{{dsc namespace | std::ranges}}
+
{{dsc namespace|std::ranges}}
{{dsc h2 | Uninitialized storage}}
+
{{dsc h2|Uninitialized storage}}
{{dsc inc | cpp/memory/ranges/dsc uninitialized_copy}}
+
{{dsc inc|cpp/memory/ranges/dsc uninitialized_copy}}
{{dsc inc | cpp/memory/ranges/dsc uninitialized_copy_n}}
+
{{dsc inc|cpp/memory/ranges/dsc uninitialized_copy_n}}
{{dsc inc | cpp/memory/ranges/dsc uninitialized_fill}}
+
{{dsc inc|cpp/memory/ranges/dsc uninitialized_fill}}
{{dsc inc | cpp/memory/ranges/dsc uninitialized_fill_n}}
+
{{dsc inc|cpp/memory/ranges/dsc uninitialized_fill_n}}
{{dsc inc | cpp/memory/ranges/dsc uninitialized_move}}
+
{{dsc inc|cpp/memory/ranges/dsc uninitialized_move}}
{{dsc inc | cpp/memory/ranges/dsc uninitialized_move_n}}
+
{{dsc inc|cpp/memory/ranges/dsc uninitialized_move_n}}
{{dsc inc | cpp/memory/ranges/dsc uninitialized_default_construct}}
+
{{dsc inc|cpp/memory/ranges/dsc uninitialized_default_construct}}
{{dsc inc | cpp/memory/ranges/dsc uninitialized_default_construct_n}}
+
{{dsc inc|cpp/memory/ranges/dsc uninitialized_default_construct_n}}
{{dsc inc | cpp/memory/ranges/dsc uninitialized_value_construct}}
+
{{dsc inc|cpp/memory/ranges/dsc uninitialized_value_construct}}
{{dsc inc | cpp/memory/ranges/dsc uninitialized_value_construct_n}}
+
{{dsc inc|cpp/memory/ranges/dsc uninitialized_value_construct_n}}
{{dsc inc | cpp/memory/ranges/dsc construct_at}}
+
{{dsc inc|cpp/memory/ranges/dsc construct_at}}
{{dsc inc | cpp/memory/ranges/dsc destroy_at}}
+
{{dsc inc|cpp/memory/ranges/dsc destroy_at}}
{{dsc inc | cpp/memory/ranges/dsc destroy}}
+
{{dsc inc|cpp/memory/ranges/dsc destroy}}
{{dsc inc | cpp/memory/ranges/dsc destroy_n}}
+
{{dsc inc|cpp/memory/ranges/dsc destroy_n}}
 
{{dsc end}}
 
{{dsc end}}
  
 
===Synopsis===
 
===Synopsis===
{{source|1=
+
{{cpp/synopsis/memory}}
#include <compare>
+
 
+
namespace std {
+
  // pointer traits
+
  template<class Ptr> struct pointer_traits;
+
  template<class T> struct pointer_traits<T*>;
+
 
+
  // pointer conversion
+
  template<class T>
+
    constexpr T* to_address(T* p) noexcept;
+
  template<class Ptr>
+
    constexpr auto to_address(const Ptr& p) noexcept;
+
 
+
  // pointer alignment
+
  void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
+
  template<size_t N, class T>
+
    [[nodiscard]] constexpr T* assume_aligned(T* ptr);
+
 
+
  // allocator argument tag
+
  struct allocator_arg_t { explicit allocator_arg_t() = default; };
+
  inline constexpr allocator_arg_t allocator_arg{};
+
 
+
  // uses_allocator
+
  template<class T, class Alloc> struct uses_allocator;
+
 
+
  // uses_allocator
+
  template<class T, class Alloc>
+
    inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;
+
 
+
  // uses-allocator construction
+
  template<class T, class Alloc, class... Args>
+
    constexpr auto uses_allocator_construction_args(const Alloc& alloc,
+
                                                    Args&&... args) noexcept;
+
  template<class T, class Alloc, class Tuple1, class Tuple2>
+
    constexpr auto uses_allocator_construction_args(const Alloc& alloc, piecewise_construct_t,
+
                                                    Tuple1&& x, Tuple2&& y) noexcept;
+
  template<class T, class Alloc>
+
    constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept;
+
  template<class T, class Alloc, class U, class V>
+
    constexpr auto uses_allocator_construction_args(const Alloc& alloc,
+
                                                    U&& u, V&& v) noexcept;
+
  template<class T, class Alloc, class U, class V>
+
    constexpr auto uses_allocator_construction_args(const Alloc& alloc,
+
                                                    const pair<U, V>& pr) noexcept;
+
  template<class T, class Alloc, class U, class V>
+
    constexpr auto uses_allocator_construction_args(const Alloc& alloc,
+
                                                    pair<U, V>&& pr) noexcept;
+
  template<class T, class Alloc, class... Args>
+
    constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args);
+
  template<class T, class Alloc, class... Args>
+
    constexpr T* uninitialized_construct_using_allocator(T* p, const Alloc& alloc,
+
                                                        Args&&... args);
+
 
+
  // allocator traits
+
  template<class Alloc> struct allocator_traits;
+
 
+
  template<class Pointer>
+
  struct allocation_result {
+
    Pointer ptr;
+
    size_t count;
+
  };
+
 
+
  // the default allocator
+
  template<class T> class allocator;
+
  template<class T, class U>
+
    constexpr bool operator==(const allocator<T>&, const allocator<U>&) noexcept;
+
 
+
  // addressof
+
  template<class T>
+
    constexpr T* addressof(T& r) noexcept;
+
  template<class T>
+
    const T* addressof(const T&&) = delete;
+
 
+
  // specialized algorithms
+
  // special memory concepts
+
  template<class I>
+
    concept no-throw-input-iterator = /* see description */;    // exposition only
+
  template<class I>
+
    concept no-throw-forward-iterator = /* see description */;  // exposition only
+
  template<class S, class I>
+
    concept no-throw-sentinel-for = /* see description */;      // exposition only
+
  template<class R>
+
    concept no-throw-input-range = /* see description */;      // exposition only
+
  template<class R>
+
    concept no-throw-forward-range = /* see description */;    // exposition only
+
 
+
  template<class NoThrowForwardIt>
+
    void uninitialized_default_construct(NoThrowForwardIt first,
+
                                        NoThrowForwardIt last);
+
  template<class ExecutionPolicy, class NoThrowForwardIt>
+
    void uninitialized_default_construct(ExecutionPolicy&& exec,
+
                                        NoThrowForwardIt first,
+
                                        NoThrowForwardIt last);
+
  template<class NoThrowForwardIt, class Size>
+
    NoThrowForwardIt
+
      uninitialized_default_construct_n(NoThrowForwardIt first, Size n);
+
  template<class ExecutionPolicy, class NoThrowForwardIt, class Size>
+
    NoThrowForwardIt
+
      uninitialized_default_construct_n(ExecutionPolicy&& exec,
+
                                        NoThrowForwardIt first, Size n);
+
 
+
  namespace ranges {
+
    template<no-throw-forward-iterator I, no-throw-sentinel-for<I> S>
+
      requires default_initializable<iter_value_t<I>>
+
        I uninitialized_default_construct(I first, S last);
+
    template<no-throw-forward-range R>
+
      requires default_initializable<range_value_t<R>>
+
        borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
+
 
+
    template<no-throw-forward-iterator I>
+
      requires default_initializable<iter_value_t<I>>
+
        I uninitialized_default_construct_n(I first, iter_difference_t<I> n);
+
  }
+
 
+
  template<class NoThrowForwardIterator>
+
    void uninitialized_value_construct(NoThrowForwardIterator first,
+
                                      NoThrowForwardIterator last);
+
  template<class ExecutionPolicy, class NoThrowForwardIt>
+
    void uninitialized_value_construct(ExecutionPolicy&& exec,
+
                                      NoThrowForwardIt first,
+
                                      NoThrowForwardIt last);
+
  template<class NoThrowForwardIt, class Size>
+
    NoThrowForwardIt
+
      uninitialized_value_construct_n(NoThrowForwardIt first, Size n);
+
  template<class ExecutionPolicy, class NoThrowForwardIt, class Size>
+
    NoThrowForwardIt
+
      uninitialized_value_construct_n(ExecutionPolicy&& exec,
+
                                      NoThrowForwardIt first, Size n);
+
 
+
  namespace ranges {
+
    template<no-throw-forward-iterator I, no-throw-sentinel-for<I> S>
+
      requires default_initializable<iter_value_t<I>>
+
        I uninitialized_value_construct(I first, S last);
+
    template<no-throw-forward-range R>
+
      requires default_initializable<range_value_t<R>>
+
        borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
+
 
+
    template<no-throw-forward-iterator I>
+
      requires default_initializable<iter_value_t<I>>
+
        I uninitialized_value_construct_n(I first, iter_difference_t<I> n);
+
  }
+
 
+
  template<class InputIt, class NoThrowForwardIt>
+
    NoThrowForwardIt uninitialized_copy(InputIt first, InputIt last,
+
                                        NoThrowForwardIt result);
+
  template<class ExecutionPolicy, class ForwardIt, class NoThrowForwardIt>
+
    NoThrowForwardIt uninitialized_copy(ExecutionPolicy&& exec,
+
                                        ForwardIt first, ForwardIt last,
+
                                        NoThrowForwardIt result);
+
  template<class InputIt, class Size, class NoThrowForwardIt>
+
    NoThrowForwardIt uninitialized_copy_n(InputIt first, Size n,
+
                                          NoThrowForwardIt result);
+
  template<class ExecutionPolicy, class ForwardIt, class Size,
+
          class NoThrowForwardIt>
+
    NoThrowForwardIt uninitialized_copy_n(ExecutionPolicy&& exec,
+
                                          ForwardIt first, Size n,
+
                                          NoThrowForwardIt result);
+
 
+
  namespace ranges {
+
    template<class I, class O>
+
      using uninitialized_copy_result = in_out_result<I, O>;
+
    template<input_iterator I, sentinel_for<I> S1,
+
            no-throw-forward-iterator O, no-throw-sentinel-for<O> S2>
+
      requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
+
        uninitialized_copy_result<I, O>
+
          uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast);
+
    template<input_range IR, no-throw-forward-range OR>
+
      requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
+
        uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
+
          uninitialized_copy(IR&& in_range, OR&& out_range);
+
 
+
    template<class I, class O>
+
      using uninitialized_copy_n_result = in_out_result<I, O>;
+
    template<input_iterator I, no-throw-forward-iterator O, no-throw-sentinel-for<O> S>
+
      requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
+
        uninitialized_copy_n_result<I, O>
+
          uninitialized_copy_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
+
  }
+
 
+
  template<class InputIt, class NoThrowForwardIt>
+
    NoThrowForwardIt uninitialized_move(InputIt first, InputIt last,
+
                                        NoThrowForwardIt result);
+
  template<class ExecutionPolicy, class ForwardIt, class NoThrowForwardIt>
+
    NoThrowForwardIt uninitialized_move(ExecutionPolicy&& exec,
+
                                        ForwardIt first, ForwardIt last,
+
                                        NoThrowForwardIt result);
+
  template<class InputIt, class Size, class NoThrowForwardIt>
+
    pair<InputIt, NoThrowForwardIt>
+
      uninitialized_move_n(InputIt first, Size n, NoThrowForwardIt result);
+
  template<class ExecutionPolicy, class ForwardIt, class Size,
+
          class NoThrowForwardIt>
+
    pair<ForwardIt, NoThrowForwardIt>
+
      uninitialized_move_n(ExecutionPolicy&& exec,
+
                          ForwardIt first, Size n, NoThrowForwardIt result);
+
 
+
  namespace ranges {
+
    template<class I, class O>
+
      using uninitialized_move_result = in_out_result<I, O>;
+
    template<input_iterator I, sentinel_for<I> S1,
+
            no-throw-forward-iterator O, no-throw-sentinel-for<O> S2>
+
      requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
+
        uninitialized_move_result<I, O>
+
          uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast);
+
    template<input_range IR, no-throw-forward-range OR>
+
      requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
+
        uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
+
          uninitialized_move(IR&& in_range, OR&& out_range);
+
 
+
    template<class I, class O>
+
      using uninitialized_move_n_result = in_out_result<I, O>;
+
    template<input_iterator I,
+
            no-throw-forward-iterator O, no-throw-sentinel-for<O> S>
+
      requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
+
        uninitialized_move_n_result<I, O>
+
          uninitialized_move_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
+
  }
+
 
+
  template<class NoThrowForwardIt, class T>
+
    void uninitialized_fill(NoThrowForwardIt first, NoThrowForwardIt last,
+
                            const T& x);
+
  template<class ExecutionPolicy, class NoThrowForwardIt, class T>
+
    void uninitialized_fill(ExecutionPolicy&& exec,
+
                            NoThrowForwardIt first, NoThrowForwardIt last,
+
                            const T& x);
+
  template<class NoThrowForwardIt, class Size, class T>
+
    NoThrowForwardIt
+
      uninitialized_fill_n(NoThrowForwardIt first, Size n, const T& x);
+
  template<class ExecutionPolicy, class NoThrowForwardIt, class Size, class T>
+
    NoThrowForwardIt
+
      uninitialized_fill_n(ExecutionPolicy&& exec,
+
                          NoThrowForwardIt first, Size n, const T& x);
+
 
+
  namespace ranges {
+
    template<no-throw-forward-iterator I, no-throw-sentinel-for<I> S, class T>
+
      requires constructible_from<iter_value_t<I>, const T&>
+
        I uninitialized_fill(I first, S last, const T& x);
+
    template<no-throw-forward-range R, class T>
+
      requires constructible_from<range_value_t<R>, const T&>
+
        borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
+
 
+
    template<no-throw-forward-iterator I, class T>
+
      requires constructible_from<iter_value_t<I>, const T&>
+
        I uninitialized_fill_n(I first, iter_difference_t<I> n, const T& x);
+
  }
+
 
+
  // construct_at
+
  template<class T, class... Args>
+
    constexpr T* construct_at(T* location, Args&&... args);
+
 
+
  namespace ranges {
+
    template<class T, class... Args>
+
      constexpr T* construct_at(T* location, Args&&... args);
+
  }
+
 
+
  // destroy
+
  template<class T>
+
    constexpr void destroy_at(T* location);
+
  template<class NoThrowForwardIt>
+
    constexpr void destroy(NoThrowForwardIt first, NoThrowForwardIt last);
+
  template<class ExecutionPolicy, class NoThrowForwardIt>
+
    void destroy(ExecutionPolicy&& exec,
+
                NoThrowForwardIt first, NoThrowForwardIt last);
+
  template<class NoThrowForwardIt, class Size>
+
    constexpr NoThrowForwardIt destroy_n(NoThrowForwardIt first, Size n);
+
  template<class ExecutionPolicy, class NoThrowForwardIt, class Size>
+
    NoThrowForwardIt destroy_n(ExecutionPolicy&& exec,
+
                              NoThrowForwardIt first, Size n);
+
 
+
  namespace ranges {
+
    template<destructible T>
+
      constexpr void destroy_at(T* location) noexcept;
+
 
+
    template<no-throw-input-iterator I, no-throw-sentinel-for<I> S>
+
      requires destructible<iter_value_t<I>>
+
        constexpr I destroy(I first, S last) noexcept;
+
    template<no-throw-input-range R>
+
      requires destructible<range_value_t<R>>
+
        constexpr borrowed_iterator_t<R> destroy(R&& r) noexcept;
+
 
+
    template<no-throw-input-iterator I>
+
      requires destructible<iter_value_t<I>>
+
        constexpr I destroy_n(I first, iter_difference_t<I> n) noexcept;
+
  }
+
 
+
  // class template unique_ptr
+
  template<class T> struct default_delete;
+
  template<class T> struct default_delete<T[]>;
+
  template<class T, class D = default_delete<T>> class unique_ptr;
+
  template<class T, class D> class unique_ptr<T[], D>;
+
 
+
  template<class T, class... Args>
+
    unique_ptr<T> make_unique(Args&&... args);                                  // T is not array
+
  template<class T>
+
    unique_ptr<T> make_unique(size_t n);                                        // T is U[]
+
  template<class T, class... Args>
+
    /* unspecified */ make_unique(Args&&...) = delete;                          // T is U[N]
+
 
+
  template<class T>
+
    unique_ptr<T> make_unique_for_overwrite();                                  // T is not array
+
  template<class T>
+
    unique_ptr<T> 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>
+
    void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept;
+
 
+
  template<class T1, class D1, class T2, class D2>
+
    bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+
  template<class T1, class D1, class T2, class D2>
+
    bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+
  template<class T1, class D1, class T2, class D2>
+
    bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+
  template<class T1, class D1, class T2, class D2>
+
    bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
+
  template<class T1, class D1, class T2, class D2>
+
    bool operator>=(const unique_ptr<T1, D1>& x, const 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>
+
    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);
+
 
+
  template<class T, class D>
+
    bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept;
+
  template<class T, class D>
+
    bool operator<(const unique_ptr<T, D>& x, nullptr_t);
+
  template<class T, class D>
+
    bool operator<(nullptr_t, const unique_ptr<T, D>& y);
+
  template<class T, class D>
+
    bool operator>(const unique_ptr<T, D>& x, nullptr_t);
+
  template<class T, class D>
+
    bool operator>(nullptr_t, const unique_ptr<T, D>& y);
+
  template<class T, class D>
+
    bool operator<=(const unique_ptr<T, D>& x, nullptr_t);
+
  template<class T, class D>
+
    bool operator<=(nullptr_t, const unique_ptr<T, D>& y);
+
  template<class T, class D>
+
    bool operator>=(const unique_ptr<T, D>& x, nullptr_t);
+
  template<class T, class D>
+
    bool operator>=(nullptr_t, const unique_ptr<T, D>& y);
+
  template<class T, class D>
+
    requires three_way_comparable<typename unique_ptr<T, D>::pointer>
+
    compare_three_way_result_t<typename unique_ptr<T, D>::pointer>
+
      operator<=>(const unique_ptr<T, D>& x, nullptr_t);
+
 
+
  template<class E, class T, class Y, class D>
+
    basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const unique_ptr<Y, D>& p);
+
 
+
  // class bad_weak_ptr
+
  class bad_weak_ptr;
+
 
+
  // class template shared_ptr
+
  template<class T> class shared_ptr;
+
 
+
  // shared_ptr creation
+
  template<class T, class... Args>
+
    shared_ptr<T> make_shared(Args&&... args);                                  // T is not array
+
  template<class T, class A, class... Args>
+
    shared_ptr<T> allocate_shared(const A& a, Args&&... args);                  // T is not array
+
 
+
  template<class T>
+
    shared_ptr<T> make_shared(size_t N);                                        // T is U[]
+
  template<class T, class A>
+
    shared_ptr<T> allocate_shared(const A& a, size_t N);                        // T is U[]
+
 
+
  template<class T>
+
    shared_ptr<T> make_shared();                                                // T is U[N]
+
  template<class T, class A>
+
    shared_ptr<T> allocate_shared(const A& a);                                  // T is U[N]
+
 
+
  template<class T>
+
    shared_ptr<T> make_shared(size_t N, const remove_extent_t<T>& u);          // T is U[]
+
  template<class T, class A>
+
    shared_ptr<T> allocate_shared(const A& a, size_t N,
+
                                  const remove_extent_t<T>& u);                // T is U[]
+
 
+
  template<class T>
+
    shared_ptr<T> make_shared(const remove_extent_t<T>& u);                    // T is U[N]
+
  template<class T, class A>
+
    shared_ptr<T> allocate_shared(const A& a, const remove_extent_t<T>& u);    // T is U[N]
+
 
+
  template<class T>
+
    shared_ptr<T> make_shared_for_overwrite();                                  // T is not U[]
+
  template<class T, class A>
+
    shared_ptr<T> allocate_shared_for_overwrite(const A& a);                    // T is not U[]
+
 
+
  template<class T>
+
    shared_ptr<T> make_shared_for_overwrite(size_t N);                          // T is U[]
+
  template<class T, class A>
+
    shared_ptr<T> allocate_shared_for_overwrite(const A& a, size_t N);          // T is U[]
+
 
+
  // shared_ptr comparisons
+
  template<class T, class U>
+
    bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
+
  template<class T, class U>
+
    strong_ordering operator<=>(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
+
 
+
  template<class T>
+
    bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept;
+
  template<class T>
+
    strong_ordering operator<=>(const shared_ptr<T>& x, nullptr_t) noexcept;
+
 
+
  // shared_ptr specialized algorithms
+
  template<class T>
+
    void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept;
+
 
+
  // shared_ptr casts
+
  template<class T, class U>
+
    shared_ptr<T> static_pointer_cast(const shared_ptr<U>& r) noexcept;
+
  template<class T, class U>
+
    shared_ptr<T> static_pointer_cast(shared_ptr<U>&& r) noexcept;
+
  template<class T, class U>
+
    shared_ptr<T> dynamic_pointer_cast(const shared_ptr<U>& r) noexcept;
+
  template<class T, class U>
+
    shared_ptr<T> dynamic_pointer_cast(shared_ptr<U>&& r) noexcept;
+
  template<class T, class U>
+
    shared_ptr<T> const_pointer_cast(const shared_ptr<U>& r) noexcept;
+
  template<class T, class U>
+
    shared_ptr<T> const_pointer_cast(shared_ptr<U>&& r) noexcept;
+
  template<class T, class U>
+
    shared_ptr<T> reinterpret_pointer_cast(const shared_ptr<U>& r) noexcept;
+
  template<class T, class U>
+
    shared_ptr<T> reinterpret_pointer_cast(shared_ptr<U>&& r) noexcept;
+
 
+
  // shared_ptr get_deleter
+
  template<class D, class T>
+
    D* get_deleter(const shared_ptr<T>& p) noexcept;
+
 
+
  // shared_ptr I/O
+
  template<class E, class T, class Y>
+
    basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const shared_ptr<Y>& p);
+
 
+
  // class template weak_ptr
+
  template<class T> class weak_ptr;
+
 
+
  // weak_ptr specialized algorithms
+
  template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;
+
 
+
  // class template owner_less
+
  template<class T = void> struct owner_less;
+
 
+
  // class template enable_shared_from_this
+
  template<class T> class enable_shared_from_this;
+
 
+
  // hash support
+
  template<class T> struct hash;
+
  template<class T, class D> struct hash<unique_ptr<T, D>>;
+
  template<class T> struct hash<shared_ptr<T>>;
+
 
+
  // atomic smart pointers
+
  template<class T> struct atomic;
+
  template<class T> struct atomic<shared_ptr<T>>;
+
  template<class T> struct atomic<weak_ptr<T>>;
+
 
+
  // class template out_ptr_t
+
  template<class Smart, class Pointer, class... Args>
+
    class out_ptr_t;
+
 
+
  // function template out_ptr
+
  template<class Pointer = void, class Smart, class... Args>
+
    auto out_ptr(Smart& s, Args&&... args);
+
 
+
  // class template inout_ptr_t
+
  template<class Smart, class Pointer, class... Args>
+
    class inout_ptr_t;
+
 
+
  // function template inout_ptr
+
  template<class Pointer = void, class Smart, class... Args>
+
    auto inout_ptr(Smart& s, Args&&... args);
+
}
+
 
+
// deprecated
+
namespace std {
+
  template<class T>
+
    bool atomic_is_lock_free(const shared_ptr<T>* p);
+
 
+
  template<class T>
+
    shared_ptr<T> atomic_load(const shared_ptr<T>* p);
+
  template<class T>
+
    shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo);
+
 
+
  template<class T>
+
    void atomic_store(shared_ptr<T>* p, shared_ptr<T> r);
+
  template<class T>
+
    void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
+
 
+
  template<class T>
+
    shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r);
+
  template<class T>
+
    shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
+
 
+
  template<class T>
+
    bool atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
+
  template<class T>
+
    bool atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
+
  template<class T>
+
    bool atomic_compare_exchange_weak_explicit(
+
      shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
+
      memory_order success, memory_order failure);
+
  template<class T>
+
    bool atomic_compare_exchange_strong_explicit(
+
      shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
+
      memory_order success, memory_order failure);
+
}
+
}}
+
 
+
====Helper concepts====
+
{{source|1=
+
template<class I>
+
concept no-throw-input-iterator = // exposition only
+
  input_iterator<I> &&
+
  is_lvalue_reference_v<iter_reference_t<I>> &&
+
  same_as<remove_cvref_t<iter_reference_t<I>>, iter_value_t<I>>;
+
 
+
template<class S, class I>
+
concept no-throw-sentinel-for = sentinel_for<S, I>; // exposition only
+
 
+
template<class R>
+
concept no-throw-input-range = // exposition only
+
  ranges::range<R> &&
+
  no-throw-input-iterator<ranges::iterator_t<R>> &&
+
  no-throw-sentinel-for<ranges::sentinel_t<R>, ranges::iterator_t<R>>;
+
 
+
template<class I>
+
concept no-throw-forward-iterator = // exposition only
+
  no-throw-input-iterator<I> &&
+
  forward_iterator<I> &&
+
  no-throw-sentinel-for<I, I>;
+
 
+
template<class R>
+
concept no-throw-forward-range = // exposition only
+
  no-throw-input-range<R> &&
+
  no-throw-forward-iterator<ranges::iterator_t<R>>;
+
}}
+
 
+
Note: [[cpp/memory/ranges/nothrow_concepts|These names]] are only for exposition, they are not part of the interface.
+
 
+
====Class template {{lc|std::pointer_traits}}====
+
{{source|1=
+
namespace std {
+
  template<class Ptr> struct pointer_traits {
+
    using pointer        = Ptr;
+
    using element_type    = /* see description */;
+
    using difference_type = /* see description */;
+
 
+
    template<class U> using rebind = /* see description */;
+
 
+
    static pointer pointer_to(/* see description */ r);
+
  };
+
 
+
  template<class T> struct pointer_traits<T*> {
+
    using pointer        = T*;
+
    using element_type    = T;
+
    using difference_type = ptrdiff_t;
+
 
+
    template<class U> using rebind = U*;
+
 
+
    static constexpr pointer pointer_to(/* see description */ r) noexcept;
+
  };
+
}
+
}}
+
 
+
====Class {{lc|std::allocator_arg_t}}====
+
{{source|1=
+
namespace std {
+
  struct allocator_arg_t { explicit allocator_arg_t() = default; };
+
  inline constexpr allocator_arg_t allocator_arg{};
+
}
+
}}
+
 
+
====Class template {{lc|std::allocator_traits}}====
+
{{source|1=
+
namespace std {
+
  template<class Alloc> struct allocator_traits {
+
    using allocator_type    = Alloc;
+
 
+
    using value_type        = typename Alloc::value_type;
+
 
+
    using pointer            = /* see description */;
+
    using const_pointer      = /* see description */;
+
    using void_pointer      = /* see description */;
+
    using const_void_pointer = /* see description */;
+
 
+
    using difference_type    = /* see description */;
+
    using size_type          = /* see description */;
+
 
+
    using propagate_on_container_copy_assignment = /* see description */;
+
    using propagate_on_container_move_assignment = /* see description */;
+
    using propagate_on_container_swap            = /* see description */;
+
    using is_always_equal                        = /* see description */;
+
 
+
    template<class T> using rebind_alloc = /* see description */;
+
    template<class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
+
 
+
    [[nodiscard]] static pointer allocate(Alloc& a, size_type n);
+
    [[nodiscard]] static pointer allocate(Alloc& a, size_type n,
+
                                          const_void_pointer hint);
+
 
+
    [[nodiscard]] static constexpr allocation_result<pointer, size_type>
+
          allocate_at_least(Alloc& a, size_type n);
+
 
+
    static void deallocate(Alloc& a, pointer p, size_type n);
+
 
+
    template<class T, class... Args>
+
      static void construct(Alloc& a, T* p, Args&&... args);
+
 
+
    template<class T>
+
      static void destroy(Alloc& a, T* p);
+
 
+
    static size_type max_size(const Alloc& a) noexcept;
+
 
+
    static Alloc select_on_container_copy_construction(const Alloc& rhs);
+
  };
+
}
+
}}
+
 
+
====Class template {{lc|std::allocator}}====
+
{{source|1=
+
namespace std {
+
  template<class T> class allocator {
+
  public:
+
    using value_type                            = T;
+
    using size_type                              = size_t;
+
    using difference_type                        = ptrdiff_t;
+
    using propagate_on_container_move_assignment = true_type;
+
 
+
    constexpr allocator() noexcept;
+
    constexpr allocator(const allocator&) noexcept;
+
    template<class U> constexpr allocator(const allocator<U>&) noexcept;
+
    constexpr ~allocator();
+
    constexpr allocator& operator=(const allocator&) = default;
+
 
+
    [[nodiscard]] constexpr T* allocate(size_t n);
+
    [[nodiscard]] constexpr allocation_result<T*> allocate_at_least(size_t n);
+
    constexpr void deallocate(T* p, size_t n);
+
 
+
    // deprecated
+
    using is_always_equal = true_type;
+
  };
+
}
+
}}
+
 
+
====Class template {{lc|std::default_delete}}====
+
{{source|1=
+
namespace std {
+
  template<class T> struct default_delete {
+
    constexpr default_delete() noexcept = default;
+
    template<class U> default_delete(const default_delete<U>&) noexcept;
+
    void operator()(T*) const;
+
  };
+
 
+
  template<class T> struct default_delete<T[]> {
+
    constexpr default_delete() noexcept = default;
+
    template<class U> default_delete(const default_delete<U[]>&) noexcept;
+
    template<class U> void operator()(U* ptr) const;
+
  };
+
}
+
}}
+
 
+
====Class template {{lc|std::unique_ptr}}====
+
{{source|1=
+
namespace std {
+
  template<class T, class D = default_delete<T>> class unique_ptr {
+
  public:
+
    using pointer      = /* see description */;
+
    using element_type = T;
+
    using deleter_type = D;
+
 
+
    // constructors
+
    constexpr unique_ptr() noexcept;
+
    explicit unique_ptr(pointer p) noexcept;
+
    unique_ptr(pointer p, /* see description */ d1) noexcept;
+
    unique_ptr(pointer p, /* see description */ d2) noexcept;
+
    unique_ptr(unique_ptr&& u) noexcept;
+
    constexpr unique_ptr(nullptr_t) noexcept;
+
    template<class U, class E>
+
      unique_ptr(unique_ptr<U, E>&& u) noexcept;
+
 
+
    // destructor
+
    ~unique_ptr();
+
 
+
    // assignment
+
    unique_ptr& operator=(unique_ptr&& u) noexcept;
+
    template<class U, class E>
+
      unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;
+
    unique_ptr& operator=(nullptr_t) noexcept;
+
 
+
    // observers
+
    add_lvalue_reference_t<T> operator*() const noexcept(/* see description */);
+
    pointer operator->() const noexcept;
+
    pointer get() const noexcept;
+
    deleter_type& get_deleter() noexcept;
+
    const deleter_type& get_deleter() const noexcept;
+
    explicit operator bool() const noexcept;
+
 
+
    // modifiers
+
    pointer release() noexcept;
+
    void reset(pointer p = pointer()) noexcept;
+
    void swap(unique_ptr& u) noexcept;
+
 
+
    // disable copy from lvalue
+
    unique_ptr(const unique_ptr&) = delete;
+
    unique_ptr& operator=(const unique_ptr&) = delete;
+
  };
+
 
+
  template<class T, class D> class unique_ptr<T[], D> {
+
  public:
+
    using pointer      = /* see description */;
+
    using element_type = T;
+
    using deleter_type = D;
+
 
+
    // constructors
+
    constexpr unique_ptr() noexcept;
+
    template<class U> explicit unique_ptr(U p) noexcept;
+
    template<class U> unique_ptr(U p, /* see description */ d) noexcept;
+
    template<class U> unique_ptr(U p, /* see description */ d) noexcept;
+
    unique_ptr(unique_ptr&& u) noexcept;
+
    template<class U, class E>
+
      unique_ptr(unique_ptr<U, E>&& u) noexcept;
+
    constexpr unique_ptr(nullptr_t) noexcept;
+
 
+
    // destructor
+
    ~unique_ptr();
+
 
+
    // assignment
+
    unique_ptr& operator=(unique_ptr&& u) noexcept;
+
    template<class U, class E>
+
      unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;
+
    unique_ptr& operator=(nullptr_t) noexcept;
+
 
+
    // observers
+
    T& operator[](size_t i) const;
+
    pointer get() const noexcept;
+
    deleter_type& get_deleter() noexcept;
+
    const deleter_type& get_deleter() const noexcept;
+
    explicit operator bool() const noexcept;
+
 
+
    // modifiers
+
    pointer release() noexcept;
+
    template<class U> void reset(U p) noexcept;
+
    void reset(nullptr_t = nullptr) noexcept;
+
    void swap(unique_ptr& u) noexcept;
+
 
+
    // disable copy from lvalue
+
    unique_ptr(const unique_ptr&) = delete;
+
    unique_ptr& operator=(const unique_ptr&) = delete;
+
  };
+
}
+
}}
+
 
+
====Class {{lc|std::bad_weak_ptr}}====
+
{{source|1=
+
namespace std {
+
  class bad_weak_ptr : public exception {
+
  public:
+
    bad_weak_ptr() noexcept;
+
  };
+
}
+
}}
+
 
+
====Class template {{lc|std::shared_ptr}}====
+
{{source|1=
+
namespace std {
+
  template<class T> class shared_ptr {
+
  public:
+
    using element_type = remove_extent_t<T>;
+
    using weak_type    = weak_ptr<T>;
+
 
+
    // constructors
+
    constexpr shared_ptr() noexcept;
+
    constexpr shared_ptr(nullptr_t) noexcept : shared_ptr() { }
+
    template<class Y>
+
      explicit shared_ptr(Y* p);
+
    template<class Y, class D>
+
      shared_ptr(Y* p, D d);
+
    template<class Y, class D, class A>
+
      shared_ptr(Y* p, D d, A a);
+
    template<class D>
+
      shared_ptr(nullptr_t p, D d);
+
    template<class D, class A>
+
      shared_ptr(nullptr_t p, D d, A a);
+
    template<class Y>
+
      shared_ptr(const shared_ptr<Y>& r, element_type* p) noexcept;
+
    template<class Y>
+
      shared_ptr(shared_ptr<Y>&& r, element_type* p) noexcept;
+
    shared_ptr(const shared_ptr& r) noexcept;
+
    template<class Y>
+
      shared_ptr(const shared_ptr<Y>& r) noexcept;
+
    shared_ptr(shared_ptr&& r) noexcept;
+
    template<class Y>
+
      shared_ptr(shared_ptr<Y>&& r) noexcept;
+
    template<class Y>
+
      explicit shared_ptr(const weak_ptr<Y>& r);
+
    template<class Y, class D>
+
      shared_ptr(unique_ptr<Y, D>&& r);
+
 
+
    // destructor
+
    ~shared_ptr();
+
 
+
    // assignment
+
    shared_ptr& operator=(const shared_ptr& r) noexcept;
+
    template<class Y>
+
      shared_ptr& operator=(const shared_ptr<Y>& r) noexcept;
+
    shared_ptr& operator=(shared_ptr&& r) noexcept;
+
    template<class Y>
+
      shared_ptr& operator=(shared_ptr<Y>&& r) noexcept;
+
    template<class Y, class D>
+
      shared_ptr& operator=(unique_ptr<Y, D>&& r);
+
 
+
    // modifiers
+
    void swap(shared_ptr& r) noexcept;
+
    void reset() noexcept;
+
    template<class Y>
+
      void reset(Y* p);
+
    template<class Y, class D>
+
      void reset(Y* p, D d);
+
    template<class Y, class D, class A>
+
      void reset(Y* p, D d, A a);
+
 
+
    // observers
+
    element_type* get() const noexcept;
+
    T& operator*() const noexcept;
+
    T* operator->() const noexcept;
+
    element_type& operator[](ptrdiff_t i) const;
+
    long use_count() const noexcept;
+
    explicit operator bool() const noexcept;
+
    template<class U>
+
      bool owner_before(const shared_ptr<U>& b) const noexcept;
+
    template<class U>
+
      bool owner_before(const weak_ptr<U>& b) const noexcept;
+
  };
+
 
+
  template<class T>
+
    shared_ptr(weak_ptr<T>) -> shared_ptr<T>;
+
  template<class T, class D>
+
    shared_ptr(unique_ptr<T, D>) -> shared_ptr<T>;
+
}
+
}}
+
 
+
====Class template {{lc|std::weak_ptr}}====
+
{{source|1=
+
namespace std {
+
  template<class T> class weak_ptr {
+
  public:
+
    using element_type = remove_extent_t<T>;
+
 
+
    // constructors
+
    constexpr weak_ptr() noexcept;
+
    template<class Y>
+
      weak_ptr(const shared_ptr<Y>& r) noexcept;
+
    weak_ptr(const weak_ptr& r) noexcept;
+
    template<class Y>
+
      weak_ptr(const weak_ptr<Y>& r) noexcept;
+
    weak_ptr(weak_ptr&& r) noexcept;
+
    template<class Y>
+
      weak_ptr(weak_ptr<Y>&& r) noexcept;
+
 
+
    // destructor
+
    ~weak_ptr();
+
 
+
    // assignment
+
    weak_ptr& operator=(const weak_ptr& r) noexcept;
+
    template<class Y>
+
      weak_ptr& operator=(const weak_ptr<Y>& r) noexcept;
+
    template<class Y>
+
      weak_ptr& operator=(const shared_ptr<Y>& r) noexcept;
+
    weak_ptr& operator=(weak_ptr&& r) noexcept;
+
    template<class Y>
+
      weak_ptr& operator=(weak_ptr<Y>&& r) noexcept;
+
 
+
    // modifiers
+
    void swap(weak_ptr& r) noexcept;
+
    void reset() noexcept;
+
 
+
    // observers
+
    long use_count() const noexcept;
+
    bool expired() const noexcept;
+
    shared_ptr<T> lock() const noexcept;
+
    template<class U>
+
      bool owner_before(const shared_ptr<U>& b) const noexcept;
+
    template<class U>
+
      bool owner_before(const weak_ptr<U>& b) const noexcept;
+
  };
+
 
+
  template<class T>
+
    weak_ptr(shared_ptr<T>) -> weak_ptr<T>;
+
}
+
}}
+
 
+
====Class template {{lc|std::owner_less}}====
+
{{source|1=
+
namespace std {
+
  template<class T = void> struct owner_less;
+
 
+
  template<class T> struct owner_less<shared_ptr<T>> {
+
    bool operator()(const shared_ptr<T>&, const shared_ptr<T>&) const noexcept;
+
    bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept;
+
    bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept;
+
  };
+
 
+
  template<class T> struct owner_less<weak_ptr<T>> {
+
    bool operator()(const weak_ptr<T>&, const weak_ptr<T>&) const noexcept;
+
    bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept;
+
    bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept;
+
  };
+
 
+
  template<> struct owner_less<void> {
+
    template<class T, class U>
+
      bool operator()(const shared_ptr<T>&, const shared_ptr<U>&) const noexcept;
+
    template<class T, class U>
+
      bool operator()(const shared_ptr<T>&, const weak_ptr<U>&) const noexcept;
+
    template<class T, class U>
+
      bool operator()(const weak_ptr<T>&, const shared_ptr<U>&) const noexcept;
+
    template<class T, class U>
+
      bool operator()(const weak_ptr<T>&, const weak_ptr<U>&) const noexcept;
+
 
+
    using is_transparent = /* unspecified */;
+
  };
+
}
+
}}
+
 
+
====Class template {{lc|std::enable_shared_from_this}}====
+
{{source|1=
+
namespace std {
+
  template<class T> class enable_shared_from_this {
+
  protected:
+
    constexpr enable_shared_from_this() noexcept;
+
    enable_shared_from_this(const enable_shared_from_this&) noexcept;
+
    enable_shared_from_this& operator=(const enable_shared_from_this&) noexcept;
+
    ~enable_shared_from_this();
+
 
+
  public:
+
    shared_ptr<T> shared_from_this();
+
    shared_ptr<T const> shared_from_this() const;
+
    weak_ptr<T> weak_from_this() noexcept;
+
    weak_ptr<T const> weak_from_this() const noexcept;
+
 
+
  private:
+
    mutable weak_ptr<T> weak_this;  // exposition only
+
  };
+
}
+
}}
+
 
+
====Class template {{lc|std::atomic}}'s specialization for {{lc|std::shared_ptr}}====
+
{{source|1=
+
namespace std {
+
  template<class T> struct atomic<shared_ptr<T>> {
+
    using value_type = shared_ptr<T>;
+
    static constexpr bool is_always_lock_free = /* implementation-defined */;
+
 
+
    bool is_lock_free() const noexcept;
+
    void store(shared_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept;
+
    shared_ptr<T> load(memory_order order = memory_order::seq_cst) const noexcept;
+
    operator shared_ptr<T>() const noexcept;
+
 
+
    shared_ptr<T> exchange(shared_ptr<T> desired,
+
                          memory_order order = memory_order::seq_cst) noexcept;
+
 
+
    bool compare_exchange_weak(shared_ptr<T>& expected, shared_ptr<T> desired,
+
                              memory_order success, memory_order failure) noexcept;
+
    bool compare_exchange_strong(shared_ptr<T>& expected, shared_ptr<T> desired,
+
                                memory_order success, memory_order failure) noexcept;
+
 
+
    bool compare_exchange_weak(shared_ptr<T>& expected, shared_ptr<T> desired,
+
                              memory_order order = memory_order::seq_cst) noexcept;
+
    bool compare_exchange_strong(shared_ptr<T>& expected, shared_ptr<T> desired,
+
                                memory_order order = memory_order::seq_cst) noexcept;
+
 
+
    constexpr atomic() noexcept = default;
+
    atomic(shared_ptr<T> desired) noexcept;
+
    atomic(const atomic&) = delete;
+
    void operator=(const atomic&) = delete;
+
    void operator=(shared_ptr<T> desired) noexcept;
+
 
+
  private:
+
    shared_ptr<T> p;            // exposition only
+
  };
+
}
+
}}
+
 
+
====Class template {{lc|std::atomic}}'s specialization for {{lc|std::weak_ptr}}====
+
{{source|1=
+
namespace std {
+
  template<class T> struct atomic<weak_ptr<T>> {
+
    using value_type = weak_ptr<T>;
+
    static constexpr bool is_always_lock_free = /* implementation-defined */;
+
 
+
    bool is_lock_free() const noexcept;
+
    void store(weak_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept;
+
    weak_ptr<T> load(memory_order order = memory_order::seq_cst) const noexcept;
+
    operator weak_ptr<T>() const noexcept;
+
 
+
    weak_ptr<T> exchange(weak_ptr<T> desired,
+
                        memory_order order = memory_order::seq_cst) noexcept;
+
 
+
    bool compare_exchange_weak(weak_ptr<T>& expected, weak_ptr<T> desired,
+
                              memory_order success, memory_order failure) noexcept;
+
    bool compare_exchange_strong(weak_ptr<T>& expected, weak_ptr<T> desired,
+
                                memory_order success, memory_order failure) noexcept;
+
 
+
    bool compare_exchange_weak(weak_ptr<T>& expected, weak_ptr<T> desired,
+
                              memory_order order = memory_order::seq_cst) noexcept;
+
    bool compare_exchange_strong(weak_ptr<T>& expected, weak_ptr<T> desired,
+
                                memory_order order = memory_order::seq_cst) noexcept;
+
 
+
    constexpr atomic() noexcept = default;
+
    atomic(weak_ptr<T> desired) noexcept;
+
    atomic(const atomic&) = delete;
+
    void operator=(const atomic&) = delete;
+
    void operator=(weak_ptr<T> desired) noexcept;
+
 
+
  private:
+
    weak_ptr<T> p;              // exposition only
+
  };
+
}
+
}}
+
 
+
====Class template {{lc|std::out_ptr_t}}====
+
{{source|1=
+
namespace std {
+
  template<class Smart, class Pointer, class... Args>
+
  class out_ptr_t {
+
  public:
+
    explicit out_ptr_t(Smart&, Args...);
+
    out_ptr_t(const out_ptr_t&) = delete;
+
 
+
    ~out_ptr_t();
+
 
+
    operator Pointer*() const noexcept;
+
    operator void**() const noexcept;
+
 
+
  private:
+
    Smart& s;                  // exposition only
+
    tuple<Args...> a;          // exposition only
+
    Pointer p;                  // exposition only
+
  };
+
}
+
}}
+
 
+
====Class template {{lc|std::in_out_ptr_t}}====
+
{{source|1=
+
namespace std {
+
  template<class Smart, class Pointer, class... Args>
+
  class inout_ptr_t {
+
  public:
+
    explicit inout_ptr_t(Smart&, Args...);
+
    inout_ptr_t(const inout_ptr_t&) = delete;
+
 
+
    ~inout_ptr_t();
+
 
+
    operator Pointer*() const noexcept;
+
    operator void**() const noexcept;
+
 
+
  private:
+
    Smart& s;                  // exposition only
+
    tuple<Args...> a;          // exposition only
+
    Pointer p;                  // exposition only
+
  };
+
}
+
}}
+
  
 
{{langlinks|de|es|ja|ru|zh}}
 
{{langlinks|de|es|ja|ru|zh}}

Latest revision as of 03:44, 4 July 2024

 
 
Standard library headers
 

This header is part of the dynamic memory management library.

Contents

Includes

(C++20)
Three-way comparison operator support[edit]

Classes

Pointer traits
provides information about pointer-like types
(class template) [edit]
Garbage collector support
(C++11)(removed in C++23)
lists pointer safety models
(enum) [edit]
Allocators
the default allocator
(class template) [edit]
provides information about allocator types
(class template) [edit]
records the address and the actual size of storage allocated by allocate_at_least
(class template) [edit]
checks if the specified type supports uses-allocator construction
(class template) [edit]
Uninitialized storage
(deprecated in C++17)(removed in C++20)
an iterator that allows standard algorithms to store results in uninitialized memory
(class template) [edit]
Smart pointers
smart pointer with unique object ownership semantics
(class template) [edit]
smart pointer with shared object ownership semantics
(class template) [edit]
(C++11)
weak reference to an object managed by std::shared_ptr
(class template) [edit]
(deprecated in C++11)(removed in C++17)
smart pointer with strict object ownership semantics
(class template) [edit]
Helper classes
atomic shared pointer
(class template specialization) [edit]
atomic weak pointer
(class template specialization) [edit]
provides mixed-type owner-based ordering of shared and weak pointers
(class template) [edit]
provides owner-based hashing for shared and weak pointers
(class) [edit]
provides mixed-type owner-based equal comparisons of shared and weak pointers
(class) [edit]
allows an object to create a shared_ptr referring to itself
(class template) [edit]
exception thrown when accessing a weak_ptr which refers to already destroyed object
(class) [edit]
default deleter for unique_ptr
(class template) [edit]
hash support for std::unique_ptr
(class template specialization) [edit]
hash support for std::shared_ptr
(class template specialization) [edit]
Smart pointer adaptors
(C++23)
interoperates with foreign pointer setters and resets a smart pointer on destruction
(class template) [edit]
interoperates with foreign pointer setters, obtains the initial pointer value from a smart pointer, and resets it on destruction
(class template) [edit]
Forward declarations
Defined in header <functional>
(C++11)
hash function object
(class template) [edit]
Defined in header <atomic>
(C++11)
atomic class template and specializations for bool, integral, floating-point,(since C++20) and pointer types
(class template) [edit]

Tags

a tag used to select allocator-aware constructors
(tag)[edit]

Functions

Uses-allocator construction
prepares the argument list matching the flavor of uses-allocator construction required by the given type
(function template) [edit]
creates an object of the given type by means of uses-allocator construction
(function template) [edit]
creates an object of the given type at specified memory location by means of uses-allocator construction
(function template) [edit]
Miscellaneous
obtains a raw pointer from a pointer-like type
(function template) [edit]
(C++11)
obtains actual address of an object, even if the & operator is overloaded
(function template) [edit]
(C++11)
aligns a pointer in a buffer
(function) [edit]
informs the compiler that a pointer is aligned
(function template) [edit]
Explicit lifetime management
implicitly creates objects in given storage with the object representation reused
(function template) [edit]
Garbage collector support
(C++11)(removed in C++23)
declares that an object can not be recycled
(function) [edit]
(C++11)(removed in C++23)
declares that an object can be recycled
(function template) [edit]
(C++11)(removed in C++23)
declares that a memory area does not contain traceable pointers
(function) [edit]
(C++11)(removed in C++23)
cancels the effect of std::declare_no_pointers
(function) [edit]
(C++11)(removed in C++23)
returns the current pointer safety model
(function) [edit]
Uninitialized storage
copies a range of objects to an uninitialized area of memory
(function template) [edit]
copies a number of objects to an uninitialized area of memory
(function template) [edit]
copies an object to an uninitialized area of memory, defined by a range
(function template) [edit]
copies an object to an uninitialized area of memory, defined by a start and a count
(function template) [edit]
moves a range of objects to an uninitialized area of memory
(function template) [edit]
moves a number of objects to an uninitialized area of memory
(function template) [edit]
constructs objects by default-initialization in an uninitialized area of memory, defined by a range
(function template) [edit]
constructs objects by default-initialization in an uninitialized area of memory, defined by a start and a count
(function template) [edit]
constructs objects by value-initialization in an uninitialized area of memory, defined by a range
(function template) [edit]
constructs objects by value-initialization in an uninitialized area of memory, defined by a start and a count
(function template) [edit]
creates an object at a given address
(function template) [edit]
destroys an object at a given address
(function template) [edit]
(C++17)
destroys a range of objects
(function template) [edit]
(C++17)
destroys a number of objects in a range
(function template) [edit]
(deprecated in C++17)(removed in C++20)
obtains uninitialized storage
(function template) [edit]
(deprecated in C++17)(removed in C++20)
frees uninitialized storage
(function template) [edit]
Smart pointer non-member operations
creates a unique pointer that manages a new object
(function template) [edit]
compares to another unique_ptr or with nullptr
(function template) [edit]
creates a shared pointer that manages a new object
(function template) [edit]
creates a shared pointer that manages a new object allocated using an allocator
(function template) [edit]
applies static_cast, dynamic_cast, const_cast, or reinterpret_cast to the stored pointer
(function template) [edit]
returns the deleter of specified type, if owned
(function template) [edit]
(removed in C++20)(removed in C++20)(removed in C++20)(removed in C++20)(removed in C++20)(C++20)
compares with another shared_ptr or with nullptr
(function template) [edit]
outputs the value of the stored pointer to an output stream
(function template) [edit]
outputs the value of the managed pointer to an output stream
(function template) [edit]
specializes the std::swap algorithm
(function template) [edit]
specializes the std::swap algorithm
(function template) [edit]
specializes the std::swap algorithm
(function template) [edit]
Smart pointer adaptor creation
(C++23)
creates an out_ptr_t with an associated smart pointer and resetting arguments
(function template) [edit]
(C++23)
creates an inout_ptr_t with an associated smart pointer and resetting arguments
(function template) [edit]
specializes atomic operations for std::shared_ptr
(function template) [edit]

Function-like entities

Defined in namespace std::ranges
Uninitialized storage
copies a range of objects to an uninitialized area of memory
(niebloid)[edit]
copies a number of objects to an uninitialized area of memory
(niebloid)[edit]
copies an object to an uninitialized area of memory, defined by a range
(niebloid)[edit]
copies an object to an uninitialized area of memory, defined by a start and a count
(niebloid)[edit]
moves a range of objects to an uninitialized area of memory
(niebloid)[edit]
moves a number of objects to an uninitialized area of memory
(niebloid)[edit]
constructs objects by default-initialization in an uninitialized area of memory, defined by a range
(niebloid)[edit]
constructs objects by default-initialization in an uninitialized area of memory, defined by a start and count
(niebloid)[edit]
constructs objects by value-initialization in an uninitialized area of memory, defined by a range
(niebloid)[edit]
constructs objects by value-initialization in an uninitialized area of memory, defined by a start and a count
(niebloid)[edit]
creates an object at a given address
(niebloid)[edit]
destroys an object at a given address
(niebloid)[edit]
destroys a range of objects
(niebloid)[edit]
destroys a number of objects in a range
(niebloid)[edit]

[edit] Synopsis

#include <compare>
 
namespace std {
  // pointer traits
  template<class Ptr> struct pointer_traits;
  template<class T> struct pointer_traits<T*>;
 
  // pointer conversion
  template<class T>
    constexpr T* to_address(T* p) noexcept;
  template<class Ptr>
    constexpr auto to_address(const Ptr& p) noexcept;
 
  // pointer alignment
  void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
  template<size_t N, class T>
    constexpr T* assume_aligned(T* ptr);
 
  // explicit lifetime management
  template<class T>
    T* start_lifetime_as(void* p) noexcept;                                   // freestanding
  template<class T>
    const T* start_lifetime_as(const void* p) noexcept;                       // freestanding
  template<class T>
    volatile T* start_lifetime_as(volatile void* p) noexcept;                 // freestanding
  template<class T>
    const volatile T* start_lifetime_as(const volatile void* p) noexcept;     // freestanding
  template<class T>
    T* start_lifetime_as_array(void* p, size_t n) noexcept;                   // freestanding
  template<class T>
    const T* start_lifetime_as_array(const void* p, size_t n) noexcept;       // freestanding
  template<class T>
    volatile T* start_lifetime_as_array(volatile void* p, size_t n) noexcept; // freestanding
  template<class T>
    const volatile T* start_lifetime_as_array(const volatile void* p,         // freestanding
                                              size_t n) noexcept;
 
  // allocator argument tag
  struct allocator_arg_t { explicit allocator_arg_t() = default; };
  inline constexpr allocator_arg_t allocator_arg{};
 
  // uses_allocator
  template<class T, class Alloc> struct uses_allocator;
 
  // uses_allocator
  template<class T, class Alloc>
    inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;
 
  // uses-allocator construction
  template<class T, class Alloc, class... Args>
    constexpr auto uses_allocator_construction_args(const Alloc& alloc,
                                                    Args&&... args) noexcept;
  template<class T, class Alloc, class Tuple1, class Tuple2>
    constexpr auto uses_allocator_construction_args(const Alloc& alloc, piecewise_construct_t,
                                                    Tuple1&& x, Tuple2&& y) noexcept;
  template<class T, class Alloc>
    constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept;
  template<class T, class Alloc, class U, class V>
    constexpr auto uses_allocator_construction_args(const Alloc& alloc,
                                                    U&& u, V&& v) noexcept;
  template<class T, class Alloc, class U, class V>
    constexpr auto uses_allocator_construction_args(const Alloc& alloc,
                                                    const pair<U, V>& pr) noexcept;
  template<class T, class Alloc, class U, class V>
    constexpr auto uses_allocator_construction_args(const Alloc& alloc,
                                                    pair<U, V>&& pr) noexcept;
  template<class T, class Alloc, class... Args>
    constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args);
  template<class T, class Alloc, class... Args>
    constexpr T* uninitialized_construct_using_allocator(T* p, const Alloc& alloc,
                                                         Args&&... args);
 
  // allocator traits
  template<class Alloc> struct allocator_traits;
 
  template<class Pointer, class SizeType = size_t>
  struct allocation_result {
    Pointer ptr;
    SizeType count;
  };
 
  // the default allocator
  template<class T> class allocator;
  template<class T, class U>
    constexpr bool operator==(const allocator<T>&, const allocator<U>&) noexcept;
 
  // addressof
  template<class T>
    constexpr T* addressof(T& r) noexcept;
  template<class T>
    const T* addressof(const T&&) = delete;
 
  // specialized algorithms
  // special memory concepts
  template<class I>
    concept no-throw-input-iterator = /* see description */;    // exposition only
  template<class I>
    concept no-throw-forward-iterator = /* see description */;  // exposition only
  template<class S, class I>
    concept no-throw-sentinel-for = /* see description */;      // exposition only
  template<class R>
    concept no-throw-input-range = /* see description */;       // exposition only
  template<class R>
    concept no-throw-forward-range = /* see description */;     // exposition only
 
  template<class NoThrowForwardIt>
    void uninitialized_default_construct(NoThrowForwardIt first,
                                         NoThrowForwardIt last);
  template<class ExecutionPolicy, class NoThrowForwardIt>
    void uninitialized_default_construct(ExecutionPolicy&& exec,
                                         NoThrowForwardIt first,
                                         NoThrowForwardIt last);
  template<class NoThrowForwardIt, class Size>
    NoThrowForwardIt
      uninitialized_default_construct_n(NoThrowForwardIt first, Size n);
  template<class ExecutionPolicy, class NoThrowForwardIt, class Size>
    NoThrowForwardIt
      uninitialized_default_construct_n(ExecutionPolicy&& exec,
                                        NoThrowForwardIt first, Size n);
 
  namespace ranges {
    template<no-throw-forward-iterator I, no-throw-sentinel-for<I> S>
      requires default_initializable<iter_value_t<I>>
        I uninitialized_default_construct(I first, S last);
    template<no-throw-forward-range R>
      requires default_initializable<range_value_t<R>>
        borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
 
    template<no-throw-forward-iterator I>
      requires default_initializable<iter_value_t<I>>
        I uninitialized_default_construct_n(I first, iter_difference_t<I> n);
  }
 
  template<class NoThrowForwardIterator>
    void uninitialized_value_construct(NoThrowForwardIterator first,
                                       NoThrowForwardIterator last);
  template<class ExecutionPolicy, class NoThrowForwardIt>
    void uninitialized_value_construct(ExecutionPolicy&& exec,
                                       NoThrowForwardIt first,
                                       NoThrowForwardIt last);
  template<class NoThrowForwardIt, class Size>
    NoThrowForwardIt
      uninitialized_value_construct_n(NoThrowForwardIt first, Size n);
  template<class ExecutionPolicy, class NoThrowForwardIt, class Size>
    NoThrowForwardIt
      uninitialized_value_construct_n(ExecutionPolicy&& exec,
                                      NoThrowForwardIt first, Size n);
 
  namespace ranges {
    template<no-throw-forward-iterator I, no-throw-sentinel-for<I> S>
      requires default_initializable<iter_value_t<I>>
        I uninitialized_value_construct(I first, S last);
    template<no-throw-forward-range R>
      requires default_initializable<range_value_t<R>>
        borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
 
    template<no-throw-forward-iterator I>
      requires default_initializable<iter_value_t<I>>
        I uninitialized_value_construct_n(I first, iter_difference_t<I> n);
  }
 
  template<class InputIt, class NoThrowForwardIt>
    NoThrowForwardIt uninitialized_copy(InputIt first, InputIt last,
                                        NoThrowForwardIt result);
  template<class ExecutionPolicy, class ForwardIt, class NoThrowForwardIt>
    NoThrowForwardIt uninitialized_copy(ExecutionPolicy&& exec,
                                        ForwardIt first, ForwardIt last,
                                        NoThrowForwardIt result);
  template<class InputIt, class Size, class NoThrowForwardIt>
    NoThrowForwardIt uninitialized_copy_n(InputIt first, Size n,
                                          NoThrowForwardIt result);
  template<class ExecutionPolicy, class ForwardIt, class Size,
           class NoThrowForwardIt>
    NoThrowForwardIt uninitialized_copy_n(ExecutionPolicy&& exec,
                                          ForwardIt first, Size n,
                                          NoThrowForwardIt result);
 
  namespace ranges {
    template<class I, class O>
      using uninitialized_copy_result = in_out_result<I, O>;
    template<input_iterator I, sentinel_for<I> S1,
             no-throw-forward-iterator O, no-throw-sentinel-for<O> S2>
      requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
        uninitialized_copy_result<I, O>
          uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast);
    template<input_range IR, no-throw-forward-range OR>
      requires constructible_from<range_value_t<OR>, range_reference_t<IR>>
        uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
          uninitialized_copy(IR&& in_range, OR&& out_range);
 
    template<class I, class O>
      using uninitialized_copy_n_result = in_out_result<I, O>;
    template<input_iterator I, no-throw-forward-iterator O, no-throw-sentinel-for<O> S>
      requires constructible_from<iter_value_t<O>, iter_reference_t<I>>
        uninitialized_copy_n_result<I, O>
          uninitialized_copy_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
  }
 
  template<class InputIt, class NoThrowForwardIt>
    NoThrowForwardIt uninitialized_move(InputIt first, InputIt last,
                                        NoThrowForwardIt result);
  template<class ExecutionPolicy, class ForwardIt, class NoThrowForwardIt>
    NoThrowForwardIt uninitialized_move(ExecutionPolicy&& exec,
                                        ForwardIt first, ForwardIt last,
                                        NoThrowForwardIt result);
  template<class InputIt, class Size, class NoThrowForwardIt>
    pair<InputIt, NoThrowForwardIt>
      uninitialized_move_n(InputIt first, Size n, NoThrowForwardIt result);
  template<class ExecutionPolicy, class ForwardIt, class Size,
           class NoThrowForwardIt>
    pair<ForwardIt, NoThrowForwardIt>
      uninitialized_move_n(ExecutionPolicy&& exec,
                           ForwardIt first, Size n, NoThrowForwardIt result);
 
  namespace ranges {
    template<class I, class O>
      using uninitialized_move_result = in_out_result<I, O>;
    template<input_iterator I, sentinel_for<I> S1,
             no-throw-forward-iterator O, no-throw-sentinel-for<O> S2>
      requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
        uninitialized_move_result<I, O>
          uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast);
    template<input_range IR, no-throw-forward-range OR>
      requires constructible_from<range_value_t<OR>, range_rvalue_reference_t<IR>>
        uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
          uninitialized_move(IR&& in_range, OR&& out_range);
 
    template<class I, class O>
      using uninitialized_move_n_result = in_out_result<I, O>;
    template<input_iterator I,
             no-throw-forward-iterator O, no-throw-sentinel-for<O> S>
      requires constructible_from<iter_value_t<O>, iter_rvalue_reference_t<I>>
        uninitialized_move_n_result<I, O>
          uninitialized_move_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast);
  }
 
  template<class NoThrowForwardIt, class T>
    void uninitialized_fill(NoThrowForwardIt first, NoThrowForwardIt last,
                            const T& x);
  template<class ExecutionPolicy, class NoThrowForwardIt, class T>
    void uninitialized_fill(ExecutionPolicy&& exec,
                            NoThrowForwardIt first, NoThrowForwardIt last,
                            const T& x);
  template<class NoThrowForwardIt, class Size, class T>
    NoThrowForwardIt
      uninitialized_fill_n(NoThrowForwardIt first, Size n, const T& x);
  template<class ExecutionPolicy, class NoThrowForwardIt, class Size, class T>
    NoThrowForwardIt
      uninitialized_fill_n(ExecutionPolicy&& exec,
                           NoThrowForwardIt first, Size n, const T& x);
 
  namespace ranges {
    template<no-throw-forward-iterator I, no-throw-sentinel-for<I> S, class T>
      requires constructible_from<iter_value_t<I>, const T&>
        I uninitialized_fill(I first, S last, const T& x);
    template<no-throw-forward-range R, class T>
      requires constructible_from<range_value_t<R>, const T&>
        borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
 
    template<no-throw-forward-iterator I, class T>
      requires constructible_from<iter_value_t<I>, const T&>
        I uninitialized_fill_n(I first, iter_difference_t<I> n, const T& x);
  }
 
  // construct_at
  template<class T, class... Args>
    constexpr T* construct_at(T* location, Args&&... args);
 
  namespace ranges {
    template<class T, class... Args>
      constexpr T* construct_at(T* location, Args&&... args);
  }
 
  // destroy
  template<class T>
    constexpr void destroy_at(T* location);
  template<class NoThrowForwardIt>
    constexpr void destroy(NoThrowForwardIt first, NoThrowForwardIt last);
  template<class ExecutionPolicy, class NoThrowForwardIt>
    void destroy(ExecutionPolicy&& exec,
                 NoThrowForwardIt first, NoThrowForwardIt last);
  template<class NoThrowForwardIt, class Size>
    constexpr NoThrowForwardIt destroy_n(NoThrowForwardIt first, Size n);
  template<class ExecutionPolicy, class NoThrowForwardIt, class Size>
    NoThrowForwardIt destroy_n(ExecutionPolicy&& exec,
                               NoThrowForwardIt first, Size n);
 
  namespace ranges {
    template<destructible T>
      constexpr void destroy_at(T* location) noexcept;
 
    template<no-throw-input-iterator I, no-throw-sentinel-for<I> S>
      requires destructible<iter_value_t<I>>
        constexpr I destroy(I first, S last) noexcept;
    template<no-throw-input-range R>
      requires destructible<range_value_t<R>>
        constexpr borrowed_iterator_t<R> destroy(R&& r) noexcept;
 
    template<no-throw-input-iterator I>
      requires destructible<iter_value_t<I>>
        constexpr I destroy_n(I first, iter_difference_t<I> n) noexcept;
  }
 
  // class template unique_ptr
  template<class T> struct default_delete;
  template<class T> struct default_delete<T[]>;
  template<class T, class D = default_delete<T>> class unique_ptr;
  template<class T, class D> class unique_ptr<T[], D>;
 
  template<class T, class... Args>
    unique_ptr<T> make_unique(Args&&... args);                                  // T is not array
  template<class T>
    unique_ptr<T> make_unique(size_t n);                                        // T is U[]
  template<class T, class... Args>
    /* unspecified */ make_unique(Args&&...) = delete;                          // T is U[N]
 
  template<class T>
    unique_ptr<T> make_unique_for_overwrite();                                  // T is not array
  template<class T>
    unique_ptr<T> 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>
    void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept;
 
  template<class T1, class D1, class T2, class D2>
    bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
  template<class T1, class D1, class T2, class D2>
    bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
  template<class T1, class D1, class T2, class D2>
    bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
  template<class T1, class D1, class T2, class D2>
    bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);
  template<class T1, class D1, class T2, class D2>
    bool operator>=(const unique_ptr<T1, D1>& x, const 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>
    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);
 
  template<class T, class D>
    bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept;
  template<class T, class D>
    bool operator<(const unique_ptr<T, D>& x, nullptr_t);
  template<class T, class D>
    bool operator<(nullptr_t, const unique_ptr<T, D>& y);
  template<class T, class D>
    bool operator>(const unique_ptr<T, D>& x, nullptr_t);
  template<class T, class D>
    bool operator>(nullptr_t, const unique_ptr<T, D>& y);
  template<class T, class D>
    bool operator<=(const unique_ptr<T, D>& x, nullptr_t);
  template<class T, class D>
    bool operator<=(nullptr_t, const unique_ptr<T, D>& y);
  template<class T, class D>
    bool operator>=(const unique_ptr<T, D>& x, nullptr_t);
  template<class T, class D>
    bool operator>=(nullptr_t, const unique_ptr<T, D>& y);
  template<class T, class D>
    requires three_way_comparable<typename unique_ptr<T, D>::pointer>
    compare_three_way_result_t<typename unique_ptr<T, D>::pointer>
      operator<=>(const unique_ptr<T, D>& x, nullptr_t);
 
  template<class E, class T, class Y, class D>
    basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const unique_ptr<Y, D>& p);
 
  // class bad_weak_ptr
  class bad_weak_ptr;
 
  // class template shared_ptr
  template<class T> class shared_ptr;
 
  // shared_ptr creation
  template<class T, class... Args>
    shared_ptr<T> make_shared(Args&&... args);                                  // T is not array
  template<class T, class A, class... Args>
    shared_ptr<T> allocate_shared(const A& a, Args&&... args);                  // T is not array
 
  template<class T>
    shared_ptr<T> make_shared(size_t N);                                        // T is U[]
  template<class T, class A>
    shared_ptr<T> allocate_shared(const A& a, size_t N);                        // T is U[]
 
  template<class T>
    shared_ptr<T> make_shared();                                                // T is U[N]
  template<class T, class A>
    shared_ptr<T> allocate_shared(const A& a);                                  // T is U[N]
 
  template<class T>
    shared_ptr<T> make_shared(size_t N, const remove_extent_t<T>& u);           // T is U[]
  template<class T, class A>
    shared_ptr<T> allocate_shared(const A& a, size_t N,
                                  const remove_extent_t<T>& u);                 // T is U[]
 
  template<class T>
    shared_ptr<T> make_shared(const remove_extent_t<T>& u);                     // T is U[N]
  template<class T, class A>
    shared_ptr<T> allocate_shared(const A& a, const remove_extent_t<T>& u);     // T is U[N]
 
  template<class T>
    shared_ptr<T> make_shared_for_overwrite();                                  // T is not U[]
  template<class T, class A>
    shared_ptr<T> allocate_shared_for_overwrite(const A& a);                    // T is not U[]
 
  template<class T>
    shared_ptr<T> make_shared_for_overwrite(size_t N);                          // T is U[]
  template<class T, class A>
    shared_ptr<T> allocate_shared_for_overwrite(const A& a, size_t N);          // T is U[]
 
  // shared_ptr comparisons
  template<class T, class U>
    bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
  template<class T, class U>
    strong_ordering operator<=>(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
 
  template<class T>
    bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept;
  template<class T>
    strong_ordering operator<=>(const shared_ptr<T>& x, nullptr_t) noexcept;
 
  // shared_ptr specialized algorithms
  template<class T>
    void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept;
 
  // shared_ptr casts
  template<class T, class U>
    shared_ptr<T> static_pointer_cast(const shared_ptr<U>& r) noexcept;
  template<class T, class U>
    shared_ptr<T> static_pointer_cast(shared_ptr<U>&& r) noexcept;
  template<class T, class U>
    shared_ptr<T> dynamic_pointer_cast(const shared_ptr<U>& r) noexcept;
  template<class T, class U>
    shared_ptr<T> dynamic_pointer_cast(shared_ptr<U>&& r) noexcept;
  template<class T, class U>
    shared_ptr<T> const_pointer_cast(const shared_ptr<U>& r) noexcept;
  template<class T, class U>
    shared_ptr<T> const_pointer_cast(shared_ptr<U>&& r) noexcept;
  template<class T, class U>
    shared_ptr<T> reinterpret_pointer_cast(const shared_ptr<U>& r) noexcept;
  template<class T, class U>
    shared_ptr<T> reinterpret_pointer_cast(shared_ptr<U>&& r) noexcept;
 
  // shared_ptr get_deleter
  template<class D, class T>
    D* get_deleter(const shared_ptr<T>& p) noexcept;
 
  // shared_ptr I/O
  template<class E, class T, class Y>
    basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const shared_ptr<Y>& p);
 
  // class template weak_ptr
  template<class T> class weak_ptr;
 
  // weak_ptr specialized algorithms
  template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;
 
  // class template owner_less
  template<class T = void> struct owner_less;
 
  // class template enable_shared_from_this
  template<class T> class enable_shared_from_this;
 
  // hash support
  template<class T> struct hash;
  template<class T, class D> struct hash<unique_ptr<T, D>>;
  template<class T> struct hash<shared_ptr<T>>;
 
  // atomic smart pointers
  template<class T> struct atomic;
  template<class T> struct atomic<shared_ptr<T>>;
  template<class T> struct atomic<weak_ptr<T>>;
 
  // class template out_ptr_t
  template<class Smart, class Pointer, class... Args>
    class out_ptr_t;
 
  // function template out_ptr
  template<class Pointer = void, class Smart, class... Args>
    auto out_ptr(Smart& s, Args&&... args);
 
  // class template inout_ptr_t
  template<class Smart, class Pointer, class... Args>
    class inout_ptr_t;
 
  // function template inout_ptr
  template<class Pointer = void, class Smart, class... Args>
    auto inout_ptr(Smart& s, Args&&... args);
}
 
// deprecated
namespace std {
  template<class T>
    bool atomic_is_lock_free(const shared_ptr<T>* p);
 
  template<class T>
    shared_ptr<T> atomic_load(const shared_ptr<T>* p);
  template<class T>
    shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo);
 
  template<class T>
    void atomic_store(shared_ptr<T>* p, shared_ptr<T> r);
  template<class T>
    void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
 
  template<class T>
    shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r);
  template<class T>
    shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);
 
  template<class T>
    bool atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
  template<class T>
    bool atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);
  template<class T>
    bool atomic_compare_exchange_weak_explicit(
      shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
      memory_order success, memory_order failure);
  template<class T>
    bool atomic_compare_exchange_strong_explicit(
      shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w,
      memory_order success, memory_order failure);
}

[edit] Helper concepts

Note: These names are only for exposition, they are not part of the interface.

template<class I>
concept no-throw-input-iterator = // exposition only
  input_iterator<I> &&
  is_lvalue_reference_v<iter_reference_t<I>> &&
  same_as<remove_cvref_t<iter_reference_t<I>>, iter_value_t<I>>;
 
template<class S, class I>
concept no-throw-sentinel-for = sentinel_for<S, I>; // exposition only
 
template<class R>
concept no-throw-input-range = // exposition only
  ranges::range<R> &&
  no-throw-input-iterator<ranges::iterator_t<R>> &&
  no-throw-sentinel-for<ranges::sentinel_t<R>, ranges::iterator_t<R>>;
 
template<class I>
concept no-throw-forward-iterator = // exposition only
  no-throw-input-iterator<I> &&
  forward_iterator<I> &&
  no-throw-sentinel-for<I, I>;
 
template<class R>
concept no-throw-forward-range = // exposition only
  no-throw-input-range<R> &&
  no-throw-forward-iterator<ranges::iterator_t<R>>;

[edit] Class template std::pointer_traits

namespace std {
  template<class Ptr> struct pointer_traits {
    using pointer         = Ptr;
    using element_type    = /* see description */;
    using difference_type = /* see description */;
 
    template<class U> using rebind = /* see description */;
 
    static pointer pointer_to(/* see description */ r);
  };
 
  template<class T> struct pointer_traits<T*> {
    using pointer         = T*;
    using element_type    = T;
    using difference_type = ptrdiff_t;
 
    template<class U> using rebind = U*;
 
    static constexpr pointer pointer_to(/* see description */ r) noexcept;
  };
}

[edit] Class std::allocator_arg_t

namespace std {
  struct allocator_arg_t { explicit allocator_arg_t() = default; };
  inline constexpr allocator_arg_t allocator_arg{};
}

[edit] Class template std::allocator_traits

namespace std {
  template<class Alloc> struct allocator_traits {
    using allocator_type     = Alloc;
 
    using value_type         = typename Alloc::value_type;
 
    using pointer            = /* see description */;
    using const_pointer      = /* see description */;
    using void_pointer       = /* see description */;
    using const_void_pointer = /* see description */;
 
    using difference_type    = /* see description */;
    using size_type          = /* see description */;
 
    using propagate_on_container_copy_assignment = /* see description */;
    using propagate_on_container_move_assignment = /* see description */;
    using propagate_on_container_swap            = /* see description */;
    using is_always_equal                        = /* see description */;
 
    template<class T> using rebind_alloc = /* see description */;
    template<class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
 
    static pointer allocate(Alloc& a, size_type n);
    static pointer allocate(Alloc& a, size_type n,
                            const_void_pointer hint);
 
    static constexpr allocation_result<pointer, size_type>
          allocate_at_least(Alloc& a, size_type n);
 
    static void deallocate(Alloc& a, pointer p, size_type n);
 
    template<class T, class... Args>
      static void construct(Alloc& a, T* p, Args&&... args);
 
    template<class T>
      static void destroy(Alloc& a, T* p);
 
    static size_type max_size(const Alloc& a) noexcept;
 
    static Alloc select_on_container_copy_construction(const Alloc& rhs);
  };
}

[edit] Class template std::allocator

namespace std {
  template<class T> class allocator {
   public:
    using value_type                             = T;
    using size_type                              = size_t;
    using difference_type                        = ptrdiff_t;
    using propagate_on_container_move_assignment = true_type;
 
    constexpr allocator() noexcept;
    constexpr allocator(const allocator&) noexcept;
    template<class U> constexpr allocator(const allocator<U>&) noexcept;
    constexpr ~allocator();
    constexpr allocator& operator=(const allocator&) = default;
 
    constexpr T* allocate(size_t n);
    constexpr allocation_result<T*> allocate_at_least(size_t n);
    constexpr void deallocate(T* p, size_t n);
 
    // deprecated
    using is_always_equal = true_type;
  };
}

[edit] Class template std::default_delete

namespace std {
  template<class T> struct default_delete {
    constexpr default_delete() noexcept = default;
    template<class U> default_delete(const default_delete<U>&) noexcept;
    void operator()(T*) const;
  };
 
  template<class T> struct default_delete<T[]> {
    constexpr default_delete() noexcept = default;
    template<class U> default_delete(const default_delete<U[]>&) noexcept;
    template<class U> void operator()(U* ptr) const;
  };
}

[edit] Class template std::unique_ptr

namespace std {
  template<class T, class D = default_delete<T>> class unique_ptr {
  public:
    using pointer      = /* see description */;
    using element_type = T;
    using deleter_type = D;
 
    // constructors
    constexpr unique_ptr() noexcept;
    explicit unique_ptr(pointer p) noexcept;
    unique_ptr(pointer p, /* see description */ d1) noexcept;
    unique_ptr(pointer p, /* see description */ d2) noexcept;
    unique_ptr(unique_ptr&& u) noexcept;
    constexpr unique_ptr(nullptr_t) noexcept;
    template<class U, class E>
      unique_ptr(unique_ptr<U, E>&& u) noexcept;
 
    // destructor
    ~unique_ptr();
 
    // assignment
    unique_ptr& operator=(unique_ptr&& u) noexcept;
    template<class U, class E>
      unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;
    unique_ptr& operator=(nullptr_t) noexcept;
 
    // observers
    add_lvalue_reference_t<T> operator*() const noexcept(/* see description */);
    pointer operator->() const noexcept;
    pointer get() const noexcept;
    deleter_type& get_deleter() noexcept;
    const deleter_type& get_deleter() const noexcept;
    explicit operator bool() const noexcept;
 
    // modifiers
    pointer release() noexcept;
    void reset(pointer p = pointer()) noexcept;
    void swap(unique_ptr& u) noexcept;
 
    // disable copy from lvalue
    unique_ptr(const unique_ptr&) = delete;
    unique_ptr& operator=(const unique_ptr&) = delete;
  };
 
  template<class T, class D> class unique_ptr<T[], D> {
  public:
    using pointer      = /* see description */;
    using element_type = T;
    using deleter_type = D;
 
    // constructors
    constexpr unique_ptr() noexcept;
    template<class U> explicit unique_ptr(U p) noexcept;
    template<class U> unique_ptr(U p, /* see description */ d) noexcept;
    template<class U> unique_ptr(U p, /* see description */ d) noexcept;
    unique_ptr(unique_ptr&& u) noexcept;
    template<class U, class E>
      unique_ptr(unique_ptr<U, E>&& u) noexcept;
    constexpr unique_ptr(nullptr_t) noexcept;
 
    // destructor
    ~unique_ptr();
 
    // assignment
    unique_ptr& operator=(unique_ptr&& u) noexcept;
    template<class U, class E>
      unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;
    unique_ptr& operator=(nullptr_t) noexcept;
 
    // observers
    T& operator[](size_t i) const;
    pointer get() const noexcept;
    deleter_type& get_deleter() noexcept;
    const deleter_type& get_deleter() const noexcept;
    explicit operator bool() const noexcept;
 
    // modifiers
    pointer release() noexcept;
    template<class U> void reset(U p) noexcept;
    void reset(nullptr_t = nullptr) noexcept;
    void swap(unique_ptr& u) noexcept;
 
    // disable copy from lvalue
    unique_ptr(const unique_ptr&) = delete;
    unique_ptr& operator=(const unique_ptr&) = delete;
  };
}

[edit] Class std::bad_weak_ptr

namespace std {
  class bad_weak_ptr : public exception {
  public:
    bad_weak_ptr() noexcept;
  };
}

[edit] Class template std::shared_ptr

namespace std {
  template<class T> class shared_ptr {
  public:
    using element_type = remove_extent_t<T>;
    using weak_type    = weak_ptr<T>;
 
    // constructors
    constexpr shared_ptr() noexcept;
    constexpr shared_ptr(nullptr_t) noexcept : shared_ptr() { }
    template<class Y>
      explicit shared_ptr(Y* p);
    template<class Y, class D>
      shared_ptr(Y* p, D d);
    template<class Y, class D, class A>
      shared_ptr(Y* p, D d, A a);
    template<class D>
      shared_ptr(nullptr_t p, D d);
    template<class D, class A>
      shared_ptr(nullptr_t p, D d, A a);
    template<class Y>
      shared_ptr(const shared_ptr<Y>& r, element_type* p) noexcept;
    template<class Y>
      shared_ptr(shared_ptr<Y>&& r, element_type* p) noexcept;
    shared_ptr(const shared_ptr& r) noexcept;
    template<class Y>
      shared_ptr(const shared_ptr<Y>& r) noexcept;
    shared_ptr(shared_ptr&& r) noexcept;
    template<class Y>
      shared_ptr(shared_ptr<Y>&& r) noexcept;
    template<class Y>
      explicit shared_ptr(const weak_ptr<Y>& r);
    template<class Y, class D>
      shared_ptr(unique_ptr<Y, D>&& r);
 
    // destructor
    ~shared_ptr();
 
    // assignment
    shared_ptr& operator=(const shared_ptr& r) noexcept;
    template<class Y>
      shared_ptr& operator=(const shared_ptr<Y>& r) noexcept;
    shared_ptr& operator=(shared_ptr&& r) noexcept;
    template<class Y>
      shared_ptr& operator=(shared_ptr<Y>&& r) noexcept;
    template<class Y, class D>
      shared_ptr& operator=(unique_ptr<Y, D>&& r);
 
    // modifiers
    void swap(shared_ptr& r) noexcept;
    void reset() noexcept;
    template<class Y>
      void reset(Y* p);
    template<class Y, class D>
      void reset(Y* p, D d);
    template<class Y, class D, class A>
      void reset(Y* p, D d, A a);
 
    // observers
    element_type* get() const noexcept;
    T& operator*() const noexcept;
    T* operator->() const noexcept;
    element_type& operator[](ptrdiff_t i) const;
    long use_count() const noexcept;
    explicit operator bool() const noexcept;
    template<class U>
      bool owner_before(const shared_ptr<U>& b) const noexcept;
    template<class U>
      bool owner_before(const weak_ptr<U>& b) const noexcept;
  };
 
  template<class T>
    shared_ptr(weak_ptr<T>) -> shared_ptr<T>;
  template<class T, class D>
    shared_ptr(unique_ptr<T, D>) -> shared_ptr<T>;
}

[edit] Class template std::weak_ptr

namespace std {
  template<class T> class weak_ptr {
  public:
    using element_type = remove_extent_t<T>;
 
    // constructors
    constexpr weak_ptr() noexcept;
    template<class Y>
      weak_ptr(const shared_ptr<Y>& r) noexcept;
    weak_ptr(const weak_ptr& r) noexcept;
    template<class Y>
      weak_ptr(const weak_ptr<Y>& r) noexcept;
    weak_ptr(weak_ptr&& r) noexcept;
    template<class Y>
      weak_ptr(weak_ptr<Y>&& r) noexcept;
 
    // destructor
    ~weak_ptr();
 
    // assignment
    weak_ptr& operator=(const weak_ptr& r) noexcept;
    template<class Y>
      weak_ptr& operator=(const weak_ptr<Y>& r) noexcept;
    template<class Y>
      weak_ptr& operator=(const shared_ptr<Y>& r) noexcept;
    weak_ptr& operator=(weak_ptr&& r) noexcept;
    template<class Y>
      weak_ptr& operator=(weak_ptr<Y>&& r) noexcept;
 
    // modifiers
    void swap(weak_ptr& r) noexcept;
    void reset() noexcept;
 
    // observers
    long use_count() const noexcept;
    bool expired() const noexcept;
    shared_ptr<T> lock() const noexcept;
    template<class U>
      bool owner_before(const shared_ptr<U>& b) const noexcept;
    template<class U>
      bool owner_before(const weak_ptr<U>& b) const noexcept;
  };
 
  template<class T>
    weak_ptr(shared_ptr<T>) -> weak_ptr<T>;
}

[edit] Class template std::owner_less

namespace std {
  template<class T = void> struct owner_less;
 
  template<class T> struct owner_less<shared_ptr<T>> {
    bool operator()(const shared_ptr<T>&, const shared_ptr<T>&) const noexcept;
    bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept;
    bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept;
  };
 
  template<class T> struct owner_less<weak_ptr<T>> {
    bool operator()(const weak_ptr<T>&, const weak_ptr<T>&) const noexcept;
    bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept;
    bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept;
  };
 
  template<> struct owner_less<void> {
    template<class T, class U>
      bool operator()(const shared_ptr<T>&, const shared_ptr<U>&) const noexcept;
    template<class T, class U>
      bool operator()(const shared_ptr<T>&, const weak_ptr<U>&) const noexcept;
    template<class T, class U>
      bool operator()(const weak_ptr<T>&, const shared_ptr<U>&) const noexcept;
    template<class T, class U>
      bool operator()(const weak_ptr<T>&, const weak_ptr<U>&) const noexcept;
 
    using is_transparent = /* unspecified */;
  };
}

[edit] Class template std::enable_shared_from_this

namespace std {
  template<class T> class enable_shared_from_this {
  protected:
    constexpr enable_shared_from_this() noexcept;
    enable_shared_from_this(const enable_shared_from_this&) noexcept;
    enable_shared_from_this& operator=(const enable_shared_from_this&) noexcept;
    ~enable_shared_from_this();
 
  public:
    shared_ptr<T> shared_from_this();
    shared_ptr<T const> shared_from_this() const;
    weak_ptr<T> weak_from_this() noexcept;
    weak_ptr<T const> weak_from_this() const noexcept;
 
  private:
    mutable weak_ptr<T> weak_this;  // exposition only
  };
}

[edit] Class template std::atomic's specialization for std::shared_ptr

namespace std {
  template<class T> struct atomic<shared_ptr<T>> {
    using value_type = shared_ptr<T>;
    static constexpr bool is_always_lock_free = /* implementation-defined */;
 
    bool is_lock_free() const noexcept;
    void store(shared_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept;
    shared_ptr<T> load(memory_order order = memory_order::seq_cst) const noexcept;
    operator shared_ptr<T>() const noexcept;
 
    shared_ptr<T> exchange(shared_ptr<T> desired,
                           memory_order order = memory_order::seq_cst) noexcept;
 
    bool compare_exchange_weak(shared_ptr<T>& expected, shared_ptr<T> desired,
                               memory_order success, memory_order failure) noexcept;
    bool compare_exchange_strong(shared_ptr<T>& expected, shared_ptr<T> desired,
                                 memory_order success, memory_order failure) noexcept;
 
    bool compare_exchange_weak(shared_ptr<T>& expected, shared_ptr<T> desired,
                               memory_order order = memory_order::seq_cst) noexcept;
    bool compare_exchange_strong(shared_ptr<T>& expected, shared_ptr<T> desired,
                                 memory_order order = memory_order::seq_cst) noexcept;
 
    constexpr atomic() noexcept = default;
    atomic(shared_ptr<T> desired) noexcept;
    atomic(const atomic&) = delete;
    void operator=(const atomic&) = delete;
    void operator=(shared_ptr<T> desired) noexcept;
 
  private:
    shared_ptr<T> p;            // exposition only
  };
}

[edit] Class template std::atomic's specialization for std::weak_ptr

namespace std {
  template<class T> struct atomic<weak_ptr<T>> {
    using value_type = weak_ptr<T>;
    static constexpr bool is_always_lock_free = /* implementation-defined */;
 
    bool is_lock_free() const noexcept;
    void store(weak_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept;
    weak_ptr<T> load(memory_order order = memory_order::seq_cst) const noexcept;
    operator weak_ptr<T>() const noexcept;
 
    weak_ptr<T> exchange(weak_ptr<T> desired,
                         memory_order order = memory_order::seq_cst) noexcept;
 
    bool compare_exchange_weak(weak_ptr<T>& expected, weak_ptr<T> desired,
                               memory_order success, memory_order failure) noexcept;
    bool compare_exchange_strong(weak_ptr<T>& expected, weak_ptr<T> desired,
                                 memory_order success, memory_order failure) noexcept;
 
    bool compare_exchange_weak(weak_ptr<T>& expected, weak_ptr<T> desired,
                               memory_order order = memory_order::seq_cst) noexcept;
    bool compare_exchange_strong(weak_ptr<T>& expected, weak_ptr<T> desired,
                                 memory_order order = memory_order::seq_cst) noexcept;
 
    constexpr atomic() noexcept = default;
    atomic(weak_ptr<T> desired) noexcept;
    atomic(const atomic&) = delete;
    void operator=(const atomic&) = delete;
    void operator=(weak_ptr<T> desired) noexcept;
 
  private:
    weak_ptr<T> p;              // exposition only
  };
}

[edit] Class template std::out_ptr_t

namespace std {
  template<class Smart, class Pointer, class... Args>
  class out_ptr_t {
  public:
    explicit out_ptr_t(Smart&, Args...);
    out_ptr_t(const out_ptr_t&) = delete;
 
    ~out_ptr_t();
 
    operator Pointer*() const noexcept;
    operator void**() const noexcept;
 
  private:
    Smart& s;                   // exposition only
    tuple<Args...> a;           // exposition only
    Pointer p;                  // exposition only
  };
}

[edit] Class template std::inout_ptr_t

namespace std {
  template<class Smart, class Pointer, class... Args>
  class inout_ptr_t {
  public:
    explicit inout_ptr_t(Smart&, Args...);
    inout_ptr_t(const inout_ptr_t&) = delete;
 
    ~inout_ptr_t();
 
    operator Pointer*() const noexcept;
    operator void**() const noexcept;
 
  private:
    Smart& s;                   // exposition only
    tuple<Args...> a;           // exposition only
    Pointer p;                  // exposition only
  };
}