|
constexpr | Optional () noexcept=default |
| Default constructor.
|
|
constexpr | Optional (std::optional< Type > value) noexcept |
| Constructor that initializes the value.
|
|
constexpr | Optional (Type value) noexcept |
| Constructor that initializes the value to a real value.
|
|
constexpr | Optional (std::nullopt_t) noexcept |
| Constructor that initializes the value to std::nullopt.
|
|
auto | operator= (std::optional< Type > value) noexcept -> std::optional< Type > |
| Atomically stores the value using std::memory_order::seq_cst.
|
|
auto | operator= (Type value) noexcept -> std::optional< Type > |
| Atomically stores a real value using std::memory_order::seq_cst.
|
|
auto | operator= (std::nullopt_t) noexcept -> std::optional< Type > |
| Atomically stores an std::nullopt value using std::memory_order::seq_cst.
|
|
| operator std::optional< Type > () const noexcept |
| Atomically loads the value using std::memory_order::seq_cst.
|
|
auto | load () const noexcept -> std::optional< Type > |
| Atomically loads the value.
|
|
auto | load (std::memory_order memoryOrder) const noexcept -> std::optional< Type > |
| Atomically loads the value.
|
|
auto | store (std::optional< Type > value) noexcept -> void |
| Atomically stores the value.
|
|
auto | store (std::optional< Type > value, std::memory_order memoryOrder) noexcept -> void |
| Atomically stores the value.
|
|
auto | store (Type value) noexcept -> void |
| Atomically stores a real value.
|
|
auto | store (Type value, std::memory_order memoryOrder) noexcept -> void |
| Atomically stores a real value.
|
|
auto | store (std::nullopt_t) noexcept -> void |
| Atomically stores an std::nullopt.
|
|
auto | store (std::nullopt_t, std::memory_order memoryOrder) noexcept -> void |
| Atomically stores an std::nullopt.
|
|
auto | exchange (std::optional< Type > newValue) noexcept -> std::optional< Type > |
| Atomically exchanges the value with a new value.
|
|
auto | exchange (std::optional< Type > newValue, std::memory_order memoryOrder) noexcept -> std::optional< Type > |
| Atomically exchanges the value with a new value.
|
|
auto | exchange (Type newValue) noexcept -> std::optional< Type > |
| Atomically exchanges the value with a real value.
|
|
auto | exchange (Type newValue, std::memory_order memoryOrder) noexcept -> std::optional< Type > |
| Atomically exchanges the value with a real value.
|
|
auto | exchange (std::nullopt_t) noexcept -> std::optional< Type > |
| Atomically exchanges the value with an std::nullopt.
|
|
auto | exchange (std::nullopt_t, std::memory_order memoryOrder) noexcept -> std::optional< Type > |
| Atomically exchanges the value with an std::nullopt.
|
|
auto | compare_exchange_weak (std::optional< Type > &expectedValue, std::optional< Type > newValue) noexcept -> bool |
| Conditionally atomically exchanges the value with a new value.
|
|
auto | compare_exchange_weak (std::optional< Type > &expectedValue, std::optional< Type > newValue, std::memory_order memoryOrder) noexcept -> bool |
| Conditionally atomically exchanges the value with a new value.
|
|
auto | compare_exchange_weak (std::optional< Type > &expectedValue, std::optional< Type > newValue, std::memory_order memoryOrderForSuccess, std::memory_order memoryOrderForFailure) noexcept -> bool |
| Conditionally atomically exchanges the value with a new value.
|
|
auto | compare_exchange_weak (std::optional< Type > &expectedValue, Type newValue) noexcept -> bool |
| Conditionally atomically exchanges the value with a real value.
|
|
auto | compare_exchange_weak (std::optional< Type > &expectedValue, Type newValue, std::memory_order memoryOrder) noexcept -> bool |
| Conditionally atomically exchanges the value with a real value.
|
|
auto | compare_exchange_weak (std::optional< Type > &expectedValue, Type newValue, std::memory_order memoryOrderForSuccess, std::memory_order memoryOrderForFailure) noexcept -> bool |
| Conditionally atomically exchanges the value with a real value.
|
|
auto | compare_exchange_weak (std::optional< Type > &expectedValue, std::nullopt_t) noexcept -> bool |
| Conditionally atomically exchanges the value with a new value.
|
|
auto | compare_exchange_weak (std::optional< Type > &expectedValue, std::nullopt_t, std::memory_order memoryOrder) noexcept -> bool |
| Conditionally atomically exchanges the value with a new value.
|
|
auto | compare_exchange_weak (std::optional< Type > &expectedValue, std::nullopt_t, std::memory_order memoryOrderForSuccess, std::memory_order memoryOrderForFailure) noexcept -> bool |
| Conditionally atomically exchanges the value with a new value.
|
|
auto | compare_exchange_strong (std::optional< Type > &expectedValue, std::optional< Type > newValue) noexcept -> bool |
| Conditionally atomically exchanges the value with a new value.
|
|
auto | compare_exchange_strong (std::optional< Type > &expectedValue, std::optional< Type > newValue, std::memory_order memoryOrder) noexcept -> bool |
| Conditionally atomically exchanges the value with a new value.
|
|
auto | compare_exchange_strong (std::optional< Type > &expectedValue, std::optional< Type > newValue, std::memory_order memoryOrderForSuccess, std::memory_order memoryOrderForFailure) noexcept -> bool |
| Conditionally atomically exchanges the value with a new value.
|
|
auto | compare_exchange_strong (std::optional< Type > &expectedValue, Type newValue) noexcept -> bool |
| Conditionally atomically exchanges the value with a real value.
|
|
auto | compare_exchange_strong (std::optional< Type > &expectedValue, Type newValue, std::memory_order memoryOrder) noexcept -> bool |
| Conditionally atomically exchanges the value with a real value.
|
|
auto | compare_exchange_strong (std::optional< Type > &expectedValue, Type newValue, std::memory_order memoryOrderForSuccess, std::memory_order memoryOrderForFailure) noexcept -> bool |
| Conditionally atomically exchanges the value with a real value.
|
|
auto | compare_exchange_strong (std::optional< Type > &expectedValue, std::nullopt_t) noexcept -> bool |
| Conditionally atomically exchanges the value with a new value.
|
|
auto | compare_exchange_strong (std::optional< Type > &expectedValue, std::nullopt_t, std::memory_order memoryOrder) noexcept -> bool |
| Conditionally atomically exchanges the value with a new value.
|
|
auto | compare_exchange_strong (std::optional< Type > &expectedValue, std::nullopt_t, std::memory_order memoryOrderForSuccess, std::memory_order memoryOrderForFailure) noexcept -> bool |
| Conditionally atomically exchanges the value with a new value.
|
|
auto | is_lock_free () const noexcept -> bool |
| Determines whether operations on this object are lock free.
|
|
| Optional (const Optional &)=delete |
| Deleted copy constructor.
|
|
auto | operator= (const Optional &)=delete |
| Deleted assignment opertaor.
|
|
template<typename Type>
class xentara::utils::atomic::Optional< Type >
An atomic version of std::optional.
This class allows defining atomics that operate contain [std::optional]s. Normal [std::atomic]s cannot contain [std::optional]s, because std::optional is not guaranteed to be trivially copyable.
- Requirements:
- Type must be suitable for use in an std::atomic. Additionally Type must be trivially destructible.
- Note
- Atomic optionals for IEEE-754 floating point types (float, double, long double) use a special internal encoding to increase the chance that atomic optionals for these types are lock-free. As a side-effect, atomic::Optional for these types may not preserve the exact encoding of certain special signalling NaN values. This is only relevant if you need to distinguish between different binary encodings of signalling NaNs. The standard signaling NaN returned by std::numeric_limits<Type>::signaling_NaN as well as its negative counterpart are guaranteed to be preserved exactly, however.