Atomic: Add operators += and -=
This commit is contained in:
parent
9d6235e109
commit
14461c6fe8
@ -103,6 +103,16 @@ template <typename T> class Atomic
|
||||
return fetch_sub(1);
|
||||
}
|
||||
|
||||
T operator+=(const T& other)
|
||||
{
|
||||
return fetch_add(other) + other;
|
||||
}
|
||||
|
||||
T operator-=(const T& other)
|
||||
{
|
||||
return fetch_sub(other) - other;
|
||||
}
|
||||
|
||||
private:
|
||||
T m_value;
|
||||
};
|
Loading…
Reference in New Issue
Block a user