StaticTuple

Module

Implements StaticTuple, a staticly-sized uniform container.

StaticTuple

A statically sized tuple type which contains elments of homogenous types.

Parameters:

  • size (Int): The size of the tuple.
  • _element_type (AnyType): The type of the elements in the tuple.

Aliases:

  • element_type = _element_type
  • type = array<apply(:<>(!kgen.declref<@"$Int"::@Int> borrow) -> index @"$Int"::@Int::@"__as_mlir_index($Int::Int)", size), _element_type>

Fields:

array

The underlhing storage for the static tuple.

Functions:

__init__

__init__() -> Self

Constructs an empty (undefined) tuple.

Returns:

The tuple.

__init__(*elems: _element_type) -> Self

Constructs a static tuple given a set of arguments.

Args:

  • elems (*_element_type): The element types.

Returns:

The tuple.

__init__(values: VariadicList[_element_type]) -> Self

Create a tuple constant using the specified values.

Args:

  • values (VariadicList[_element_type]): The list of values.

Returns:

A tuple with the values filled in.

__init__(array: array<apply(:<>(!kgen.declref<_"$Int"::_Int> borrow) -> index _"$Int"::_Int::_"__as_mlir_index($Int::Int)", size), _element_type>) -> Self

__getitem__

__getitem__[index: Int](self: Self) -> _element_type

Returns the value of the tuple at the given index.

Parameters:

  • index (Int): The index into the tuple.

Returns:

The value at the specified position.

__getitem__(self: Self, index: Int) -> _element_type

Returns the value of the tuple at the given dynamic index.

Args:

  • index (Int): The index into the tuple.

Returns:

The value at the specified position.

__setitem__

__setitem__[index: Int](self: Self&, val: _element_type)

Stores a single value into the tuple at the specified index.

Parameters:

  • index (Int): The index into the tuple.

Args:

  • val (_element_type): The value to store.

__setitem__(self: Self&, index: Int, val: _element_type)

Stores a single value into the tuple at the specified dynamic index.

Args:

  • index (Int): The index into the tuple.
  • val (_element_type): The value to store.

__len__

__len__(self: Self) -> Int

Returns the length of the array. This is a known constant value.

Returns:

The size of the list.