Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::vm::variant< Alternatives > Class Template Reference

#include <variant.hpp>

Public Member Functions

 variant ()=default
 
 variant (const variant &other)=default
 
 variant (variant &&other)=default
 
variantoperator= (const variant &other)=default
 
variantoperator= (variant &&other)=default
 
template<typename T , typename = std::enable_if_t<detail::is_valid_alternative_v<std::decay_t<T>, Alternatives...>>>
constexpr variant (T &&alt)
 
template<typename T , typename = std::enable_if_t<detail::is_valid_alternative_v<std::decay_t<T>, Alternatives...>>>
constexpr variantoperator= (T &&alt)
 
constexpr uint16_t index () const
 
template<size_t Index>
constexpr auto && get_check ()
 
template<size_t Index>
constexpr const auto & get () const &
 
template<typename Alt >
constexpr const Altget () const &
 
template<size_t Index>
constexpr const auto && get () const &&
 
template<typename Alt >
constexpr const Alt && get () const &&
 
template<size_t Index>
constexpr auto && get () &&
 
template<typename Alt >
constexpr Alt && get () &&
 
template<size_t Index>
constexpr auto & get () &
 
template<typename Alt >
constexpr Altget () &
 
template<typename Alt >
constexpr bool is_a () const
 
constexpr void toggle_exiting_which ()
 
constexpr void clear_exiting_which ()
 
constexpr void set_exiting_which ()
 
 variant ()=default
 
 variant (const variant &other)=default
 
 variant (variant &&other)=default
 
variantoperator= (const variant &other)=default
 
variantoperator= (variant &&other)=default
 
template<typename T , typename = std::enable_if_t<detail::is_valid_alternative_v<std::decay_t<T>, Alternatives...>>>
constexpr variant (T &&alt)
 
template<typename T , typename = std::enable_if_t<detail::is_valid_alternative_v<std::decay_t<T>, Alternatives...>>>
constexpr variantoperator= (T &&alt)
 
constexpr uint16_t index () const
 
template<size_t Index>
constexpr auto && get_check ()
 
template<size_t Index>
constexpr const auto & get () const &
 
template<typename Alt >
constexpr const Altget () const &
 
template<size_t Index>
constexpr const auto && get () const &&
 
template<typename Alt >
constexpr const Alt && get () const &&
 
template<size_t Index>
constexpr auto && get () &&
 
template<typename Alt >
constexpr Alt && get () &&
 
template<size_t Index>
constexpr auto & get () &
 
template<typename Alt >
constexpr Altget () &
 
template<typename Alt >
constexpr bool is_a () const
 
constexpr void toggle_exiting_which ()
 
constexpr void clear_exiting_which ()
 
constexpr void set_exiting_which ()
 

Static Public Member Functions

static constexpr size_t variant_size ()
 
static constexpr size_t variant_size ()
 

Detailed Description

template<typename... Alternatives>
class sysio::vm::variant< Alternatives >

Definition at line 162 of file variant.hpp.

Constructor & Destructor Documentation

◆ variant() [1/8]

template<typename... Alternatives>
sysio::vm::variant< Alternatives >::variant ( )
default

◆ variant() [2/8]

template<typename... Alternatives>
sysio::vm::variant< Alternatives >::variant ( const variant< Alternatives > & other)
default

◆ variant() [3/8]

template<typename... Alternatives>
sysio::vm::variant< Alternatives >::variant ( variant< Alternatives > && other)
default

◆ variant() [4/8]

template<typename... Alternatives>
template<typename T , typename = std::enable_if_t<detail::is_valid_alternative_v<std::decay_t<T>, Alternatives...>>>
sysio::vm::variant< Alternatives >::variant ( T && alt)
inlineconstexpr

Definition at line 178 of file variant.hpp.

178 :
179 _which(detail::get_alternatives_index_v<std::decay_t<T>, Alternatives...>),
180 _storage(static_cast<T&&>(alt)) {
181 }
constexpr std::size_t get_alternatives_index_v
Definition variant.hpp:34
#define T(meth, val, expected)

◆ variant() [5/8]

template<typename... Alternatives>
sysio::vm::variant< Alternatives >::variant ( )
default

◆ variant() [6/8]

