名前空間
変種
操作

標準ライブラリヘッダ <memory>

提供: cppreference.com
< cpp‎ | header
 
 
 

このヘッダは動的メモリ管理ライブラリの一部です。

目次

クラス

ポインタ特性
ポインタライクな型に関する情報を提供します
(クラステンプレート)[edit]
ガベージコレクションサポート
ポインタ安全性モデルを表します
(列挙)[edit]
アロケータ
デフォルトのアロケータ
(クラステンプレート)[edit]
アロケータ型に関する情報を提供します
(クラステンプレート)[edit]
アロケータ対応のコンストラクタのオーバーロードを選択するために使用されるタグ型
(クラス)[edit]
アロケータ対応のコンストラクタを選択するために使用される std::allocator_arg_t 型のオブジェクト
(定数)[edit]
指定された型がアロケータ使用構築をサポートしているかどうか調べます
(クラステンプレート)[edit]
未初期化記憶域
(C++17で非推奨)(C++20で削除)
標準アルゴリズムで未初期化メモリに結果を格納できるようにするイテレータ
(クラステンプレート)[edit]
スマートポインタ
(C++11)
唯一のオブジェクト所有権のセマンティクスを持つスマートポインタ
(クラステンプレート)[edit]
(C++11)
共有オブジェクト所有権のセマンティクスを持つスマートポインタ
(クラステンプレート)[edit]
(C++11)
std::shared_ptr によって管理されているオブジェクトへの弱参照
(クラステンプレート)[edit]
(C++17で削除)
厳格なオブジェクト所有権のセマンティクスを持つスマートポインタ
(クラステンプレート)[edit]
ヘルパークラス
アトミックな共有ポインタ
(クラステンプレートの特殊化)[edit]
アトミックなウィークポインタ
(クラステンプレートの特殊化)[edit]
(C++11)
shared_ptr と weak_ptr の混ざった型に対するオーナーベースの順序付けを提供します
(クラステンプレート)[edit]
自身を参照する shared_ptr の作成を可能にします
(クラステンプレート)[edit]
すでに破棄されたオブジェクトを参照する weak_ptr にアクセスしたとき投げられる例外
(クラス)[edit]
unique_ptr のためのデフォルトのデリータ
(クラステンプレート)[edit]
std::unique_ptr に対するハッシュサポート
(クラステンプレートの特殊化)[edit]
std::shared_ptr に対するハッシュサポート
(クラステンプレートの特殊化)[edit]

関数

その他
(C++20)
ポインタライクな型から生のポインタを取得します
(関数テンプレート)[edit]
(C++11)
& 演算子がオーバーロードされている場合でも、オブジェクトの実際のアドレスを取得します
(関数テンプレート)[edit]
(C++11)
バッファ内のポインタをアライメント調整します
(関数)[edit]
ポインタがアラインされていることをコンパイラに伝えます
(関数テンプレート)[edit]
ガベージコレクションサポート
オブジェクトが回収できないことを宣言します
(関数)[edit]
オブジェクトが回収できることを宣言します
(関数テンプレート)[edit]
メモリ領域に追跡可能なポインタが含まれていないことを宣言します
(関数)[edit]
std::declare_no_pointers の効果を取り消します
(関数)[edit]
現在のポインタ安全性モデルを返します
(関数)[edit]
未初期化記憶域
指定範囲のオブジェクトをメモリの未初期化領域にコピーします
(関数テンプレート)[edit]
指定個数のオブジェクトをメモリの未初期化領域にコピーします
(関数テンプレート)[edit]
1個のオブジェクトをメモリの未初期化領域の指定範囲にコピーします
(関数テンプレート)[edit]
1個のオブジェクトをメモリの未初期化領域に指定個数コピーします
(関数テンプレート)[edit]
指定範囲のオブジェクトをメモリの未初期化領域にムーブします
(関数テンプレート)[edit]
指定個数のオブジェクトをメモリの未初期化領域にムーブします
(関数テンプレート)[edit]
オブジェクトをデフォルト初期化によりメモリの未初期化領域の指定範囲に構築します
(関数テンプレート)[edit]
オブジェクトをデフォルト初期化によりメモリの未初期化領域に指定個数構築します
(関数テンプレート)[edit]
オブジェクトを値初期化によりメモリの未初期化領域の指定範囲に構築します
(関数テンプレート)[edit]
オブジェクトを値初期化によりメモリの未初期化領域に指定個数構築します
(関数テンプレート)[edit]
(C++17)
指定されたアドレスにあるオブジェクトを破棄します
(関数テンプレート)[edit]
(C++17)
指定範囲のオブジェクトを破棄します
(関数テンプレート)[edit]
(C++17)
指定個数のオブジェクトを破棄します
(関数テンプレート)[edit]
(C++17で非推奨)(C++20で削除)
未初期化記憶域を取得します
(関数テンプレート)[edit]
(C++17で非推奨)(C++20で削除)
未初期化記憶域を解放します
(関数テンプレート)[edit]
スマートポインタの非メンバ操作
新しいオブジェクトを管理する unique_ptr を作成します
(関数テンプレート)[edit]
別の unique_ptr または nullptr と比較します
(関数テンプレート)[edit]
新しいオブジェクトを管理する shared_ptr を作成します
(関数テンプレート)[edit]
アロケータを使用して確保した新しいオブジェクトを管理する shared_ptr を作成します
(関数テンプレート)[edit]
格納されているポインタに static_cast, dynamic_cast, const_cast または reinterpret_cast を適用します
(関数テンプレート)[edit]
所有している場合、指定された型のデリータを返します
(関数テンプレート)[edit]
(C++20で削除)(C++20で削除)(C++20で削除)(C++20で削除)(C++20で削除)(C++20)
別の shared_ptr または nullptr と比較します
(関数テンプレート)[edit]
格納されているポインタの値を出力ストリームに出力します
(関数テンプレート)[edit]
std::swap アルゴリズムの特殊化
(関数テンプレート)[edit]
std::swap アルゴリズムの特殊化
(関数テンプレート)[edit]
std::swap アルゴリズムの特殊化
(関数テンプレート)[edit]
std::shared_ptr に対するアトミック操作の特殊化
(関数テンプレート)[edit]

