|
constexpr | BasicOptional () noexcept |
|
constexpr | BasicOptional (std::nullopt_t, const ALLOC &allocator={}) noexcept |
|
constexpr | BasicOptional (const T &value, const ALLOC &allocator={}) |
|
constexpr | BasicOptional (T &&value, const ALLOC &allocator={}) |
|
constexpr | BasicOptional (const ALLOC &allocator) |
|
template<typename... ARGS, typename TT = T, std::enable_if_t<!detail::is_optional_heap_allocated_v< TT >> * = nullptr, std::enable_if_t<!is_first_allocator< ARGS... >::value > * = nullptr> |
constexpr | BasicOptional (std::in_place_t, ARGS &&... args) |
|
template<typename... ARGS, typename TT = T, std::enable_if_t<!detail::is_optional_heap_allocated_v< TT >> * = nullptr> |
constexpr | BasicOptional (std::in_place_t, const ALLOC &allocator, ARGS &&... args) |
|
template<typename... ARGS, typename TT = T, std::enable_if_t< detail::is_optional_heap_allocated_v< TT >> * = nullptr> |
constexpr | BasicOptional (std::in_place_t, const ALLOC &allocator, ARGS &&... args) |
|
template<typename... ARGS, typename TT = T, std::enable_if_t< detail::is_optional_heap_allocated_v< TT >> * = nullptr, std::enable_if_t<!is_first_allocator< ARGS... >::value > * = nullptr> |
constexpr | BasicOptional (std::in_place_t, ARGS &&... args) |
|
| ~BasicOptional () |
|
constexpr | BasicOptional (const BasicOptional &other) |
|
template<typename U > |
constexpr | BasicOptional (const BasicOptional< ALLOC, U > &other) |
|
constexpr | BasicOptional (const BasicOptional &other, const ALLOC &allocator) |
|
template<typename A , typename U > |
| BasicOptional (const BasicOptional< A, U > &other, const ALLOC &allocator) |
|
constexpr BasicOptional & | operator= (const BasicOptional &other) |
|
template<typename A , typename U > |
BasicOptional & | operator= (const BasicOptional< A, U > &other) |
|
BasicOptional & | operator= (std::nullopt_t) |
|
template<typename U = T, std::enable_if_t<!detail::is_optional_v< std::decay_t< U >> &&!(std::is_same_v< T, std::decay_t< U >> &&std::is_scalar_v< U >)> * = nullptr> |
BasicOptional & | operator= (U &&value) |
|
| BasicOptional (BasicOptional &&other) |
|
| BasicOptional (BasicOptional &&other, const ALLOC &allocator) |
|
BasicOptional & | operator= (BasicOptional &&other) |
|
constexpr bool | has_value () const noexcept |
|
void | reset () |
|
void | swap (BasicOptional &other) |
|
constexpr | operator bool () const noexcept |
|
template<typename... ARGS> |
T & | emplace (ARGS &&... args) |
|
constexpr T & | value () |
|
constexpr const T & | value () const |
|
T & | operator* () |
|
const T & | operator* () const |
|
T * | operator-> () |
|
const T * | operator-> () const |
|
template<typename U > |
T | value_or (U &&def) |
|
template<typename U > |
T | value_or (U &&def) const |
|
| AllocatorHolder () |
|
| AllocatorHolder (const allocator_type &allocator) |
|
| AllocatorHolder (allocator_type &&allocator) |
|
allocator_type | get_allocator () const |
|
| ~AllocatorHolder ()=default |
|
| AllocatorHolder (const AllocatorHolder &other)=default |
|
AllocatorHolder & | operator= (const AllocatorHolder &other)=default |
|
| AllocatorHolder (AllocatorHolder &&other)=default |
|
AllocatorHolder & | operator= (AllocatorHolder &&other)=default |
|
template<typename ALLOC, typename T>
class zserio::BasicOptional< ALLOC, T >
Implementation of optional type which allocates memory when type
- the type is explicitly tagged with IS_RECURSIVE type OR
- doesn't fit under 3*sizeof(void*)
Largely compatible with std::optional with following differences:
- BasicOptional(U&&) implemented only with T because the required is_constructible constrain can't be used on incomplete types
- operator=(U&&) implemented without is_constructible constrain because that can't be used on incomplete types
- BasicOptional(std::in_place_t, std::initializer_list) not implemented
- Monadic operations from C++23 not implemented
- Conditional noexcept and conditional explicit-ness on certain members not implemented
Definition at line 105 of file Optional.h.
template<typename ALLOC , typename T >
template<typename... ARGS, typename TT = T, std::enable_if_t<!detail::is_optional_heap_allocated_v< TT >> * = nullptr, std::enable_if_t<!is_first_allocator< ARGS... >::value > * = nullptr>
Constructor which constructs the value.
- Parameters
-
in_place | tag to request this constructor. |
args | Arguments to be forwarded for element construction. |
- Exceptions
-
can | throw any exception thrown by T. |
Definition at line 169 of file Optional.h.
template<typename ALLOC , typename T >
template<typename... ARGS, typename TT = T, std::enable_if_t<!detail::is_optional_heap_allocated_v< TT >> * = nullptr>
Constructor which constructs the value.
- Parameters
-
in_place | tag to request this constructor. |
allocator | Allocator to be used. |
args | Arguments to be forwarded for element construction. |
- Exceptions
-
can | throw any exception thrown by T. |
Definition at line 184 of file Optional.h.
template<typename ALLOC , typename T >
template<typename... ARGS, typename TT = T, std::enable_if_t< detail::is_optional_heap_allocated_v< TT >> * = nullptr>
Constructor which constructs the value.
- Parameters
-
in_place | tag to request this constructor. |
allocator | Allocator to be used. |
args | Arguments to be forwarded for element construction. |
- Exceptions
-
can | throw any exception thrown by T. |
Definition at line 200 of file Optional.h.
template<typename ALLOC , typename T >
template<typename... ARGS, typename TT = T, std::enable_if_t< detail::is_optional_heap_allocated_v< TT >> * = nullptr, std::enable_if_t<!is_first_allocator< ARGS... >::value > * = nullptr>
Constructor which constructs the value.
- Parameters
-
in_place | tag to request this constructor. |
args | Arguments to be forwarded for element construction. |
- Exceptions
-
can | throw any exception thrown by T. |
Definition at line 216 of file Optional.h.
template<typename ALLOC , typename T >
template<typename U = T, std::enable_if_t<!detail::is_optional_v< std::decay_t< U >> &&!(std::is_same_v< T, std::decay_t< U >> &&std::is_scalar_v< U >)> * = nullptr>
Value assignment operator.
- Parameters
-
value | The value to be emplaced. |
- Returns
- Reference to this.
Definition at line 349 of file Optional.h.