Atomic: Add operators += and -=

This commit is contained in:
apio 2022-12-17 10:49:19 +01:00
parent 9d6235e109
commit 14461c6fe8
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -103,6 +103,16 @@ template <typename T> class Atomic
return fetch_sub(1); 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: private:
T m_value; T m_value;
}; };