template<typename... Alternatives>
sysio::vm::variant< Alternatives >::variant ( const variant< Alternatives > & other)
default

◆ variant() [7/8]

template<typename... Alternatives>
sysio::vm::variant< Alternatives >::variant ( variant< Alternatives > && other)
default

◆ variant() [8/8]

template<typename... Alternatives>
template<typename T , typename = std::enable_if_t<detail::is_valid_alternative_v<std::decay_t<T>, Alternatives...>>>
sysio::vm::variant< Alternatives >::variant ( T && alt)
inlineconstexpr

Definition at line 178 of file variant.hpp.

178 :
179 _which(detail::get_alternatives_index_v<std::decay_t<T>, Alternatives...>),
180 _storage(static_cast<T&&>(alt)) {
181 }

Member Function Documentation

◆ clear_exiting_which() [1/2]

template<typename... Alternatives>
void sysio::vm::variant< Alternatives >::clear_exiting_which ( )
inlineconstexpr

Definition at line 252 of file variant.hpp.

252{ _which &= 0xFF; }

◆ clear_exiting_which() [2/2]

template<typename... Alternatives>
void sysio::vm::variant< Alternatives >::clear_exiting_which ( )
inlineconstexpr

Definition at line 252 of file variant.hpp.

252{ _which &= 0xFF; }

◆ get() [1/16]

template<typename... Alternatives>
template<size_t Index>
auto & sysio::vm::variant< Alternatives >::get ( ) &
inlineconstexpr

Definition at line 238 of file variant.hpp.

238 {
239 return detail::variant_storage_get<Index>(_storage);
240 }
constexpr decltype(auto) variant_storage_get(Storage &&val)
Definition variant.hpp:140
Here is the call graph for this function:

◆ get() [2/16]

template<typename... Alternatives>
template<typename Alt >
Alt & sysio::vm::variant< Alternatives >::get ( ) &
inlineconstexpr

Definition at line 243 of file variant.hpp.

243 {
244 return detail::variant_storage_get<detail::get_alternatives_index_v<Alt, Alternatives...>>(_storage);
245 }
Binary< NodeType::alt > Alt
Definition Regexp.cpp:54
Here is the call graph for this function:

◆ get() [3/16]

template<typename... Alternatives>
template<size_t Index>
auto & sysio::vm::variant< Alternatives >::get ( ) &
inlineconstexpr

Definition at line 238 of file variant.hpp.

238 {
239 return detail::variant_storage_get<Index>(_storage);
240 }
Here is the call graph for this function:

◆ get() [4/16]

template<typename... Alternatives>
template<typename Alt >
Alt & sysio::vm::variant< Alternatives >::get ( ) &
inlineconstexpr

Definition at line 243 of file variant.hpp.

243 {
244 return detail::variant_storage_get<detail::get_alternatives_index_v<Alt, Alternatives...>>(_storage);
245 }
Here is the call graph for this function:

◆ get() [5/16]

template<typename... Alternatives>
template<size_t Index>
auto && sysio::vm::variant< Alternatives >::get ( ) &&
inlineconstexpr

Definition at line 228 of file variant.hpp.

228 {
229 return detail::variant_storage_get<Index>(std::move(_storage));
230 }
Here is the call graph for this function:

◆ get() [6/16]

template<typename... Alternatives>
template<typename Alt >
Alt && sysio::vm::variant< Alternatives >::get ( ) &&
inlineconstexpr

Definition at line 233 of file variant.hpp.

233 {
234 return detail::variant_storage_get<detail::get_alternatives_index_v<Alt, Alternatives...>>(std::move(_storage));
235 }
Here is the call graph for this function:

◆ get() [7/16]

template<typename... Alternatives>
template<size_t Index>
auto && sysio::vm::variant< Alternatives >::get ( ) &&
inlineconstexpr

Definition at line 228 of file variant.hpp.

228 {
229 return detail::variant_storage_get<Index>(std::move(_storage));
230 }
Here is the call graph for this function:

◆ get() [8/16]

template<typename... Alternatives>
template<typename Alt >
Alt && sysio::vm::variant< Alternatives >::get ( ) &&
inlineconstexpr

Definition at line 233 of file variant.hpp.

