#pragma once #include #include namespace chatterino { template class Atomic : boost::noncopyable { public: Atomic() { } Atomic(T &&val) : value_(val) { } T get() const { std::lock_guard guard(this->mutex_); return this->value_; } void set(const T &val) { std::lock_guard guard(this->mutex_); this->value_ = val; } void set(T &&val) { std::lock_guard guard(this->mutex_); this->value_ = std::move(val); } private: mutable std::mutex mutex_; T value_; }; } // namespace chatterino