std::atomic_fetch_and, std::atomic_fetch_and_explicit
From cppreference.com
Defined in header <atomic>
|
||
template< class Integral >
Integral atomic_fetch_and( std::atomic<Integral>* obj, Integral arg ); |
(1) | (since C++11) |
template< class Integral >
Integral atomic_fetch_and( volatile std::atomic<Integral>* obj, Integral arg ); |
(2) | (since C++11) |
template< class Integral >
Integral atomic_fetch_and_explicit( std::atomic<Integral>* obj, Integral arg, |
(3) | (since C++11) |
template< class Integral >
Integral atomic_fetch_and_explicit( volatile std::atomic<Integral>* obj, Integral arg, |
(4) | (since C++11) |
1-2) Atomically replaces the value pointed by arg
with the result of bitwise AND between the old value of obj
and arg
, and returns the value obj
held previously, as if by obj->fetch_and(arg)
3-4) Atomically replaces the value pointed by arg
with the result of bitwise AND between the old value of obj
and arg
, and returns the value obj
held previously, as if by obj->fetch_and(arg, order)
Contents |
[edit] Parameters
obj | - | pointer to the atomic object to modify |
arg | - | the value to bitwise AND to the value stored in the atomic object |
order | - | the memory synchronization ordering for this operation: all values are permitted. |
[edit] Return value
The value held previously by the atomic object pointed to by obj
[edit] Exceptions
[edit] Possible implementation
template< class T > typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value, T>::type atomic_fetch_and(std::atomic<T>* obj, T arg); { return obj->fetch_and(arg); } |
[edit] Example
This section is incomplete Reason: no example |
[edit] See also
(C++11)
|
atomically performs bitwise AND between the argument and the value of the atomic object and obtains the value held previously (public member function of std::atomic )
|
(C++11)
(C++11) |
replaces the atomic object with the result of logical OR with a non-atomic argument and obtains the previous value of the atomic (function template) |
(C++11)
(C++11) |
replaces the atomic object with the result of logical XOR with a non-atomic argument and obtains the previous value of the atomic (function template) |