|
constexpr | polymorphic_optional (std::nullopt_t) noexcept |
|
template<std::derived_from< base_type > Other> |
constexpr | polymorphic_optional (std::unique_ptr< Other, std::default_delete< Other > > &&other) noexcept |
|
template<std::derived_from< base_type > Other> |
polymorphic_optional & | operator= (std::unique_ptr< Other, std::default_delete< Other > > &&other) noexcept |
|
template<std::derived_from< base_type > Other> |
| polymorphic_optional (Other &&other) noexcept |
|
template<std::derived_from< base_type > Other>
requires (sizeof(Other) <= capacity and alignof(Other) <= alignment) |
| polymorphic_optional (Other &&other) noexcept |
|
template<std::derived_from< base_type > Other> |
polymorphic_optional & | operator= (Other &&other) noexcept |
|
template<std::derived_from< base_type > Other>
requires (sizeof(Other) <= capacity and alignof(Other) <= alignment) |
polymorphic_optional & | operator= (Other &&other) noexcept |
|
bool | empty (std::memory_order memory_order=std::memory_order::seq_cst) const noexcept |
|
| operator bool () const noexcept |
|
template<typename Value > |
Value & | value (std::memory_order memory_order=std::memory_order::seq_cst) |
|
template<typename Value > |
Value const & | value (std::memory_order memory_order=std::memory_order::seq_cst) const |
|
base_type * | operator-> () noexcept |
|
base_type const * | operator-> () const noexcept |
|
base_type & | operator* () noexcept |
|
base_type const & | operator* () const noexcept |
|
hi_force_inline void | reset () noexcept |
| Destroys the contained value, otherwise has no effect.
|
|
template<typename Value , typename... Args> |
hi_force_inline Value & | emplace (Args &&...args) noexcept |
|
template<typename Func > |
hi_force_inline auto | invoke_and_reset (Func &&func) noexcept |
| Invoke a function on the value if it exists then reset.
|
|
template<typename Value , typename Func , typename... Args> |
hi_force_inline auto | wait_emplace_and_invoke (Func &&func, Args &&...args) noexcept |
| Wait until the optional is empty, emplace a value, then invoke a function on it before committing.
|
|
template<typename BaseType,
std::size_t Size,
std::size_t Alignment = alignof(BaseType)>
class v1::polymorphic_optional< BaseType, Size, Alignment >
Polymorphic optional.
This optional container can hold an polymorphic value.
If the assigned sub-class is larger than the internal buffer the object will be allocated on the heap.
- Template Parameters
-
BaseType | The base type of the polymorphic value. |
Size | Total size of the polymorphic_optional internal storage. |