Spicy
Public Member Functions | Protected Member Functions | Static Protected Attributes | Friends | List of all members
hilti::rt::TupleBase Class Reference

#include <tuple.h>

Inheritance diagram for hilti::rt::TupleBase:
hilti::rt::Tuple< Ts... > hilti::rt::Tuple< Ts >

Public Member Functions

constexpr bool hasValue (size_t idx) const noexcept
 

Protected Member Functions

 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)
 
TupleBaseoperator= (const TupleBase &other)=default
 
TupleBaseoperator= (TupleBase &&other)=default
 

Static Protected Attributes

static constexpr size_t MaxElements = 64
 

Friends

auto operator<=> (const TupleBase &t1, const TupleBase &t2)=default
 

Detailed Description

Common base class to all tuple types. The base class provides a public function to check if a particular element is set, meaning that one can test this generically without knowing the actual tuple element types.

Internally, the base class performs the state management tracking which elements are set through a bitmask.

For efficiency, we currently limit the maximum number of tuple elements to

  1. This could be changed if deemed necessary.

Constructor & Destructor Documentation

◆ TupleBase() [1/2]

hilti::rt::TupleBase::TupleBase ( )
protecteddefaultnoexcept

Constructor marking all elements as initially unset.

◆ TupleBase() [2/2]

hilti::rt::TupleBase::TupleBase ( tuple::detail::AllSetTag  ,
uint64_t  num_elements 
)
inlineprotected

Constructor marking all elements as initially set.

Parameters
tagtag to select this constructor
num_elementsnumber of elements in the tuple

Member Function Documentation

◆ hasValue()

constexpr bool hilti::rt::TupleBase::hasValue ( size_t  idx) const
inlineconstexprnoexcept

Returns true if the element at index idx is set. If idx is beyond the number of valid tuple elements the result is undefined.

◆ set()

void hilti::rt::TupleBase::set ( size_t  idx)
inlineprotected

Mark a specific element as set.

Parameters
idxindex of the element to mark as set

Member Data Documentation

◆ MaxElements

constexpr size_t hilti::rt::TupleBase::MaxElements = 64
staticconstexprprotected

Maximum number of tuple elements supported.


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