1 #if !defined(_BTKIMPL_ATOMIC_HPP_) 2 #define _BTKIMPL_ATOMIC_HPP_ 3 #include <SDL2/SDL_atomic.h> 10 SDL_AtomicSet(&value,val);
12 mutable SDL_atomic_t value;
13 Atomic &operator =(
int val){
14 SDL_AtomicSet(&value,val);
18 SDL_AtomicIncRef(&value);
22 SDL_AtomicDecRef(&value);
25 operator int()
const noexcept{
26 return SDL_AtomicGet(&value);
29 Atomic operator +(
int value)
const noexcept{
30 return Atomic(static_cast<int>(*
this) + value);
32 Atomic operator -(
int value)
const noexcept{
33 return Atomic(static_cast<int>(*
this) - value);
35 Atomic operator *(
int value)
const noexcept{
36 return Atomic(static_cast<int>(*
this) * value);
38 Atomic operator /(
int value)
const noexcept{
39 return Atomic(static_cast<int>(*
this) / value);
41 Atomic &operator -=(
int value) noexcept{
42 SDL_AtomicAdd(&(this->value),-value);
45 Atomic &operator +=(
int value) noexcept{
46 SDL_AtomicAdd(&(this->value),value);
52 #endif // _BTKIMPL_ATOMIC_HPP_
This header include many useful containers.
Definition: async.hpp:7