|
HikoGUI
A low latency retained GUI
|
#include <hikogui/polymorphic_optional.hpp>
Public Types | |
| using | base_type = BaseType |
| using | pointer = base_type * |
| using | const_pointer = base_type const * |
Public Member Functions | |
| 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. | |
Static Public Attributes | |
| static constexpr std::size_t | capacity = Size - sizeof(std::atomic<pointer>) |
| The maximum size of a value that can be placed inside the buffer of this. | |
| static constexpr std::size_t | alignment = Alignment |
| The alignment of this. | |
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.
| BaseType | The base type of the polymorphic value. |
| Size | Total size of the polymorphic_optional internal storage. |
|
inlinenoexcept |
Invoke a function on the value if it exists then reset.
| func | The function to call with the value as argument if it exists. |
|
inlinenoexcept |
Destroys the contained value, otherwise has no effect.
|
inlinenoexcept |
Wait until the optional is empty, emplace a value, then invoke a function on it before committing.
| Message | The message type derived from value_type to be stored in a free slot. |
| func | The function to invoke on the message created on the fifo. |
| args | The arguments passed to the constructor of Message. |
|
staticconstexpr |
The alignment of this.
|
staticconstexpr |
The maximum size of a value that can be placed inside the buffer of this.