![]() |
Spicy
|
#include <tuple.h>
Public Types | |
| using | Base = std::tuple< Ts... > |
Public Member Functions | |
| Tuple () | |
| template<typename... Us> | |
| Tuple (tuple::ValueTag, Us &&... us) | |
| template<typename... Us> | |
| Tuple (tuple::OptionalTag, Optional< Us > &&... us) | |
| Tuple (const Tuple &other)=default | |
| Tuple (Tuple &&other)=default | |
| template<typename... Us> | |
| Tuple (Tuple< Us... > &&other) | |
| template<typename K , typename V > | |
| requires (sizeof...(Ts)==2) explicit Tuple(std | |
| template<std::size_t Idx> | |
| const auto & | get () const |
| template<std::size_t Idx> | |
| auto & | get () |
| Tuple & | operator= (const Tuple &other)=default |
| Tuple & | operator= (Tuple &&other)=default |
Public Member Functions inherited from hilti::rt::TupleBase | |
| constexpr bool | hasValue (size_t idx) const noexcept |
Static Public Member Functions | |
| template<std::size_t Idx> | |
| static ptrdiff_t | elementOffset () |
Friends | |
| template<typename... Us> | |
| std::weak_ordering | operator<=> (const Tuple< Ts... > &t1, const Tuple< Us... > &t2) |
Additional Inherited Members | |
Protected Member Functions inherited from hilti::rt::TupleBase | |
| TupleBase () noexcept=default | |
| TupleBase (tuple::detail::AllSetTag, uint64_t num_elements) | |
| TupleBase (const TupleBase &other) noexcept=default | |
| TupleBase (TupleBase &&other) noexcept=default | |
| void | set (size_t idx) |
| TupleBase & | operator= (const TupleBase &other)=default |
| TupleBase & | operator= (TupleBase &&other)=default |
Static Protected Attributes inherited from hilti::rt::TupleBase | |
| static constexpr size_t | MaxElements = 64 |
Runtime representation of HILTI's tuple type. Different from std::tuple, tuple elements can remain unset. If an unset element is accessed, an UnsetTupleElement exception is thrown.
For efficiency, we currently limit the maximum number of tuple elements to
| Ts | types of the tuple elements |
|
inline |
Default constructor creating an empty tuple with all elements unset.
|
inlineexplicit |
Constructor creating a tuple from provided values, with all elements set.
| tag | tag to select this constructor |
| us | values for the tuple elements |
|
inlineexplicit |
Constructor creating a tuple from provided values, with some elements potentially left unset.
| tag | tag to select this constructor |
| us | values for the tuple elements wrapped into optionals, with unset optionals leaving the corresponding tuple element unset |
|
default |
Copy constructor.
|
default |
Move constructor.
|
inline |
Move constructor from another tuple type having elements of types that convert to ours.
|
inlinestatic |
Returns the binary offset of a particular element inside the tuple's storage. The offset refers is to the start of the tuple.
| Idx | index of the element to return |
Accessor to retrieve a particular element, assuming it's set.
| Idx | index of the element to retrieve |
Idx | <tt>UnsetTupleElement</tt> | if the element at index Idx is not set |
|
inline |
Accessor to retrieve a particular element, assuming it's set.
| Idx | index of the element to retrieve |
Idx | <tt>UnsetTupleElement</tt> | if the element at index Idx is not set |
|
inline |
Constructor from a std::map::value_type (std::pair<const K, V>), with both elements set. const_cast is safe here because p is &&.