Vallist class
A Vallist can contain an arbitrary amount of Values.
Contents
You can use a Vallist in destructuring assignments. You have to specify the number of values you want. If the number is lower than the amount of values it will simply return the first values. If the number is higher than the amount of values it will return references to a Nil value for the remaining values.
This will actually return std::reference_wrappers because it's not possible to put references inside a tuple. That means that you have to call get on the values to use them:
auto& [one, two, three] = vallist.tuple<3>(); out.get(); two.get();
You can iterate over a Vallist and you can get one element by index using Vallist::. Iteration only works for the exact number of elements (like for std::vector), so you need to be carful not to dereference a pointer into an empty Vallist). Vallist:: will return Nil values if the element you request is not in the Vallist.
Supports equality operators.
Constructors, destructors, conversion operators
- Vallist()
- Creates an empty Vallist.
- Vallist(Value) explicit
- Creates a Vallist with one Value.
- Vallist(std::vector<Value>)
- Creates a Vallist with a vector of Value.
- Vallist(std::initializer_list<Value>)
- Creates a Vallist with a multiple Values.
- Vallist(std::vector<Vallist>)
- Concatenate multiple Vallists.
- Vallist(const Vallist&)
- Copy constructor.
- Vallist(Vallist&&)
- Move constructor.
Public functions
- auto operator=(const Vallist&) -> Vallist & -> auto
- Copy assignment operator.
- auto operator=(Vallist&&) -> Vallist & -> auto
- Move assignment operator.
- auto size() const -> size_t -> auto
- The number of actual Values in the Vallist.
- auto get(size_t index) const -> const Value & -> auto
- The value at the given index.
- auto begin() const -> std::vector< Value >::const_iterator -> auto
- Iterator over the Vallist. Can be used in e.g. for loops.
- auto end() const -> std::vector< Value >::const_iterator -> auto
- Iterator over the Vallist. Can be used in e.g. for loops.
- 
              template<std::size_t N>auto tuple() const -> auto
- Returns a number of values in a tuple.
Friends
- auto operator==(const Vallist&, const Vallist&) -> bool -> auto
- Equality comparison.
- auto operator<<(std::ostream&, const Vallist&) -> std::ostream & -> auto
- Unequality comparison.
Function documentation
              
                template<std::size_t N>
              
              auto minilua::
            Returns a number of values in a tuple.
The number of returned values depends on the template parameter.
If the given number is bigger than the number of values the remaining items in the tuple will be filled with Nil.
Use this for structured binding declarations:
const auto& [val1, val2, val3] = vallist.tuple<3>();