template<
typename T>
struct TAtomicBase_Basic< T >
Definition at line 222 of file Atomic.h.
Compares the element with an expected value and, only if comparison succeeds, assigns the element to a new value. The previous value is copied into Expected in any case.
- Parameters
-
Expected | The value to compare to the element, and will hold the existing value of the element after returning. |
Value | The value to assign, only if Expected matches the element. |
- Returns
- Whether the element compared equal to Expected.
- Note
- It is equivalent to this in non-atomic terms:
bool CompareExchange(T& Expected, T Value) { bool bResult = this->Element == Expected; Expected = this->Element; if (bResult) { this->Element = Value; } return bResult; }
Definition at line 310 of file Atomic.h.