1#ifndef ATOMIC_OPTIONAL_H
2#define ATOMIC_OPTIONAL_H
22 std::atomic<T> mValue;
23 std::atomic<bool> mHasValue;
37 ~AtomicOptional() noexcept = default;
38 AtomicOptional &operator=(const AtomicOptional& other) = delete;
40 AtomicOptional &operator=(T value) noexcept
72 throw std::runtime_error(
"Optional contains no value.");
A wrapper around a possible atomic value.
Definition: atomic_optional.h:20
constexpr AtomicOptional(T value) noexcept
Constructor.
Definition: atomic_optional.h:32
bool HasValue() const noexcept
Indicate whether the instance has an atomic value or not.
Definition: atomic_optional.h:56
T Value() const
Get instance possible non-atomic value.
Definition: atomic_optional.h:64
void Reset() noexcept
Reset the instance atomic value.
Definition: atomic_optional.h:49