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>
auto to_address(const Ptr& p) noexcept;
// pointer safety
enum class pointer_safety { relaxed, preferred, strict };
void declare_reachable(void* p);
template<class T>
T* undeclare_reachable(T* p);
void declare_no_pointers(char* p, size_t n);
void undeclare_no_pointers(char* p, size_t n);
pointer_safety get_pointer_safety() 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 -> /* see definition */;
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 -> /* see definition */;
template<class T, class Alloc>
constexpr auto uses_allocator_construction_args(const Alloc& alloc)
noexcept -> /* see definition */;
template<class T, class Alloc, class U, class V>
constexpr auto uses_allocator_construction_args(const Alloc& alloc, U&& u, V&& v)
noexcept -> /* see definition */;
template<class T, class Alloc, class U, class V>
constexpr auto uses_allocator_construction_args(const Alloc& alloc,
const pair<U,V>& pr)
noexcept -> /* see definition */;
template<class T, class Alloc, class U, class V>
constexpr auto uses_allocator_construction_args(const Alloc& alloc, pair<U,V>&& pr)
noexcept -> /* see definition */;
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>
T* uninitialized_construct_using_allocator(T* p, const Alloc& alloc, Args&&... args);
// allocator traits
template<class Alloc> struct allocator_traits;
// the default allocator
template<class T> class allocator;
template<class T, class U>
bool operator==(const allocator<T>&, const allocator<U>&) noexcept;
template<class T, class U>
bool operator!=(const allocator<T>&, const allocator<U>&) noexcept;
// specialized algorithms
// special memory concepts
template<class I>
concept __NoThrowInputIterator = /* see definition */; // exposition only
template<class I>
concept __NoThrowForwardIterator = /* see definition */; // exposition only
template<class S, class I>
concept __NoThrowSentinel = /* see definition */; // exposition only
template<class R>
concept __NoThrowInputRange = /* see definition */; // exposition only
template<class R>
concept __NoThrowForwardRange = /* see definition */; // exposition only
template<class T>
constexpr T* addressof(T& r) noexcept;
template<class T>
const T* addressof(const T&&) = delete;
template<class ForwardIt>
void uninitialized_default_construct(ForwardIt first, ForwardIt last);
template<class ExecutionPolicy, class ForwardIt>
void uninitialized_default_construct(ExecutionPolicy&& exec,
ForwardIt first, ForwardIt last);
template<class ForwardIt, class Size>
ForwardIt uninitialized_default_construct_n(ForwardIt first, Size n);
template<class ExecutionPolicy, class ForwardIt, class Size>
ForwardIt uninitialized_default_construct_n(ExecutionPolicy&& exec,
ForwardIt first, Size n);
namespace ranges {
template<__NoThrowForwardIterator I, __NoThrowSentinel<I> S>
requires DefaultConstructible<iter_value_t<I>>
I uninitialized_default_construct(I first, S last);
template<__NoThrowForwardRange R>
requires DefaultConstructible<iter_value_t<iterator_t<R>>>
borrowed_iterator_t<R> uninitialized_default_construct(R&& r);
template<__NoThrowForwardIterator I>
requires DefaultConstructible<iter_value_t<I>>
I uninitialized_default_construct_n(I first, iter_difference_t<I> n);
}
template<class ForwardIt>
void uninitialized_value_construct(ForwardIt first, ForwardIt last);
template<class ExecutionPolicy, class ForwardIt>
void uninitialized_value_construct(ExecutionPolicy&& exec,
ForwardIt first, ForwardIt last);
template<class ForwardIt, class Size>
ForwardIt uninitialized_value_construct_n(ForwardIt first, Size n);
template<class ExecutionPolicy, class ForwardIt, class Size>
ForwardIt uninitialized_value_construct_n(ExecutionPolicy&& exec,
ForwardIt first, Size n);
namespace ranges {
template<__NoThrowForwardIterator I, __NoThrowSentinel<I> S>
requires DefaultConstructible<iter_value_t<I>>
I uninitialized_value_construct(I first, S last);
template<__NoThrowForwardRange R>
requires DefaultConstructible<iter_value_t<iterator_t<R>>>
borrowed_iterator_t<R> uninitialized_value_construct(R&& r);
template<__NoThrowForwardIterator I>
requires DefaultConstructible<iter_value_t<I>>
I uninitialized_value_construct_n(I first, iter_difference_t<I> n);
}
template<class InputIt, class ForwardIt>
ForwardIt uninitialized_copy(InputIt first, InputIt last, ForwardIt result);
template<class ExecutionPolicy, class InputIt, class ForwardIt>
ForwardIt uninitialized_copy(ExecutionPolicy&& exec,
InputIt first, InputIt last, ForwardIt result);
template<class InputIt, class Size, class ForwardIt>
ForwardIt uninitialized_copy_n(InputIt first, Size n, ForwardIt result);
template<class ExecutionPolicy, class InputIt, class Size, class ForwardIt>
ForwardIt uninitialized_copy_n(ExecutionPolicy&& exec,
InputIt first, Size n, ForwardIt result);
namespace ranges {
template<class I, class O>
using uninitialized_copy_result = copy_result<I, O>;
template<InputIterator I, Sentinel<I> S1,
__NoThrowForwardIterator O, __NoThrowSentinel<O> S2>
requires Constructible<iter_value_t<O>, iter_reference_t<I>>
uninitialized_copy_result<I, O>
uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast);
template<InputRange IR, __NoThrowForwardRange OR>
requires
Constructible<iter_value_t<iterator_t<OR>>, iter_reference_t<iterator_t<IR>>>
uninitialized_copy_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
uninitialized_copy(IR&& input_range, OR&& output_range);
template<class I, class O>
using uninitialized_copy_n_result = uninitialized_copy_result<I, O>;
template<InputIterator I, __NoThrowForwardIterator O, __NoThrowSentinel<O> S>
requires Constructible<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 ForwardIt>
ForwardIt uninitialized_move(InputIt first, InputIt last, ForwardIt result);
template<class ExecutionPolicy, class InputIt, class ForwardIt>
ForwardIt uninitialized_move(ExecutionPolicy&& exec,
InputIt first, InputIt last, ForwardIt result);
template<class InputIt, class Size, class ForwardIt>
pair<InputIt, ForwardIt> uninitialized_move_n(InputIt first, Size n,
ForwardIt result);
template<class ExecutionPolicy, class InputIt, class Size, class ForwardIt>
pair<InputIt, ForwardIt> uninitialized_move_n(ExecutionPolicy&& exec,
InputIt first, Size n,
ForwardIt result);
namespace ranges {
template<class I, class O>
using uninitialized_move_result = uninitialized_copy_result<I, O>;
template<InputIterator I, Sentinel<I> S1,
__NoThrowForwardIterator O, __NoThrowSentinel<O> S2>
requires Constructible<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<InputRange IR, __NoThrowForwardRange OR>
requires Constructible<iter_value_t<iterator_t<OR>>,
iter_rvalue_reference_t<iterator_t<IR>>>
uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>>
uninitialized_move(IR&& input_range, OR&& output_range);
template<class I, class O>
using uninitialized_move_n_result = uninitialized_copy_result<I, O>;
template<InputIterator I,
__NoThrowForwardIterator O, __NoThrowSentinel<O> S>
requires Constructible<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 ForwardIt, class T>
void uninitialized_fill(ForwardIt first, ForwardIt last, const T& x);
template<class ExecutionPolicy, class ForwardIt, class T>
void uninitialized_fill(ExecutionPolicy&& exec,
ForwardIt first, ForwardIt last, const T& x);
template<class ForwardIt, class Size, class T>
ForwardIt uninitialized_fill_n(ForwardIt first, Size n, const T& x);
template<class ExecutionPolicy, class ForwardIt, class Size, class T>
ForwardIt uninitialized_fill_n(ExecutionPolicy&& exec,
ForwardIt first, Size n, const T& x);
namespace ranges {
template<__NoThrowForwardIterator I, __NoThrowSentinel<I> S, class T>
requires Constructible<iter_value_t<I>, const T&>
I uninitialized_fill(I first, S last, const T& x);
template<__NoThrowForwardRange R, class T>
requires Constructible<iter_value_t<iterator_t<R>>, const T&>
borrowed_iterator_t<R> uninitialized_fill(R&& r, const T& x);
template<__NoThrowForwardIterator I, class T>
requires Constructible<iter_value_t<I>, const T&>
I uninitialized_fill_n(I first, iter_difference_t<I> n, const T& x);
}
template<class T>
void destroy_at(T* location);
template<class ForwardIt>
void destroy(ForwardIt first, ForwardIt last);
template<class ExecutionPolicy, class ForwardIt>
void destroy(ExecutionPolicy&& exec,
ForwardIt first, ForwardIt last);
template<class ForwardIt, class Size>
ForwardIt destroy_n(ForwardIt first, Size n);
template<class ExecutionPolicy, class ForwardIt, class Size>
ForwardIt destroy_n(ExecutionPolicy&& exec,
ForwardIt first, Size n);
namespace ranges {
template<Destructible T>
void destroy_at(T* location) noexcept;
template<__NoThrowInputIterator I, __NoThrowSentinel<I> S>
requires Destructible<iter_value_t<I>>
I destroy(I first, S last) noexcept;
template<__NoThrowInputRange R>
requires Destructible<iter_value_t<iterator_t<R>>
borrowed_iterator_t<R> destroy(R&& r) noexcept;
template<__NoThrowInputIterator I>
requires Destructible<iter_value_t<I>>
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>
bool 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==(nullptr_t, const unique_ptr<T, D>& y) noexcept;
template<class T, class D>
bool operator!=(const unique_ptr<T, D>& x, nullptr_t) noexcept;
template<class T, class D>
bool operator!=(nullptr_t, const unique_ptr<T, D>& y) 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 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>
bool operator!=(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
template<class T, class U>
bool operator<(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
template<class T, class U>
bool operator>(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
template<class T, class U>
bool operator<=(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
template<class T, class U>
bool 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>
bool operator==(nullptr_t, const shared_ptr<T>& y) noexcept;
template<class T>
bool operator!=(const shared_ptr<T>& x, nullptr_t) noexcept;
template<class T>
bool operator!=(nullptr_t, const shared_ptr<T>& y) noexcept;
template<class T>
bool operator<(const shared_ptr<T>& x, nullptr_t) noexcept;
template<class T>
bool operator<(nullptr_t, const shared_ptr<T>& y) noexcept;
template<class T>
bool operator>(const shared_ptr<T>& x, nullptr_t) noexcept;
template<class T>
bool operator>(nullptr_t, const shared_ptr<T>& y) noexcept;
template<class T>
bool operator<=(const shared_ptr<T>& x, nullptr_t) noexcept;
template<class T>
bool operator<=(nullptr_t, const shared_ptr<T>& y) noexcept;
template<class T>
bool operator>=(const shared_ptr<T>& x, nullptr_t) noexcept;
template<class T>
bool operator>=(nullptr_t, const shared_ptr<T>& y) 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>>;
// shared_ptr atomic access
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);
}