Namespaces
Variants

std::atomic_ref<T>:: fetch_min

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
T cv bool 以外の整数型またはオブジェクトポインタ型の場合にのみ提供される
value_type fetch_min ( value_type arg,

std:: memory_order order =

std:: memory_order_seq_cst ) const noexcept ;
(C++26以降)

参照先オブジェクトの現在値を、その値と arg std::min の結果で原子的に置き換えます。つまり、アトミックな最小値演算を実行します。この操作は読み取り-修正-書き込み操作です。メモリへの影響は order の値に従って決定されます。

T がポインタ型であり、ポインタが異なる完全オブジェクト(またはその部分オブジェクト)を指している場合、 ポインタ比較 strict weak ordering を確立しません。

このオーバーロードは、 std:: is_const_v < T > false の場合にのみ、オーバーロード解決に参加します。

目次

パラメータ

arg - std::min のもう一方の引数
order - 適用するメモリ順序制約

戻り値

この関数の効果が適用される直前の値、 modification order における * this の値。

注記

機能テスト マクロ 標準 機能
__cpp_lib_atomic_min_max 202403L (C++26) アトミック最小値/最大値