ニーブロイド

名前空間 std::ranges で定義
未初期化記憶域
メモリの未初期化領域に指定範囲のオブジェクトをコピーします
(ニーブロイド)[edit]
メモリの未初期化領域に指定個数のオブジェクトをコピーします
(ニーブロイド)[edit]
指定された範囲で定義されるメモリの未初期化領域にオブジェクトをコピーします
(ニーブロイド)[edit]
指定された開始位置と個数で定義されるメモリの未初期化領域にオブジェクトをコピーします
(ニーブロイド)[edit]
メモリの未初期化領域に指定範囲のオブジェクトをムーブします
(ニーブロイド)[edit]
メモリの未初期化領域に指定個数のオブジェクトをムーブします
(ニーブロイド)[edit]
指定された範囲で定義されるメモリの未初期化領域にデフォルト初期化でオブジェクトを構築します
(ニーブロイド)[edit]
指定された開始位置と個数で定義されるメモリの未初期化領域にデフォルト初期化でオブジェクトを構築します
(ニーブロイド)[edit]
指定された範囲で定義されるメモリの未初期化領域に値初期化でオブジェクトを構築します
(ニーブロイド)[edit]
指定された開始位置と個数で定義されるメモリの未初期化領域に値初期化でオブジェクトを構築します
(ニーブロイド)[edit]
(C++20)
指定アドレスのオブジェクトを破棄します
(ニーブロイド)[edit]
(C++20)
指定範囲のオブジェクトを破棄します
(ニーブロイド)[edit]
(C++20)
指定個数のオブジェクトを破棄します
(ニーブロイド)[edit]

[編集]概要

