|
| | BasicVariant () |
| |
| | BasicVariant (const ALLOC &allocator) |
| |
| template<INDEX I, typename... ARGS, std::enable_if_t<!is_first_allocator_v< ARGS... > > * = nullptr> |
| | BasicVariant (in_place_index_t< I >, ARGS &&... args) |
| |
| template<INDEX I, typename... ARGS> |
| | BasicVariant (in_place_index_t< I >, const ALLOC &allocator, ARGS &&... args) |
| |
| | BasicVariant (const BasicVariant &other) |
| |
| | BasicVariant (const BasicVariant &other, const ALLOC &allocator) |
| |
| BasicVariant & | operator= (const BasicVariant &other) |
| |
| | BasicVariant (BasicVariant &&other) |
| |
| | BasicVariant (BasicVariant &&other, const ALLOC &allocator) |
| |
| | ~BasicVariant ()=default |
| |
| BasicVariant & | operator= (BasicVariant &&other) |
| |
| bool | valueless_by_exception () const noexcept |
| |
| template<INDEX I, typename... ARGS> |
| decltype(auto) | emplace (ARGS &&... args) |
| |
| INDEX | index () const noexcept |
| |
| template<INDEX I, typename U = detail::type_at_t<I, T...>> |
| U * | get_if () noexcept |
| |
| template<INDEX I, typename U = detail::type_at_t<I, T...>> |
| const U * | get_if () const noexcept |
| |
| template<INDEX I, typename U = detail::type_at_t<I, T...>> |
| U & | get () |
| |
| template<INDEX I, typename U = detail::type_at_t<I, T...>> |
| const U & | get () const |
| |
| void | swap (BasicVariant &other) |
| |
| template<typename F > |
| auto | visit (F &&fun) -> decltype(fun(std::declval< detail::type_at_t< 0, T... > >())) |
| |
| template<typename F > |
| auto | visit (F &&fun) const -> decltype(fun(std::declval< detail::type_at_t< 0, T... > >())) |
| |
| bool | operator== (const BasicVariant &other) const |
| |
| bool | operator!= (const BasicVariant &other) const |
| |
| bool | operator< (const BasicVariant &other) const |
| |
| bool | operator> (const BasicVariant &other) const |
| |
| bool | operator<= (const BasicVariant &other) const |
| |
| bool | operator>= (const BasicVariant &other) const |
| |
Implementation of variant type using BasicAny which allocates memory when selected type doesn't fit under 3*sizeof(void*)
Largely compatible with std::variant with following differences:
- access only through index whose type has to be specified (by design)
- supplied INDEX type needs to be convertible to/from size_t and std::variant_npos
- holds_alternative() omitted
- get/get_if() exist as member functions as well
Definition at line 102 of file Variant.h.
Reports if variant is in nonstandard empty state. Note: which operations lead to an empty state is not specified by ISO C++
As an zserio extension, the valueless state can arise after move. This happens only When the held alternative is stored on the heap, and the used allocator is the same in both variants. In that case, the underlying pointer is stolen and the moved-out variant remains in the valueless state.
Definition at line 255 of file Variant.h.