Mojo struct
VariadicList
A utility class to access variadic function arguments. Provides a "list" view of the function argument so that the size of the argument list and each individual argument can be accessed.
Parameters
- type (
AnyTrivialRegType
): The type of the elements in the list.
Aliases
IterType = _VariadicListIter[type]
:
Fields
- value (
variadic<*"type">
): The underlying storage for the variadic list.
Implemented traits
AnyType
,
Sized
Methods
__init__
__init__(inout self: Self, *value: type)
Constructs a VariadicList from a variadic list of arguments.
Args:
- *value (
type
): The variadic argument list to construct the variadic list with.
__init__(inout self: Self, value: variadic<*"type">)
Constructs a VariadicList from a variadic argument type.
Args:
- value (
variadic<*"type">
): The variadic argument to construct the list with.
__getitem__
__getitem__(self: Self, idx: Int) -> type
Gets a single element on the variadic list.
Args:
- idx (
Int
): The index of the element to access on the list.
Returns:
The element on the list corresponding to the given index.
__len__
__len__(self: Self) -> Int
Gets the size of the list.
Returns:
The number of elements on the variadic list.
__iter__
__iter__(self: Self) -> _VariadicListIter[type]
Iterate over the list.
Returns:
An iterator to the start of the list.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
😔 What went wrong?