233 {
234 return detail::variant_storage_get<detail::get_alternatives_index_v<Alt, Alternatives...>>(std::move(_storage));
235 }
Here is the call graph for this function:

◆ get() [9/16]

template<typename... Alternatives>
template<size_t Index>
const auto & sysio::vm::variant< Alternatives >::get ( ) const &
inlineconstexpr

Definition at line 208 of file variant.hpp.

208 {
209 return detail::variant_storage_get<Index>(_storage);
210 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get() [10/16]

template<typename... Alternatives>
template<typename Alt >
const Alt & sysio::vm::variant< Alternatives >::get ( ) const &
inlineconstexpr

Definition at line 213 of file variant.hpp.

213 {
214 return detail::variant_storage_get<detail::get_alternatives_index_v<Alt, Alternatives...>>(_storage);
215 }
Here is the call graph for this function:

◆ get() [11/16]

template<typename... Alternatives>
template<size_t Index>
const auto & sysio::vm::variant< Alternatives >::get ( ) const &
inlineconstexpr

Definition at line 208 of file variant.hpp.

208 {
209 return detail::variant_storage_get<Index>(_storage);
210 }
Here is the call graph for this function:

◆ get() [12/16]

template<typename... Alternatives>
template<typename Alt >
const Alt & sysio::vm::variant< Alternatives >::get ( ) const &
inlineconstexpr

Definition at line 213 of file variant.hpp.

213 {
214 return detail::variant_storage_get<detail::get_alternatives_index_v<Alt, Alternatives...>>(_storage);
215 }
Here is the call graph for this function:

◆ get() [13/16]

template<typename... Alternatives>
template<size_t Index>
const auto && sysio::vm::variant< Alternatives >::get ( ) const &&
inlineconstexpr

Definition at line 218 of file variant.hpp.

218 {
219 return detail::variant_storage_get<Index>(std::move(_storage));
220 }
Here is the call graph for this function:

◆ get() [14/16]

template<typename... Alternatives>
template<typename Alt >
const Alt && sysio::vm::variant< Alternatives >::get ( ) const &&
inlineconstexpr

Definition at line 223 of file variant.hpp.

223 {
224 return detail::variant_storage_get<detail::get_alternatives_index_v<Alt, Alternatives...>>(std::move(_storage));
225 }
Here is the call graph for this function:

◆ get() [15/16]

template<typename... Alternatives>
template<size_t Index>
const auto && sysio::vm::variant< Alternatives >::get ( ) const &&
inlineconstexpr

Definition at line 218 of file variant.hpp.

218 {
219 return detail::variant_storage_get<Index>(std::move(_storage));
220 }
Here is the call graph for this function:

◆ get() [16/16]

template<typename... Alternatives>
template<typename Alt >
const Alt && sysio::vm::variant< Alternatives >::get ( ) const &&
inlineconstexpr

Definition at line 223 of file variant.hpp.

223 {
224 return detail::variant_storage_get<detail::get_alternatives_index_v<Alt, Alternatives...>>(std::move(_storage));
225 }
Here is the call graph for this function:

◆ get_check() [1/2]

template<typename... Alternatives>
template<size_t Index>
auto && sysio::vm::variant< Alternatives >::get_check ( )
inlineconstexpr

Definition at line 202 of file variant.hpp.

202 {
203 // TODO add outcome stuff
204 return 3;
205 }

◆ get_check() [2/2]

template<typename... Alternatives>
template<size_t Index>
auto && sysio::vm::variant< Alternatives >::get_check ( )
inlineconstexpr

Definition at line 202 of file variant.hpp.

202 {
203 // TODO add outcome stuff
204 return 3;
205 }

◆ index() [1/2]

template<typename... Alternatives>
uint16_t sysio::vm::variant< Alternatives >::index ( ) const
inlineconstexpr

Definition at line 199 of file variant.hpp.

199{ return _which; }

◆ index() [2/2]

template<typename... Alternatives>
uint16_t sysio::vm::variant< Alternatives >::index ( ) const
inlineconstexpr

Definition at line 199 of file variant.hpp.

199{ return _which; }

◆ is_a() [1/2]

template<typename... Alternatives>
template<typename Alt >
bool sysio::vm::variant< Alternatives >::is_a ( ) const
inlineconstexpr

Definition at line 248 of file variant.hpp.

248 {
249 return _which == detail::get_alternatives_index_v<Alt, Alternatives...>;
250 }

◆ is_a() [2/2]

template<typename... Alternatives>
template<typename Alt >
bool sysio::vm::variant< Alternatives >::is_a ( ) const
inlineconstexpr

Definition at line 248 of file variant.hpp.

248 {
249 return _which == detail::get_alternatives_index_v<Alt, Alternatives...>;
250 }

◆ operator=() [1/6]

template<typename... Alternatives>
variant & sysio::vm::variant< Alternatives >::operator= ( const variant< Alternatives > & other)
default

◆ operator=() [2/6]

template<typename... Alternatives>
variant & sysio::vm::variant< Alternatives >::operator= ( const variant< Alternatives > & other)
default

◆ operator=() [3/6]

template<typename... Alternatives>
template<typename T , typename = std::enable_if_t<detail::is_valid_alternative_v<std::decay_t<T>, Alternatives...>>>
variant & sysio::vm::variant< Alternatives >::operator= ( T && alt)
inlineconstexpr

Definition at line 185 of file variant.hpp.

185 {
186#if (defined(__GNUC__) && !defined(__clang__))
187#pragma GCC diagnostic push
188#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
189 _storage = static_cast<T&&>(alt);
190#pragma GCC diagnostic pop
191#else
192 _storage = static_cast<T&&>(alt);
193#endif
194 _which = detail::get_alternatives_index_v<std::decay_t<T>, Alternatives...>;
195 return *this;
196 }

◆ operator=() [4/6]

template<typename... Alternatives>
template<typename T , typename = std::enable_if_t<detail::is_valid_alternative_v<std::decay_t<T>, Alternatives...>>>
variant & sysio::vm::variant< Alternatives >::operator= ( T && alt)
inlineconstexpr

Definition at line 185 of file variant.hpp.

185 {
186#if (defined(__GNUC__) && !defined(__clang__))
187#pragma GCC diagnostic push
188#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
189 _storage = static_cast<T&&>(alt);
190#pragma GCC diagnostic pop
191#else
192 _storage = static_cast<T&&>(alt);
193#endif
194 _which = detail::get_alternatives_index_v<std::decay_t<T>, Alternatives...>;
195 return *this;
196 }

◆ operator=() [5/6]

template<typename... Alternatives>
variant & sysio::vm::variant< Alternatives >::operator= ( variant< Alternatives > && other)
default

◆ operator=() [6/6]

template<typename... Alternatives>
variant & sysio::vm::variant< Alternatives >::operator= ( variant< Alternatives > && other)
default

◆ set_exiting_which() [1/2]

template<typename... Alternatives>
void sysio::vm::variant< Alternatives >::set_exiting_which ( )
inlineconstexpr

Definition at line 253 of file variant.hpp.

253{ _which |= 0x100; }

◆ set_exiting_which() [2/2]

template<typename... Alternatives>
void sysio::vm::variant< Alternatives >::set_exiting_which ( )
inlineconstexpr

Definition at line 253 of file variant.hpp.

253{ _which |= 0x100; }

◆ toggle_exiting_which() [1/2]

template<typename... Alternatives>
void sysio::vm::variant< Alternatives >::toggle_exiting_which ( )
inlineconstexpr

Definition at line 251 of file variant.hpp.

251{ _which ^= 0x100; }

◆ toggle_exiting_which() [2/2]

template<typename... Alternatives>
void sysio::vm::variant< Alternatives >::toggle_exiting_which ( )
inlineconstexpr

Definition at line 251 of file variant.hpp.

251{ _which ^= 0x100; }

◆ variant_size() [1/2]

template<typename... Alternatives>
static constexpr size_t sysio::vm::variant< Alternatives >::variant_size ( )
inlinestaticconstexpr

Definition at line 198 of file variant.hpp.

198{ return sizeof...(Alternatives); }

◆ variant_size() [2/2]

template<typename... Alternatives>
static constexpr size_t sysio::vm::variant< Alternatives >::variant_size ( )
inlinestaticconstexpr

Definition at line 198 of file variant.hpp.

198{ return sizeof...(Alternatives); }

The documentation for this class was generated from the following files: