Spicy
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
hilti::rt::type_info::Union Class Reference

#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
 

Detailed Description

Auxiliary type information for type `union.

Member Typedef Documentation

◆ Accessor

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.

Constructor & Destructor Documentation

◆ Union()

hilti::rt::type_info::Union::Union ( std::vector< union_::Field fields,
Accessor  accessor 
)
inline

Constructor

Parameters
labelsthe union's fields
accessoraccessor function returning the index of the currently set field

Member Function Documentation

◆ fields()

const auto& hilti::rt::type_info::Union::fields ( ) const
inline

Returns the union's fields.

◆ value()

Value hilti::rt::type_info::Union::value ( const Value v) const
inline

Returns the union's current value. The value will be invalid if there's no field set currently.


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