namespace std {// pointer traitstemplate<class Ptr>struct pointer_traits;template<class T>struct pointer_traits<T*>;   // pointer conversiontemplate<class T>constexpr T* to_address(T* p)noexcept;template<class Ptr>auto to_address(const Ptr& p)noexcept;   // pointer safetyenumclass 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 alignmentvoid* 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 tagstruct allocator_arg_t {explicit allocator_arg_t()=default;};inlineconstexpr allocator_arg_t allocator_arg{};   // uses_allocatortemplate<class T, class Alloc>struct uses_allocator;   // uses_allocatortemplate<class T, class Alloc>inlineconstexprbool uses_allocator_v = uses_allocator<T, Alloc>::value;   // uses-allocator constructiontemplate<class T, class Alloc, class... Args>constexprauto uses_allocator_construction_args(const Alloc& alloc, Args&&... args)noexcept->/* see definition */;template<class T, class Alloc, class Tuple1, class Tuple2>constexprauto uses_allocator_construction_args(const Alloc& alloc, piecewise_construct_t, Tuple1&& x, Tuple2&& y)noexcept->/* see definition */;template<class T, class Alloc>constexprauto uses_allocator_construction_args(const Alloc& alloc)noexcept->/* see definition */;template<class T, class Alloc, class U, class V>constexprauto uses_allocator_construction_args(const Alloc& alloc, U&& u, V&& v)noexcept->/* see definition */;template<class T, class Alloc, class U, class V>constexprauto uses_allocator_construction_args(const Alloc& alloc, const pair<U,V>& pr)noexcept->/* see definition */;template<class T, class Alloc, class U, class V>constexprauto 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 traitstemplate<class Alloc>struct allocator_traits;   // the default allocatortemplate<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 conceptstemplate<class I> concept __NoThrowInputIterator =/* see definition */;// exposition onlytemplate<class I> concept __NoThrowForwardIterator =/* see definition */;// exposition onlytemplate<class S, class I> concept __NoThrowSentinel =/* see definition */;// exposition onlytemplate<class R> concept __NoThrowInputRange =/* see definition */;// exposition onlytemplate<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_­ptrtemplate<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 arraytemplate<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 arraytemplate<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_ptrclass bad_weak_ptr;   // class template shared_ptrtemplate<class T>class shared_ptr;   // shared_ptr creationtemplate<class T, class... Args> shared_ptr<T> make_shared(Args&&... args);// T is not arraytemplate<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 comparisonstemplate<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 algorithmstemplate<class T>void swap(shared_ptr<T>& a, shared_ptr<T>& b)noexcept;   // shared_ptr caststemplate<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_deletertemplate<class D, class T> D* get_deleter(const shared_ptr<T>& p)noexcept;   // shared_ptr I/Otemplate<class E, class T, class Y> basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const shared_ptr<Y>& p);   // class template weak_ptrtemplate<class T>class weak_ptr;   // weak_ptr specialized algorithmstemplate<class T>void swap(weak_ptr<T>& a, weak_ptr<T>& b)noexcept;   // class template owner_lesstemplate<class T =void>struct owner_less;   // class template enable_shared_from_thistemplate<class T>class enable_shared_from_this;   // hash supporttemplate<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 pointerstemplate<class T>struct atomic;template<class T>struct atomic<shared_ptr<T>>;template<class T>struct atomic<weak_ptr<T>>;   // shared_ptr atomic accesstemplate<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);}

[編集]ヘルパーコンセプト

template<class I> concept __NoThrowInputIterator =// exposition only InputIterator<I>&& is_lvalue_reference_v<iter_reference_t<I>>&& Same<remove_cvref_t<iter_reference_t<I>>, iter_value_t<I>>;   template<class S, class I> concept __NoThrowSentinel = Sentinel<S, I>;// exposition only   template<class R> concept __NoThrowInputRange =// exposition only Range<R>&& __NoThrowInputIterator<iterator_t<R>>&& __NoThrowSentinel<sentinel_t<R>, iterator_t<R>>;   template<class I> concept __NoThrowForwardIterator =// exposition only __NoThrowInputIterator<I>&& ForwardIterator<I>&& __NoThrowSentinel<I, I>;   template<class R> concept __NoThrowForwardRange =// exposition only __NoThrowInputRange<R>&& __NoThrowForwardIterator<iterator_t<R>>;

注: これらの名前は説明専用であり、インタフェースの一部ではありません。

[編集]クラステンプレート std::pointer_traits

namespace std {template<class Ptr>struct pointer_traits {using pointer = Ptr;using element_type =/* see definition */;using difference_type =/* see definition */;template<class U>using rebind =/* see definition */;static pointer pointer_to(/* see definition */ 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*;staticconstexpr pointer pointer_to(/* see definition */ r)noexcept;};}

[編集]クラス std::allocator_arg_t

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

[編集]クラステンプレート 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 definition */;using const_pointer =/* see definition */;using void_pointer =/* see definition */;using const_void_pointer =/* see definition */;   using difference_type =/* see definition */;using size_type =/* see definition */;   using propagate_on_container_copy_assignment =/* see definition */;using propagate_on_container_move_assignment =/* see definition */;using propagate_on_container_swap =/* see definition */;using is_always_equal =/* see definition */;   template<class T>using rebind_alloc =/* see definition */;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);   staticvoid deallocate(Alloc& a, pointer p, size_type n);   template<class T, class... Args>staticvoid construct(Alloc& a, T* p, Args&&... args);   template<class T>staticvoid destroy(Alloc& a, T* p);   static size_type max_size(const Alloc& a)noexcept;   static Alloc select_on_container_copy_construction(const Alloc& rhs);};}

