標準ライブラリヘッダ <atomic>
提供: cppreference.com
このヘッダはアトミック操作ライブラリの一部です。
クラス | ||
(C++11) | atomic クラステンプレートと bool 型、整数型、ポインタ型に対する特殊化 (クラステンプレート) | |
(C++20) | 非アトミックオブジェクトに対するアトミック操作を提供します (クラステンプレート) | |
(C++11) | ロックフリーなアトミックブーリアン型 (クラス) | |
(C++11) | 指定されたアトミック操作のメモリ順序制約を定義します (列挙) | |
typedef | ||
std::atomic_bool | std::atomic<bool> | |
std::atomic_char | std::atomic<char> | |
std::atomic_schar | std::atomic<signedchar> | |
std::atomic_uchar | std::atomic<unsignedchar> | |
std::atomic_short | std::atomic<short> | |
std::atomic_ushort | std::atomic<unsignedshort> | |
std::atomic_int | std::atomic<int> | |
std::atomic_uint | std::atomic<unsignedint> | |
std::atomic_long | std::atomic<long> | |
std::atomic_ulong | std::atomic<unsignedlong> | |
std::atomic_llong | std::atomic<longlong> | |
std::atomic_ullong | std::atomic<unsignedlonglong> | |
std::atomic_char8_t(C++20) | std::atomic<char8_t> | |
std::atomic_char16_t | std::atomic<char16_t> | |
std::atomic_char32_t | std::atomic<char32_t> | |
std::atomic_wchar_t | std::atomic<wchar_t> | |
std::atomic_int8_t | std::atomic<std::int8_t> | |
std::atomic_uint8_t | std::atomic<std::uint8_t> | |
std::atomic_int16_t | std::atomic<std::int16_t> | |
std::atomic_uint16_t | std::atomic<std::uint16_t> | |
std::atomic_int32_t | std::atomic<std::int32_t> | |
std::atomic_uint32_t | std::atomic<std::uint32_t> | |
std::atomic_int64_t | std::atomic<std::int64_t> | |
std::atomic_uint64_t | std::atomic<std::uint64_t> | |
std::atomic_int_least8_t | std::atomic<int_least8_t> | |
std::atomic_uint_least8_t | std::atomic<uint_least8_t> | |
std::atomic_int_least16_t | std::atomic<int_least16_t> | |
std::atomic_uint_least16_t | std::atomic<uint_least16_t> | |
std::atomic_int_least32_t | std::atomic<int_least32_t> | |
std::atomic_uint_least32_t | std::atomic<uint_least32_t> | |
std::atomic_int_least64_t | std::atomic<int_least64_t> | |
std::atomic_uint_least64_t | std::atomic<uint_least64_t> | |
std::atomic_int_fast8_t | std::atomic<int_fast8_t> | |
std::atomic_uint_fast8_t | std::atomic<uint_fast8_t> | |
std::atomic_int_fast16_t | std::atomic<int_fast16_t> | |
std::atomic_uint_fast16_t | std::atomic<uint_fast16_t> | |
std::atomic_int_fast32_t | std::atomic<int_fast32_t> | |
std::atomic_uint_fast32_t | std::atomic<uint_fast32_t> | |
std::atomic_int_fast64_t | std::atomic<int_fast64_t> | |
std::atomic_uint_fast64_t | std::atomic<uint_fast64_t> | |
std::atomic_intptr_t | std::atomic<intptr_t> | |
std::atomic_uintptr_t | std::atomic<uintptr_t> | |
std::atomic_size_t | std::atomic<size_t> | |
std::atomic_ptrdiff_t | std::atomic<ptrdiff_t> | |
std::atomic_intmax_t | std::atomic<intmax_t> | |
std::atomic_uintmax_t | std::atomic<uintmax_t> | |
std::atomic_signed_lock_free(C++20) | 待機/通知に対して最も効率良いロックフリーな符号付き整数アトミック型 | |
std::atomic_unsigned_lock_free(C++20) | 待機/通知に対して最も効率良いロックフリーな符号なし整数アトミック型 | |
関数 | ||
(C++11) | アトミック型の操作がロックフリーかどうか調べます (関数テンプレート) | |
(C++11)(C++11) | アトミックオブジェクトの値を非アトミック引数でアトミックに置き換えます (関数テンプレート) | |
(C++11)(C++11) | アトミックオブジェクトに格納されている値をアトミックに取得します (関数テンプレート) | |
(C++11)(C++11) | アトミックオブジェクトの値を非アトミック引数でアトミックに置き換え、そのアトミックの古い値を返します (関数テンプレート) | |
アトミックに、アトミックオブジェクトの値を非アトミック引数と比較し、等しければ交換を行い、等しくなければ読み込みます (関数テンプレート) | ||
(C++11)(C++11) | アトミックオブジェクトに非アトミック値を加算し、そのアトミックの以前の値を取得します (関数テンプレート) | |
(C++11)(C++11) | アトミックオブジェクトから非アトミック値を減算し、アトミックの以前の値を取得します (関数テンプレート) | |
(C++11)(C++11) | アトミックオブジェクトの値を非アトミック引数とビット単位の論理積を取った結果で置き換え、アトミックの以前の値を取得します (関数テンプレート) | |
(C++11)(C++11) | アトミックオブジェクトの値を非アトミック引数とビット単位の論理和を取った結果で置き換え、アトミックの以前の値を取得します (関数テンプレート) | |
(C++11)(C++11) | アトミックオブジェクトの値を非アトミック引数とビット単位の排他的論理和を取った結果で置き換え、アトミックの以前の値を取得します (関数テンプレート) | |
(C++20)(C++20) | 通知されかつアトミック値が変更されるまでスレッドをブロックします (関数テンプレート) | |
(C++20) | atomic_wait でブロックしているスレッドの1つに通知します (関数テンプレート) | |
(C++20) | atomic_wait でブロックしているすべてのスレッドに通知します (関数テンプレート) | |
(C++20)(C++20) | フラグの値をアトミックに返します (関数) | |
アトミックにフラグを true に設定し、その以前の値を返します (関数) | ||
(C++11)(C++11) | アトミックにフラグの値を false に設定します (関数) | |
(C++20)(C++20) | 通知されかつフラグが変更されるまでスレッドをブロックします (関数) | |
(C++20) | atomic_flag_wait でブロックしているスレッドの1つに通知します (関数) | |
(C++20) | atomic_flag_wait でブロックしているすべてのスレッドに通知します (関数) | |
(C++11)(C++20で非推奨) | デフォルト構築されたアトミックオブジェクトの非アトミックな初期化を行います (関数テンプレート) | |
(C++11) | std::memory_order_consume の依存関係ツリーから指定されたオブジェクトを削除します (関数テンプレート) | |
(C++11) | 汎用のメモリ順序依存関係のフェンス同期プリミティブ (関数) | |
(C++11) | 同じスレッドで実行されるシグナルハンドラとの間のフェンス (関数) | |
プリプロセッサマクロ | ||
(C++11)(C++20で非推奨) | 静的記憶域期間のアトミック変数の定数初期化 (関数マクロ) | |
(C++11)(C++20で非推奨) | std::atomic_flag を false に初期化します (マクロ定数) |
[編集]概要
namespace std {/* until C++20: typedef enum memory_order { memory_order_relaxed, memory_order_consume, memory_order_acquire, memory_order_release, memory_order_acq_rel, memory_order_seq_cst } memory_order; */ enumclass memory_order :/* unspecified */{ relaxed, consume, acquire, release, acq_rel, seq_cst };inlineconstexpr memory_order memory_order_relaxed = memory_order::relaxed;inlineconstexpr memory_order memory_order_consume = memory_order::consume;inlineconstexpr memory_order memory_order_acquire = memory_order::acquire;inlineconstexpr memory_order memory_order_release = memory_order::release;inlineconstexpr memory_order memory_order_acq_rel = memory_order::acq_rel;inlineconstexpr memory_order memory_order_seq_cst = memory_order::seq_cst; template<class T> T kill_dependency(T y)noexcept; // lock-free property#define ATOMIC_BOOL_LOCK_FREE /* unspecified */#define ATOMIC_CHAR_LOCK_FREE /* unspecified */#define ATOMIC_CHAR8_T_LOCK_FREE /* unspecified */#define ATOMIC_CHAR16_T_LOCK_FREE /* unspecified */#define ATOMIC_CHAR32_T_LOCK_FREE /* unspecified */#define ATOMIC_WCHAR_T_LOCK_FREE /* unspecified */#define ATOMIC_SHORT_LOCK_FREE /* unspecified */#define ATOMIC_INT_LOCK_FREE /* unspecified */#define ATOMIC_LONG_LOCK_FREE /* unspecified */#define ATOMIC_LLONG_LOCK_FREE /* unspecified */#define ATOMIC_POINTER_LOCK_FREE /* unspecified */ // class template atomic_reftemplate<class T>struct atomic_ref;// partial specialization for pointerstemplate<class T>struct atomic_ref<T*>; // class template atomictemplate<class T>struct atomic;// partial specialization for pointerstemplate<class T>struct atomic<T*>; // non-member functionstemplate<class T>bool atomic_is_lock_free(constvolatile atomic<T>*)noexcept;template<class T>bool atomic_is_lock_free(const atomic<T>*)noexcept;template<class T>void atomic_store(volatile atomic<T>*, typename atomic<T>::value_type)noexcept;template<class T>void atomic_store(atomic<T>*, typename atomic<T>::value_type)noexcept;template<class T>void atomic_store_explicit(volatile atomic<T>*, typename atomic<T>::value_type, memory_order)noexcept;template<class T>void atomic_store_explicit(atomic<T>*, typename atomic<T>::value_type, memory_order)noexcept;template<class T> T atomic_load(constvolatile atomic<T>*)noexcept;template<class T> T atomic_load(const atomic<T>*)noexcept;template<class T> T atomic_load_explicit(constvolatile atomic<T>*, memory_order)noexcept;template<class T> T atomic_load_explicit(const atomic<T>*, memory_order)noexcept;template<class T> T atomic_exchange(volatile atomic<T>*, typename atomic<T>::value_type)noexcept;template<class T> T atomic_exchange(atomic<T>*, typename atomic<T>::value_type)noexcept;template<class T> T atomic_exchange_explicit(volatile atomic<T>*, typename atomic<T>::value_type, memory_order)noexcept;template<class T> T atomic_exchange_explicit(atomic<T>*, typename atomic<T>::value_type, memory_order)noexcept;template<class T>bool atomic_compare_exchange_weak(volatile atomic<T>*, typename atomic<T>::value_type*, typename atomic<T>::value_type)noexcept;template<class T>bool atomic_compare_exchange_weak(atomic<T>*, typename atomic<T>::value_type*, typename atomic<T>::value_type)noexcept;template<class T>bool atomic_compare_exchange_strong(volatile atomic<T>*, typename atomic<T>::value_type*, typename atomic<T>::value_type)noexcept;template<class T>bool atomic_compare_exchange_strong(atomic<T>*, typename atomic<T>::value_type*, typename atomic<T>::value_type)noexcept;template<class T>bool atomic_compare_exchange_weak_explicit(volatile atomic<T>*, typename atomic<T>::value_type*, typename atomic<T>::value_type, memory_order, memory_order)noexcept;template<class T>bool atomic_compare_exchange_weak_explicit(atomic<T>*, typename atomic<T>::value_type*, typename atomic<T>::value_type, memory_order, memory_order)noexcept;template<class T>bool atomic_compare_exchange_strong_explicit(volatile atomic<T>*, typename atomic<T>::value_type*, typename atomic<T>::value_type, memory_order, memory_order)noexcept;template<class T>bool atomic_compare_exchange_strong_explicit(atomic<T>*, typename atomic<T>::value_type*, typename atomic<T>::value_type, memory_order, memory_order)noexcept; template<class T> T atomic_fetch_add(volatile atomic<T>*, typename atomic<T>::difference_type)noexcept;template<class T> T atomic_fetch_add(atomic<T>*, typename atomic<T>::difference_type)noexcept;template<class T> T atomic_fetch_add_explicit(volatile atomic<T>*, typename atomic<T>::difference_type, memory_order)noexcept;template<class T> T atomic_fetch_add_explicit(atomic<T>*, typename atomic<T>::difference_type, memory_order)noexcept;template<class T> T atomic_fetch_sub(volatile atomic<T>*, typename atomic<T>::difference_type)noexcept;template<class T> T atomic_fetch_sub(atomic<T>*, typename atomic<T>::difference_type)noexcept;template<class T> T atomic_fetch_sub_explicit(volatile atomic<T>*, typename atomic<T>::difference_type, memory_order)noexcept;template<class T> T atomic_fetch_sub_explicit(atomic<T>*, typename atomic<T>::difference_type, memory_order)noexcept;template<class T> T atomic_fetch_and(volatile atomic<T>*, typename atomic<T>::value_type)noexcept;template<class T> T atomic_fetch_and(atomic<T>*, typename atomic<T>::value_type)noexcept;template<class T> T atomic_fetch_and_explicit(volatile atomic<T>*, typename atomic<T>::value_type, memory_order)noexcept;template<class T> T atomic_fetch_and_explicit(atomic<T>*, typename atomic<T>::value_type, memory_order)noexcept;template<class T> T atomic_fetch_or(volatile atomic<T>*, typename atomic<T>::value_type)noexcept;template<class T> T atomic_fetch_or(atomic<T>*, typename atomic<T>::value_type)noexcept;template<class T> T atomic_fetch_or_explicit(volatile atomic<T>*, typename atomic<T>::value_type, memory_order)noexcept;template<class T> T atomic_fetch_or_explicit(atomic<T>*, typename atomic<T>::value_type, memory_order)noexcept;template<class T> T atomic_fetch_xor(volatile atomic<T>*, typename atomic<T>::value_type)noexcept;template<class T> T atomic_fetch_xor(atomic<T>*, typename atomic<T>::value_type)noexcept;template<class T> T atomic_fetch_xor_explicit(volatile atomic<T>*, typename atomic<T>::value_type, memory_order)noexcept;template<class T> T atomic_fetch_xor_explicit(atomic<T>*, typename atomic<T>::value_type, memory_order)noexcept; template<class T>void atomic_wait(constvolatile atomic<T>*, typename atomic<T>::value_type);template<class T>void atomic_wait(const atomic<T>*, typename atomic<T>::value_type);template<class T>void atomic_wait_explicit(constvolatile atomic<T>*, typename atomic<T>::value_type, memory_order);template<class T>void atomic_wait_explicit(const atomic<T>*, typename atomic<T>::value_type, memory_order);template<class T>void atomic_notify_one(volatile atomic<T>*);template<class T>void atomic_notify_one(atomic<T>*);template<class T>void atomic_notify_all(volatile atomic<T>*);template<class T>void atomic_notify_all(atomic<T>*); // type aliasesusing atomic_bool = atomic<bool>;using atomic_char = atomic<char>;using atomic_schar = atomic<signedchar>;using atomic_uchar = atomic<unsignedchar>;using atomic_short = atomic<short>;using atomic_ushort = atomic<unsignedshort>;using atomic_int = atomic<int>;using atomic_uint = atomic<unsignedint>;using atomic_long = atomic<long>;using atomic_ulong = atomic<unsignedlong>;using atomic_llong = atomic<longlong>;using atomic_ullong = atomic<unsignedlonglong>;using atomic_char8_t = atomic<char8_t>;using atomic_char16_t = atomic<char16_t>;using atomic_char32_t = atomic<char32_t>;using atomic_wchar_t = atomic<wchar_t>; using atomic_int8_t = atomic<int8_t>;using atomic_uint8_t = atomic<uint8_t>;using atomic_int16_t = atomic<int16_t>;using atomic_uint16_t = atomic<uint16_t>;using atomic_int32_t = atomic<int32_t>;using atomic_uint32_t = atomic<uint32_t>;using atomic_int64_t = atomic<int64_t>;using atomic_uint64_t = atomic<uint64_t>; using atomic_int_least8_t = atomic<int_least8_t>;using atomic_uint_least8_t = atomic<uint_least8_t>;using atomic_int_least16_t = atomic<int_least16_t>;using atomic_uint_least16_t = atomic<uint_least16_t>;using atomic_int_least32_t = atomic<int_least32_t>;using atomic_uint_least32_t = atomic<uint_least32_t>;using atomic_int_least64_t = atomic<int_least64_t>;using atomic_uint_least64_t = atomic<uint_least64_t>; using atomic_int_fast8_t = atomic<int_fast8_t>;using atomic_uint_fast8_t = atomic<uint_fast8_t>;using atomic_int_fast16_t = atomic<int_fast16_t>;using atomic_uint_fast16_t = atomic<uint_fast16_t>;using atomic_int_fast32_t = atomic<int_fast32_t>;using atomic_uint_fast32_t = atomic<uint_fast32_t>;using atomic_int_fast64_t = atomic<int_fast64_t>;using atomic_uint_fast64_t = atomic<uint_fast64_t>; using atomic_intptr_t = atomic<intptr_t>;using atomic_uintptr_t = atomic<uintptr_t>;using atomic_size_t = atomic<size_t>;using atomic_ptrdiff_t = atomic<ptrdiff_t>;using atomic_intmax_t = atomic<intmax_t>;using atomic_uintmax_t = atomic<uintmax_t>; using atomic_signed_lock_free =/* see description */;using atomic_unsigned_lock_free =/* see description */; // flag type and operationsstruct atomic_flag; bool atomic_flag_test(constvolatile atomic_flag*)noexcept;bool atomic_flag_test(const atomic_flag*)noexcept;bool atomic_flag_test_explicit(constvolatile atomic_flag*, memory_order)noexcept;bool atomic_flag_test_explicit(const atomic_flag*, memory_order)noexcept;bool atomic_flag_test_and_set(volatile atomic_flag*)noexcept;bool atomic_flag_test_and_set(atomic_flag*)noexcept;bool atomic_flag_test_and_set_explicit(volatile atomic_flag*, memory_order)noexcept;bool atomic_flag_test_and_set_explicit(atomic_flag*, memory_order)noexcept;void atomic_flag_clear(volatile atomic_flag*)noexcept;void atomic_flag_clear(atomic_flag*)noexcept;void atomic_flag_clear_explicit(volatile atomic_flag*, memory_order)noexcept;void atomic_flag_clear_explicit(atomic_flag*, memory_order)noexcept; void atomic_flag_wait(constvolatile atomic_flag*, bool)noexcept;void atomic_flag_wait(const atomic_flag*, bool)noexcept;void atomic_flag_wait_explicit(constvolatile atomic_flag*, bool, memory_order)noexcept;void atomic_flag_wait_explicit(const atomic_flag*, bool, memory_order)noexcept;void atomic_flag_notify_one(volatile atomic_flag*)noexcept;void atomic_flag_notify_one(atomic_flag*)noexcept;void atomic_flag_notify_all(volatile atomic_flag*)noexcept;void atomic_flag_notify_all(atomic_flag*)noexcept; // fencesextern"C"void atomic_thread_fence(memory_order)noexcept;extern"C"void atomic_signal_fence(memory_order)noexcept;}// deprecatednamespace std {template<class T>void atomic_init(volatile atomic<T>*, typename atomic<T>::value_type)noexcept;template<class T>void atomic_init(atomic<T>*, typename atomic<T>::value_type)noexcept; #define ATOMIC_VAR_INIT(value) /* see description */ #define ATOMIC_FLAG_INIT /* see description */}
[編集]クラステンプレート std::atomic
namespace std {template<class T>struct atomic {using value_type = T; staticconstexprbool is_always_lock_free =/* implementation-defined */;bool is_lock_free()constvolatilenoexcept;bool is_lock_free()constnoexcept; // operations on atomic typesconstexpr atomic()noexcept(is_nothrow_default_constructible_v<T>);constexpr atomic(T)noexcept; atomic(const atomic&)= delete; atomic& operator=(const atomic&)= delete; atomic& operator=(const atomic&)volatile= delete; T load(memory_order = memory_order::seq_cst)constvolatilenoexcept; T load(memory_order = memory_order::seq_cst)constnoexcept; operator T()constvolatilenoexcept; operator T()constnoexcept;void store(T, memory_order = memory_order::seq_cst)volatilenoexcept;void store(T, memory_order = memory_order::seq_cst)noexcept; T operator=(T)volatilenoexcept; T operator=(T)noexcept; T exchange(T, memory_order = memory_order::seq_cst)volatilenoexcept; T exchange(T, memory_order = memory_order::seq_cst)noexcept;bool compare_exchange_weak(T&, T, memory_order, memory_order)volatilenoexcept;bool compare_exchange_weak(T&, T, memory_order, memory_order)noexcept;bool compare_exchange_strong(T&, T, memory_order, memory_order)volatilenoexcept;bool compare_exchange_strong(T&, T, memory_order, memory_order)noexcept;bool compare_exchange_weak(T&, T, memory_order = memory_order::seq_cst)volatilenoexcept;bool compare_exchange_weak(T&, T, memory_order = memory_order::seq_cst)noexcept;bool compare_exchange_strong(T&, T, memory_order = memory_order::seq_cst)volatilenoexcept;bool compare_exchange_strong(T&, T, memory_order = memory_order::seq_cst)noexcept; void wait(T, memory_order = memory_order::seq_cst)constvolatilenoexcept;void wait(T, memory_order = memory_order::seq_cst)constnoexcept;void notify_one()volatilenoexcept;void notify_one()noexcept;void notify_all()volatilenoexcept;void notify_all()noexcept;};}
[編集]整数型に対する std::atomic の特殊化
namespace std {template<>struct atomic</* integral */>{using value_type =/* integral */;using difference_type = value_type; staticconstexprbool is_always_lock_free =/* implementation-defined */;bool is_lock_free()constvolatilenoexcept;bool is_lock_free()constnoexcept; constexpr atomic()noexcept;constexpr atomic(/* integral */)noexcept; atomic(const atomic&)= delete; atomic& operator=(const atomic&)= delete; atomic& operator=(const atomic&)volatile= delete; void store(/* integral */, memory_order = memory_order::seq_cst)volatilenoexcept;void store(/* integral */, memory_order = memory_order::seq_cst)noexcept;/* integral */ operator=(/* integral */)volatilenoexcept;/* integral */ operator=(/* integral */)noexcept;/* integral */ load(memory_order = memory_order::seq_cst)constvolatilenoexcept;/* integral */ load(memory_order = memory_order::seq_cst)constnoexcept; operator /* integral */()constvolatilenoexcept; operator /* integral */()constnoexcept; /* integral */ exchange(/* integral */, memory_order = memory_order::seq_cst)volatilenoexcept;/* integral */ exchange(/* integral */, memory_order = memory_order::seq_cst)noexcept;bool compare_exchange_weak(/* integral */&, /* integral */, memory_order, memory_order)volatilenoexcept;bool compare_exchange_weak(/* integral */&, /* integral */, memory_order, memory_order)noexcept;bool compare_exchange_strong(/* integral */&, /* integral */, memory_order, memory_order)volatilenoexcept;bool compare_exchange_strong(/* integral */&, /* integral */, memory_order, memory_order)noexcept;bool compare_exchange_weak(/* integral */&, /* integral */, memory_order = memory_order::seq_cst)volatilenoexcept;bool compare_exchange_weak(/* integral */&, /* integral */, memory_order = memory_order::seq_cst)noexcept;bool compare_exchange_strong(/* integral */&, /* integral */, memory_order = memory_order::seq_cst)volatilenoexcept;bool compare_exchange_strong(/* integral */&, /* integral */, memory_order = memory_order::seq_cst)noexcept; /* integral */ fetch_add(/* integral */, memory_order = memory_order::seq_cst)volatilenoexcept;/* integral */ fetch_add(/* integral */, memory_order = memory_order::seq_cst)noexcept;/* integral */ fetch_sub(/* integral */, memory_order = memory_order::seq_cst)volatilenoexcept;/* integral */ fetch_sub(/* integral */, memory_order = memory_order::seq_cst)noexcept;/* integral */ fetch_and(/* integral */, memory_order = memory_order::seq_cst)volatilenoexcept;/* integral */ fetch_and(/* integral */, memory_order = memory_order::seq_cst)noexcept;/* integral */ fetch_or(/* integral */, memory_order = memory_order::seq_cst)volatilenoexcept;/* integral */ fetch_or(/* integral */, memory_order = memory_order::seq_cst)noexcept;/* integral */ fetch_xor(/* integral */, memory_order = memory_order::seq_cst)volatilenoexcept;/* integral */ fetch_xor(/* integral */, memory_order = memory_order::seq_cst)noexcept; /* integral */ operator++(int)volatilenoexcept;/* integral */ operator++(int)noexcept;/* integral */ operator--(int)volatilenoexcept;/* integral */ operator--(int)noexcept;/* integral */ operator++()volatilenoexcept;/* integral */ operator++()noexcept;/* integral */ operator--()volatilenoexcept;/* integral */ operator--()noexcept;/* integral */ operator+=(/* integral */)volatilenoexcept;/* integral */ operator+=(/* integral */)noexcept;/* integral */ operator-=(/* integral */)volatilenoexcept;/* integral */ operator-=(/* integral */)noexcept;/* integral */ operator&=(/* integral */)volatilenoexcept;/* integral */ operator&=(/* integral */)noexcept;/* integral */ operator|=(/* integral */)volatilenoexcept;/* integral */ operator|=(/* integral */)noexcept;/* integral */ operator^=(/* integral */)volatilenoexcept;/* integral */ operator^=(/* integral */)noexcept; void wait(/* integral */, memory_order = memory_order::seq_cst)constvolatilenoexcept;void wait(/* integral */, memory_order = memory_order::seq_cst)constnoexcept;void notify_one()volatilenoexcept;void notify_one()noexcept;void notify_all()volatilenoexcept;void notify_all()noexcept;};}
[編集]浮動小数点型に対する std::atomic の特殊化
namespace std {template<>struct atomic</* floating-point */>{using value_type =/* floating-point */;using difference_type = value_type; staticconstexprbool is_always_lock_free =/* implementation-defined */;bool is_lock_free()constvolatilenoexcept;bool is_lock_free()constnoexcept; constexpr atomic()noexcept;constexpr atomic(/* floating-point */)noexcept; atomic(const atomic&)= delete; atomic& operator=(const atomic&)= delete; atomic& operator=(const atomic&)volatile= delete; void store(/* floating-point */, memory_order = memory_order_seq_cst)volatilenoexcept;void store(/* floating-point */, memory_order = memory_order_seq_cst)noexcept;/* floating-point */ operator=(/* floating-point */)volatilenoexcept;/* floating-point */ operator=(/* floating-point */)noexcept;/* floating-point */ load(memory_order = memory_order_seq_cst)volatilenoexcept;/* floating-point */ load(memory_order = memory_order_seq_cst)noexcept; operator /* floating-point */()volatilenoexcept; operator /* floating-point */()noexcept; /* floating-point */ exchange(/* floating-point */, memory_order = memory_order_seq_cst)volatilenoexcept;/* floating-point */ exchange(/* floating-point */, memory_order = memory_order_seq_cst)noexcept;bool compare_exchange_weak(/* floating-point */&, /* floating-point */, memory_order, memory_order)volatilenoexcept;bool compare_exchange_weak(/* floating-point */&, /* floating-point */, memory_order, memory_order)noexcept;bool compare_exchange_strong(/* floating-point */&, /* floating-point */, memory_order, memory_order)volatilenoexcept;bool compare_exchange_strong(/* floating-point */&, /* floating-point */, memory_order, memory_order)noexcept;bool compare_exchange_weak(/* floating-point */&, /* floating-point */, memory_order = memory_order_seq_cst)volatilenoexcept;bool compare_exchange_weak(/* floating-point */&, /* floating-point */, memory_order = memory_order_seq_cst)noexcept;bool compare_exchange_strong(/* floating-point */&, /* floating-point */, memory_order = memory_order_seq_cst)volatilenoexcept;bool compare_exchange_strong(/* floating-point */&, /* floating-point */, memory_order = memory_order_seq_cst)noexcept; /* floating-point */ fetch_add(/* floating-point */, memory_order = memory_order_seq_cst)volatilenoexcept;/* floating-point */ fetch_add(/* floating-point */, memory_order = memory_order_seq_cst)noexcept;/* floating-point */ fetch_sub(/* floating-point */, memory_order = memory_order_seq_cst)volatilenoexcept;/* floating-point */ fetch_sub(/* floating-point */, memory_order = memory_order_seq_cst)noexcept; /* floating-point */ operator+=(/* floating-point */)volatilenoexcept;/* floating-point */ operator+=(/* floating-point */)noexcept;/* floating-point */ operator-=(/* floating-point */)volatilenoexcept;/* floating-point */ operator-=(/* floating-point */)noexcept; void wait(/* floating-point */, memory_order = memory_order::seq_cst)constvolatilenoexcept;void wait(/* floating-point */, memory_order = memory_order::seq_cst)constnoexcept;void notify_one()volatilenoexcept;void notify_one()noexcept;void notify_all()volatilenoexcept;void notify_all()noexcept;};}
[編集]ポインタ型に対する std::atomic の特殊化
namespace std {template<class T>struct atomic<T*>{using value_type = T*;using difference_type = ptrdiff_t; staticconstexprbool is_always_lock_free =/* implementation-defined */;bool is_lock_free()constvolatilenoexcept;bool is_lock_free()constnoexcept; constexpr atomic()noexcept;constexpr atomic(T*)noexcept; atomic(const atomic&)= delete; atomic& operator=(const atomic&)= delete; atomic& operator=(const atomic&)volatile= delete; void store(T*, memory_order = memory_order::seq_cst)volatilenoexcept;void store(T*, memory_order = memory_order::seq_cst)noexcept; T* operator=(T*)volatilenoexcept; T* operator=(T*)noexcept; T* load(memory_order = memory_order::seq_cst)constvolatilenoexcept; T* load(memory_order = memory_order::seq_cst)constnoexcept; operator T*()constvolatilenoexcept; operator T*()constnoexcept; T* exchange(T*, memory_order = memory_order::seq_cst)volatilenoexcept; T* exchange(T*, memory_order = memory_order::seq_cst)noexcept;bool compare_exchange_weak(T*&, T*, memory_order, memory_order)volatilenoexcept;bool compare_exchange_weak(T*&, T*, memory_order, memory_order)noexcept;bool compare_exchange_strong(T*&, T*, memory_order, memory_order)volatilenoexcept;bool compare_exchange_strong(T*&, T*, memory_order, memory_order)noexcept;bool compare_exchange_weak(T*&, T*, memory_order = memory_order::seq_cst)volatilenoexcept;bool compare_exchange_weak(T*&, T*, memory_order = memory_order::seq_cst)noexcept;bool compare_exchange_strong(T*&, T*, memory_order = memory_order::seq_cst)volatilenoexcept;bool compare_exchange_strong(T*&, T*, memory_order = memory_order::seq_cst)noexcept; T* fetch_add(ptrdiff_t, memory_order = memory_order::seq_cst)volatilenoexcept; T* fetch_add(ptrdiff_t, memory_order = memory_order::seq_cst)noexcept; T* fetch_sub(ptrdiff_t, memory_order = memory_order::seq_cst)volatilenoexcept; T* fetch_sub(ptrdiff_t, memory_order = memory_order::seq_cst)noexcept; T* operator++(int)volatilenoexcept; T* operator++(int)noexcept; T* operator--(int)volatilenoexcept; T* operator--(int)noexcept; T* operator++()volatilenoexcept; T* operator++()noexcept; T* operator--()volatilenoexcept; T* operator--()noexcept; T* operator+=(ptrdiff_t)volatilenoexcept; T* operator+=(ptrdiff_t)noexcept; T* operator-=(ptrdiff_t)volatilenoexcept; T* operator-=(ptrdiff_t)noexcept; void wait(T*, memory_order = memory_order::seq_cst)constvolatilenoexcept;void wait(T*, memory_order = memory_order::seq_cst)constnoexcept;void notify_one()volatilenoexcept;void notify_one()noexcept;void notify_all()volatilenoexcept;void notify_all()noexcept;};}
[編集]クラステンプレート std::atomic_ref
namespace std {template<class T>struct atomic_ref {private: T* ptr;// exposition onlypublic:using value_type = T;staticconstexpr size_t required_alignment =/* implementation-defined */; staticconstexprbool is_always_lock_free =/* implementation-defined */;bool is_lock_free()constnoexcept; explicit atomic_ref(T&); atomic_ref(const atomic_ref&)noexcept; atomic_ref& operator=(const atomic_ref&)= delete; void store(T, memory_order = memory_order_seq_cst)constnoexcept; T operator=(T)constnoexcept; T load(memory_order = memory_order_seq_cst)constnoexcept; operator T()constnoexcept; T exchange(T, memory_order = memory_order_seq_cst)constnoexcept;bool compare_exchange_weak(T&, T, memory_order, memory_order)constnoexcept;bool compare_exchange_strong(T&, T, memory_order, memory_order)constnoexcept;bool compare_exchange_weak(T&, T, memory_order = memory_order_seq_cst)constnoexcept;bool compare_exchange_strong(T&, T, memory_order = memory_order_seq_cst)constnoexcept; void wait(T, memory_order = memory_order::seq_cst)constnoexcept;void notify_one()constnoexcept;void notify_all()constnoexcept;};}
[編集]整数型に対する std::atomic_ref の特殊化
namespace std {template<>struct atomic_ref</* integral */>{private:/* integral */* ptr;// exposition onlypublic:using value_type =/* integral */;using difference_type = value_type;staticconstexpr size_t required_alignment =/* implementation-defined */; staticconstexprbool is_always_lock_free =/* implementation-defined */;bool is_lock_free()constnoexcept; explicit atomic_ref(/* integral */&); atomic_ref(const atomic_ref&)noexcept; atomic_ref& operator=(const atomic_ref&)= delete; void store(/* integral */, memory_order = memory_order_seq_cst)constnoexcept;/* integral */ operator=(/* integral */)constnoexcept;/* integral */ load(memory_order = memory_order_seq_cst)constnoexcept; operator /* integral */()constnoexcept; /* integral */ exchange(/* integral */, memory_order = memory_order_seq_cst)constnoexcept;bool compare_exchange_weak(/* integral */&, /* integral */, memory_order, memory_order)constnoexcept;bool compare_exchange_strong(/* integral */&, /* integral */, memory_order, memory_order)constnoexcept;bool compare_exchange_weak(/* integral */&, /* integral */, memory_order = memory_order_seq_cst)constnoexcept;bool compare_exchange_strong(/* integral */&, /* integral */, memory_order = memory_order_seq_cst)constnoexcept; /* integral */ fetch_add(/* integral */, memory_order = memory_order_seq_cst)constnoexcept;/* integral */ fetch_sub(/* integral */, memory_order = memory_order_seq_cst)constnoexcept;/* integral */ fetch_and(/* integral */, memory_order = memory_order_seq_cst)constnoexcept;/* integral */ fetch_or(/* integral */, memory_order = memory_order_seq_cst)constnoexcept;/* integral */ fetch_xor(/* integral */, memory_order = memory_order_seq_cst)constnoexcept; /* integral */ operator++(int)constnoexcept;/* integral */ operator--(int)constnoexcept;/* integral */ operator++()constnoexcept;/* integral */ operator--()constnoexcept;/* integral */ operator+=(/* integral */)constnoexcept;/* integral */ operator-=(/* integral */)constnoexcept;/* integral */ operator&=(/* integral */)constnoexcept;/* integral */ operator
[編集]浮動小数点型に対する std::atomic_ref の特殊化
namespace std {template<>struct atomic_ref</* floating-point */>{private:/* floating-point */* ptr;// exposition onlypublic:using value_type =/* floating-point */;using difference_type = value_type;staticconstexpr size_t required_alignment =/* implementation-defined */; staticconstexprbool is_always_lock_free =/* implementation-defined */;bool is_lock_free()constnoexcept; explicit atomic_ref(/* floating-point */&); atomic_ref(const atomic_ref&)noexcept; atomic_ref& operator=(const atomic_ref&)= delete; void store(/* floating-point */, memory_order = memory_order_seq_cst)constnoexcept;/* floating-point */ operator=(/* floating-point */)constnoexcept;/* floating-point */ load(memory_order = memory_order_seq_cst)constnoexcept; operator /* floating-point */()constnoexcept; /* floating-point */ exchange(/* floating-point */, memory_order = memory_order_seq_cst)constnoexcept;bool compare_exchange_weak(/* floating-point */&, /* floating-point */, memory_order, memory_order)constnoexcept;bool compare_exchange_strong(/* floating-point */&, /* floating-point */, memory_order, memory_order)constnoexcept;bool compare_exchange_weak(/* floating-point */&, /* floating-point */, memory_order = memory_order_seq_cst)constnoexcept;bool compare_exchange_strong(/* floating-point */&, /* floating-point */, memory_order = memory_order_seq_cst)constnoexcept; /* floating-point */ fetch_add(/* floating-point */, memory_order = memory_order_seq_cst)constnoexcept;/* floating-point */ fetch_sub(/* floating-point */, memory_order = memory_order_seq_cst)constnoexcept; /* floating-point */ operator+=(/* floating-point */)constnoexcept;/* floating-point */ operator-=(/* floating-point */)constnoexcept; void wait(/* floating-point */, memory_order = memory_order::seq_cst)constnoexcept;void notify_one()constnoexcept;void notify_all()constnoexcept;};}
[編集]ポインタ型に対する std::atomic_ref の特殊化
namespace std {template<class T>struct atomic_ref<T*>{private: T** ptr;// exposition onlypublic:using value_type = T*;using difference_type = ptrdiff_t;staticconstexpr size_t required_alignment =/* implementation-defined */; staticconstexprbool is_always_lock_free =/* implementation-defined */;bool is_lock_free()constnoexcept; explicit atomic_ref(T*&); atomic_ref(const atomic_ref&)noexcept; atomic_ref& operator=(const atomic_ref&)= delete; void store(T*, memory_order = memory_order_seq_cst)constnoexcept; T* operator=(T*)constnoexcept; T* load(memory_order = memory_order_seq_cst)constnoexcept; operator T*()constnoexcept; T* exchange(T*, memory_order = memory_order_seq_cst)constnoexcept;bool compare_exchange_weak(T*&, T*, memory_order, memory_order)constnoexcept;bool compare_exchange_strong(T*&, T*, memory_order, memory_order)constnoexcept;bool compare_exchange_weak(T*&, T*, memory_order = memory_order_seq_cst)constnoexcept;bool compare_exchange_strong(T*&, T*, memory_order = memory_order_seq_cst)constnoexcept; T* fetch_add(difference_type, memory_order = memory_order_seq_cst)constnoexcept; T* fetch_sub(difference_type, memory_order = memory_order_seq_cst)constnoexcept; T* operator++(int)constnoexcept; T* operator--(int)constnoexcept; T* operator++()constnoexcept; T* operator--()constnoexcept; T* operator+=(difference_type)constnoexcept; T* operator-=(difference_type)constnoexcept; void wait(T*, memory_order = memory_order::seq_cst)constnoexcept;void notify_one()constnoexcept;void notify_all()constnoexcept;};}
[編集]クラス std::atomic_flag
namespace std {struct atomic_flag {constexpr atomic_flag()noexcept; atomic_flag(const atomic_flag&)= delete; atomic_flag& operator=(const atomic_flag&)= delete; atomic_flag& operator=(const atomic_flag&)volatile= delete; bool test(memory_order = memory_order::seq_cst)constvolatilenoexcept;bool test(memory_order = memory_order::seq_cst)constnoexcept;bool test_and_set(memory_order = memory_order::seq_cst)volatilenoexcept;bool test_and_set(memory_order = memory_order::seq_cst)noexcept;void clear(memory_order = memory_order::seq_cst)volatilenoexcept;void clear(memory_order = memory_order::seq_cst)noexcept; void wait(bool, memory_order = memory_order::seq_cst)constvolatilenoexcept;void wait(bool, memory_order = memory_order::seq_cst)constnoexcept;void notify_one()volatilenoexcept;void notify_one()noexcept;void notify_all()volatilenoexcept;void notify_all()noexcept;};}