Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
variant.hpp File Reference
#include <sysio/vm/exceptions.hpp>
#include <cstddef>
#include <cstdint>
#include <algorithm>
#include <limits>
#include <tuple>
#include <type_traits>
#include <variant>
#include <utility>
Include dependency graph for variant.hpp:

Go to the source code of this file.

Classes

struct  sysio::vm::detail::dispatcher< false, Ret >
 
struct  sysio::vm::detail::dispatcher< true, Ret >
 
union  sysio::vm::detail::variant_storage< T0, T1, T2, T3, T... >
 
union  sysio::vm::detail::variant_storage< T0 >
 
union  sysio::vm::detail::variant_storage< T0, T1 >
 
union  sysio::vm::detail::variant_storage< T0, T1, T2 >
 
union  sysio::vm::detail::variant_storage< T0, T1, T2, T3 >
 
class  sysio::vm::variant< Alternatives >
 

Namespaces

namespace  sysio
 
namespace  sysio::vm
 
namespace  sysio::vm::detail
 

Macros

#define V_ELEM(N)
 
#define V0   variant_storage() = default;
 
#define V1   V0 V_ELEM(0)
 
#define V2   V1 V_ELEM(1)
 
#define V3   V2 V_ELEM(2)
 
#define V4   V3 V_ELEM(3)
 

Typedefs

template<std::size_t I, typename... Alternatives>
using sysio::vm::detail::get_alternative_t = std::tuple_element_t<I, std::tuple<Alternatives...>>
 

Functions

template<int I, typename Storage >
constexpr decltype(auto) sysio::vm::detail::variant_storage_get (Storage &&val)
 
template<class Visitor , typename Variant >
constexpr auto sysio::vm::visit (Visitor &&vis, Variant &&var)
 

Variables

template<typename... Ts>
constexpr std::size_t sysio::vm::detail::max_layout_size_v = std::max({sizeof(Ts)...})
 
template<typename... Ts>
constexpr std::size_t sysio::vm::detail::max_alignof_v = std::max({alignof(Ts)...})
 
template<typename T , typename... Alternatives>
constexpr bool sysio::vm::detail::is_valid_alternative_v = (... + (std::is_same_v<T, Alternatives>?1:0)) != 0
 
template<typename T , typename Alternative , typename... Alternatives>
constexpr std::size_t sysio::vm::detail::get_alternatives_index_v
 
template<typename T , typename Alternative >
constexpr std::size_t sysio::vm::detail::get_alternatives_index_v< T, Alternative > = 0
 

Macro Definition Documentation

◆ V0

#define V0   variant_storage() = default;

Definition at line 100 of file variant.hpp.

◆ V1

#define V1   V0 V_ELEM(0)

Definition at line 101 of file variant.hpp.

◆ V2

#define V2   V1 V_ELEM(1)

Definition at line 102 of file variant.hpp.

◆ V3

#define V3   V2 V_ELEM(2)

Definition at line 103 of file variant.hpp.

◆ V4

#define V4   V3 V_ELEM(3)

Definition at line 104 of file variant.hpp.

◆ V_ELEM

#define V_ELEM ( N)
Value:
T##N _t##N; \
constexpr variant_storage(T##N& arg) : _t##N(arg) {} \
constexpr variant_storage(T##N&& arg) : _t##N(std::move(arg)) {} \
constexpr variant_storage(const T##N& arg) : _t##N(arg) {} \
constexpr variant_storage(const T##N&& arg) : _t##N(std::move(arg)) {}
Definition name.hpp:106
#define T(meth, val, expected)
const int N
Definition quantize.cpp:54

Definition at line 93 of file variant.hpp.

93#define V_ELEM(N) \
94 T##N _t##N; \
95 constexpr variant_storage(T##N& arg) : _t##N(arg) {} \
96 constexpr variant_storage(T##N&& arg) : _t##N(std::move(arg)) {} \
97 constexpr variant_storage(const T##N& arg) : _t##N(arg) {} \
98 constexpr variant_storage(const T##N&& arg) : _t##N(std::move(arg)) {}