[編集]クラステンプレート 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;using is_always_equal = true_type;   constexpr allocator()noexcept;constexpr allocator(const allocator&)noexcept;template<class U>constexpr allocator(const allocator<U>&)noexcept; ~allocator(); allocator& operator=(const allocator&)=default;   [[nodiscard]] T* allocate(size_t n);void deallocate(T* p, size_t n);};}

[編集]クラステンプレート 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;};}

[編集]クラステンプレート std::unique_ptr

namespace std {template<class T, class D = default_delete<T>>class unique_ptr {public:using pointer =/* see definition */;using element_type = T;using deleter_type = D;   // constructorsconstexpr unique_ptr()noexcept;explicit unique_ptr(pointer p)noexcept; unique_ptr(pointer p, /* see definition */ d1)noexcept; unique_ptr(pointer p, /* see definition */ 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; pointer operator->()constnoexcept; pointer get()constnoexcept; deleter_type& get_deleter()noexcept;const deleter_type& get_deleter()constnoexcept;explicit operator bool()constnoexcept;   // 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 definition */;using element_type = T;using deleter_type = D;   // constructorsconstexpr unique_ptr()noexcept;template<class U>explicit unique_ptr(U p)noexcept;template<class U> unique_ptr(U p, /* see definition */ d)noexcept;template<class U> unique_ptr(U p, /* see definition */ 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()constnoexcept; deleter_type& get_deleter()noexcept;const deleter_type& get_deleter()constnoexcept;explicit operator bool()constnoexcept;   // 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;};}

[編集]クラス std::bad_weak_ptr

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

[編集]クラステンプレート 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>;   // constructorsconstexpr 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);   // modifiersvoid 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()constnoexcept; T& operator*()constnoexcept; T* operator->()constnoexcept; element_type& operator[](ptrdiff_t i)const;long use_count()constnoexcept;explicit operator bool()constnoexcept;template<class U>bool owner_before(const shared_ptr<U>& b)constnoexcept;template<class U>bool owner_before(const weak_ptr<U>& b)constnoexcept;};   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>;}

[編集]クラステンプレート std::weak_ptr

namespace std {template<class T>class weak_ptr {public:using element_type = remove_extent_t<T>;   // constructorsconstexpr 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;   // modifiersvoid swap(weak_ptr& r)noexcept;void reset()noexcept;   // observerslong use_count()constnoexcept;bool expired()constnoexcept; shared_ptr<T> lock()constnoexcept;template<class U>bool owner_before(const shared_ptr<U>& b)constnoexcept;template<class U>bool owner_before(const weak_ptr<U>& b)constnoexcept;};   template<class T> weak_ptr(shared_ptr<T>)-> weak_ptr<T>;}

[編集]クラステンプレート 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>&)constnoexcept;bool operator()(const shared_ptr<T>&, const weak_ptr<T>&)constnoexcept;bool operator()(const weak_ptr<T>&, const shared_ptr<T>&)constnoexcept;};   template<class T>struct owner_less<weak_ptr<T>>{bool operator()(const weak_ptr<T>&, const weak_ptr<T>&)constnoexcept;bool operator()(const shared_ptr<T>&, const weak_ptr<T>&)constnoexcept;bool operator()(const weak_ptr<T>&, const shared_ptr<T>&)constnoexcept;};   template<>struct owner_less<void>{template<class T, class U>bool operator()(const shared_ptr<T>&, const shared_ptr<U>&)constnoexcept;template<class T, class U>bool operator()(const shared_ptr<T>&, const weak_ptr<U>&)constnoexcept;template<class T, class U>bool operator()(const weak_ptr<T>&, const shared_ptr<U>&)constnoexcept;template<class T, class U>bool operator()(const weak_ptr<T>&, const weak_ptr<U>&)constnoexcept;   using is_transparent =/* unspecified */;};}

[編集]クラステンプレート 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()constnoexcept;   private: mutable weak_ptr<T> weak_this;// exposition only};}

[編集]クラステンプレート std::atomicstd::shared_ptr に対する特殊化

namespace std {template<class T>struct atomic<shared_ptr<T>>{using value_type = shared_ptr<T>;staticconstexprbool is_always_lock_free =/* implementation-defined */;   bool is_lock_free()constnoexcept;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)constnoexcept; operator shared_ptr<T>()constnoexcept;   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};}

[編集]クラステンプレート std::atomicstd::weak_ptr に対する特殊化

namespace std {template<class T>struct atomic<weak_ptr<T>>{using value_type = weak_ptr<T>;staticconstexprbool is_always_lock_free =/* implementation-defined */;   bool is_lock_free()constnoexcept;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)constnoexcept; operator weak_ptr<T>()constnoexcept;   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};}
close