![]() |
Arene Base
Fundamental Utilities For Safety Critical C++
|
Forward declaration of variant. More...

Public Member Functions | |
| template<typename T0 = nth_type<0>, constraints< std::enable_if_t< std::is_default_constructible< T0 >::value > > = nullptr> | |
| variant () noexcept(std::is_nothrow_default_constructible< T0 >::value) | |
| Default constructor, which initializes the variant to a default constructed instance of its 0'th alternative. | |
| variant (copy_ctor_arg const &other) noexcept(arene::base::all_of_v< std::is_nothrow_copy_constructible< Ts >::value... >) | |
| Copy Constructor from another variant of the same alternative types. | |
| variant (dummy_copy_ctor_source const &other)=delete | |
| Copy Constructor from another variant of the same alternative types. | |
| variant (dummy_move_ctor_source &&other)=delete | |
| Move Constructor form another variant. | |
| variant (move_ctor_arg &&other) noexcept(base::all_of_v< std::is_nothrow_move_constructible< Ts >::value... >) | |
| Move Constructor from another variant. | |
| template<typename T, std::size_t I = variant_detail::accepted_index<variant, T>::type::value, typename Tj = nth_type<I>, constraints< std::enable_if_t<!std::is_same< typename std::decay< T >::type, variant >::value >, std::enable_if_t< std::is_constructible< Tj, T >::value > > = nullptr> | |
| variant (T &&value) noexcept(std::is_nothrow_constructible< Tj, T >::value) | |
| Constructor that initializes this variant from one of its alternative types. | |
| ~variant () | |
| Calls the destructor of the alternative type. | |
| template<std::size_t I, typename... Args> | |
| auto | emplace (Args &&... args) noexcept(std::is_nothrow_constructible< nth_type< I >, Args... >::value) -> nth_type< I > & |
| Emplaces a value into the variant by index. | |
| template<typename T, typename... Args> | |
| auto | emplace (Args &&... args) noexcept(std::is_nothrow_constructible< T, Args... >::value) -> T & |
| Emplaces a value into the variant by type. | |
| template<std::size_t I, typename U, typename... Args> | |
| auto | emplace (std::initializer_list< U > init, Args &&... args) noexcept(std::is_nothrow_constructible< nth_type< I >, std::initializer_list< U >, Args... >::value) -> nth_type< I > & |
| Emplaces a value into the variant by index. | |
| template<typename T, typename U, typename... Args> | |
| auto | emplace (std::initializer_list< U > init, Args &&... args) noexcept(std::is_nothrow_constructible< T, std::initializer_list< U >, Args... >::value) -> T & |
| Emplaces a value into the variant by type. | |
| template<std::size_t Index> | |
| auto | get () &&noexcept(!detail::are_exceptions_enabled_v) -> nth_type< Index > && |
| Get the object stored in this variant by the index. | |
| template<typename T> | |
| auto | get () &&noexcept(!detail::are_exceptions_enabled_v) -> T && |
| Get by type. | |
| template<std::size_t Index> | |
| auto | get () &noexcept(!detail::are_exceptions_enabled_v) -> nth_type< Index > & |
| Get the object stored in this variant by the index. | |
| template<typename T> | |
| auto | get () &noexcept(!detail::are_exceptions_enabled_v) -> T & |
| Get by type. | |
| template<std::size_t Index> | |
| auto | get () const &&noexcept(!detail::are_exceptions_enabled_v) -> nth_type< Index > const && |
| Get the object stored in this variant by the index. | |
| template<typename T> | |
| auto | get () const &&noexcept(!detail::are_exceptions_enabled_v) -> T const && |
| Get by type. | |
| template<std::size_t Index> | |
| auto | get () const &noexcept(!detail::are_exceptions_enabled_v) -> nth_type< Index > const & |
| Get the object stored in this variant by the index. | |
| template<typename T> | |
| auto | get () const &noexcept(!detail::are_exceptions_enabled_v) -> T const & |
| Get by type. | |
| auto | index () const noexcept -> std::size_t |
| Get the index of the alternative type that this variant currently holds. | |
| auto | operator= (copy_assignment_arg const &rhs) noexcept(base::all_of_v< std::is_nothrow_copy_constructible< Ts >::value... > &&base::all_of_v< std::is_nothrow_copy_assignable< Ts >::value... >) -> variant & |
| Copy Assignment operator from another variant of the same alternative types. | |
| auto | operator= (dummy_copy_assign_source const &rhs) -> variant &=delete |
| Copy Assignment operator from another variant of the same alternative types. | |
| auto | operator= (dummy_move_assign_source &&rhs) -> variant &=delete |
| Move Assignment operator from another variant of the same alternative types. | |
| auto | operator= (move_assignment_arg &&rhs) noexcept(base::all_of_v< std::is_nothrow_move_constructible< Ts >::value... > &&base::all_of_v< std::is_nothrow_move_assignable< Ts >::value... >) -> variant & |
| Move Assignment operator from another variant of the same alternative types. | |
| constexpr auto | valueless_by_exception () const noexcept -> bool |
| Check if the variant is valueless. | |
Friends | |
| auto | operator< (variant const &lhs, variant const &rhs) noexcept -> bool |
| Less-than comparison. | |
| auto | operator== (variant const &lhs, variant const &rhs) noexcept -> bool |
| Equality comparison. | |
Forward declaration of variant.
a backport of C++17's std::variant
| Ts | the types in the variant |
| Ts | The set of alternatives that can be held by the variant. |
|
inlinenoexcept |
Default constructor, which initializes the variant to a default constructed instance of its 0'th alternative.
Ts is default constructible.
|
inlinenoexcept |
Copy Constructor from another variant of the same alternative types.
If the other variant is valueless, this variant will also be valueless.
Ts is copy constructible. | other | the other variant to copy from |
|
delete |
Copy Constructor from another variant of the same alternative types.
If the other variant is valueless, this variant will also be valueless.
Ts is copy constructible. | other | the other variant to copy from |
|
inlinenoexcept |
Move Constructor from another variant.
If the other variant is valueless, this variant will also be valueless.
Ts is move constructible. | other | the other variant to move from |
|
delete |
Move Constructor form another variant.
If the other variant is valueless, this variant will also be valueless.
Ts is move constructible. | other | the other variant to move from |
|
inlinenoexcept |
Constructor that initializes this variant from one of its alternative types.
This constructor will pick the constructor overload of the alternative type Tj that T_i x[] = { std::forward<T>(value) }; is valid. If more than one alternative type satisfies this condition, the compilation will fail.
| T | the type to construct this variant |
| I | the deduced index of the alternative type that T can construct |
| Tj | the deduced alternative type that T can construct |
| value | the object to forward into the variant |
|
inline |
Calls the destructor of the alternative type.
|
inlinenoexcept |
Emplaces a value into the variant by index.
| I | the index of the alternative type to emplace |
| Args | the variadic argument type to pass into the constructor of the alternative type |
| args | Arguments to be forwarded to the constructor of the emplaced type. |
holds_alternative<I>(*this) will return true I
|
inlinenoexcept |
Emplaces a value into the variant by type.
| T | the alternative type to emplace |
| args | Arguments to be forwarded to the constructor of the emplaced type. |
holds_alternative<T>(*this) will return true index_of_v<T, Ts...>
|
inlinenoexcept |
Emplaces a value into the variant by index.
| I | the index of the alternative type to emplace |
| Args | the variadic argument type to pass into the constructor of the alternative type |
| init | An initializer list to forward to the constructor of the emplaced type. |
| args | Arguments to be forwarded to the constructor of the emplaced type. |
holds_alternative<I>(*this) will return true I
|
inlinenoexcept |
Emplaces a value into the variant by type.
| T | the alternative type to emplace |
| init | An initializer list to forward to the constructor of the emplaced type. |
| args | Arguments to be forwarded to the constructor of the emplaced type. |
holds_alternative<T>(*this) will return true index_of_v<T, Ts...>
|
inlinenoexcept |
Get the object stored in this variant by the index.
| Index | the index into Ts of the alternative to get |
| bad_variant_access | if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED) and if the type index of the object currently held by the variant does not match the index requested. |
ARENE_IS_OFF(ARENE_EXCEPTIONS_ENABLED) the type index of the object currently held by the variant must match the type requested else ARENE_PRECONDITION violation.
|
inlinenoexcept |
Get by type.
| T | the alternative type to get |
| bad_variant_access | if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED) and if the type of the object currently held by the variant does not match the type requested. |
ARENE_IS_OFF(ARENE_EXCEPTIONS_ENABLED) the type of the object currently held by the variant must match the type requested else ARENE_PRECONDITION violation.
|
inlinenoexcept |
Get the object stored in this variant by the index.
| Index | the index into Ts of the alternative to get |
| bad_variant_access | if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED) and if the type index of the object currently held by the variant does not match the index requested. |
ARENE_IS_OFF(ARENE_EXCEPTIONS_ENABLED) the type index of the object currently held by the variant must match the type requested else ARENE_PRECONDITION violation.
|
inlinenoexcept |
Get by type.
| T | the alternative type to get |
| bad_variant_access | if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED) and if the type of the object currently held by the variant does not match the type requested. |
ARENE_IS_OFF(ARENE_EXCEPTIONS_ENABLED) the type of the object currently held by the variant must match the type requested else ARENE_PRECONDITION violation.
|
inlinenoexcept |
Get the object stored in this variant by the index.
| Index | the index into Ts of the alternative to get |
| bad_variant_access | if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED) and if the type index of the object currently held by the variant does not match the index requested. |
ARENE_IS_OFF(ARENE_EXCEPTIONS_ENABLED) the type index of the object currently held by the variant must match the type requested else ARENE_PRECONDITION violation.
|
inlinenoexcept |
Get by type.
| T | the alternative type to get |
| bad_variant_access | if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED) and if the type of the object currently held by the variant does not match the type requested. |
ARENE_IS_OFF(ARENE_EXCEPTIONS_ENABLED) the type of the object currently held by the variant must match the type requested else ARENE_PRECONDITION violation.
|
inlinenoexcept |
Get the object stored in this variant by the index.
| Index | the index into Ts of the alternative to get |
| bad_variant_access | if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED) and if the type index of the object currently held by the variant does not match the index requested. |
ARENE_IS_OFF(ARENE_EXCEPTIONS_ENABLED) the type index of the object currently held by the variant must match the type requested else ARENE_PRECONDITION violation.
|
inlinenoexcept |
Get by type.
| T | the alternative type to get |
| bad_variant_access | if ARENE_IS_ON(ARENE_EXCEPTIONS_ENABLED) and if the type of the object currently held by the variant does not match the type requested. |
ARENE_IS_OFF(ARENE_EXCEPTIONS_ENABLED) the type of the object currently held by the variant must match the type requested else ARENE_PRECONDITION violation.
|
inlinenoexcept |
Get the index of the alternative type that this variant currently holds.
variant_npos if the variant is valueless.
|
inlinenoexcept |
Copy Assignment operator from another variant of the same alternative types.
If the other type is valueless, or exception is thrown during copying, this variant will also be valueless.
Ts is copy-assignable. | rhs | the other variant to copy from |
|
delete |
Copy Assignment operator from another variant of the same alternative types.
If the other type is valueless, or exception is thrown during copying, this variant will also be valueless.
Ts is copy-assignable. | rhs | the other variant to copy from |
|
delete |
Move Assignment operator from another variant of the same alternative types.
If the other type is valueless, this variant will also be valueless.
Ts is move-assignable. | rhs | the other variant to move from |
|
inlinenoexcept |
Move Assignment operator from another variant of the same alternative types.
If the other type is valueless, this variant will also be valueless.
Ts is move-assignable. | rhs | the other variant to move from |
|
inlineconstexprnoexcept |
Check if the variant is valueless.
A variant becomes valueless if and only if an exception is thrown during copy or move initialization
|
friend |
Less-than comparison.
| lhs | variant to compare |
| rhs | the other variant to compare |
std::less on the held alternatives of the two variants.
|
friend |
Equality comparison.
| lhs | variant to compare |
| rhs | the other variant to compare |