Namespaces
Variants

std::atomic_ref<T>:: fetch_xor

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_xor ( value_type arg,

std:: memory_order order =

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

参照先オブジェクトの現在値を、その値と arg のビット単位XOR演算結果で原子的に置き換えます。この操作はread-modify-write操作です。メモリへの影響は order の値に従って決定されます。

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

パラメータ

arg - ビット単位XORのもう一方の引数
order - 適用するメモリ順序制約

戻り値

この関数の効果が適用される直前の、参照先オブジェクトの値。

不具合報告

以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。

DR 適用対象 公開時の動作 正しい動作
LWG 3508
( P3323R1 )
C++20 fetch_xor const T に対して無意味であった non-const T のみを受け入れるように制約