![]() |
Spicy
|
#include <type-info.h>
Public Types | |
using | Accessor = std::size_t(*)(const Value &v) |
Public Member Functions | |
Union (std::vector< union_::Field > fields, Accessor accessor) | |
const auto & | fields () const |
Value | value (const Value &v) const |
Static Public Member Functions | |
template<typename T > | |
static auto | accessor () |
Public Attributes | |
const size_t | npos = std::variant_npos |
Auxiliary type information for type `union
.
using hilti::rt::type_info::Union::Accessor = std::size_t (*)(const Value& v) |
Type of a function that, given a union value, returns the index of the currently set field, with npos
indicating no field being set.
|
inline |
Constructor
labels | the union's fields |
accessor | accessor function returning the index of the currently set field |
|
inline |
Returns the union's fields.
Returns the union's current value. The value will be invalid if there's no field set currently.