Mojo struct
DeviceContextPtrList
@register_passable(trivial)
struct DeviceContextPtrList[size: Int]
A fixed-size collection of DeviceContextPtr
objects.
This struct provides a lightweight, register-passable container for a fixed number
of DeviceContextPtr
objects, with array-like access semantics.
Parameters
- size (
Int
): The fixed number ofDeviceContextPtr
objects in the collection.
Fields
- ptrs (
StaticTuple[DeviceContextPtr, size]
): The underlying storage for the device context pointers.
Implemented traits
AnyType
,
UnknownDestructibility
Methods
__init__
__init__(ptrs: StaticTuple[DeviceContextPtr, size]) -> Self
Initialize with a StaticTuple of DeviceContextPtr
objects.
Args:
- ptrs (
StaticTuple[DeviceContextPtr, size]
): A StaticTuple containing theDeviceContextPtr
objects to store.
__getitem__
__getitem__[index: Int](self) -> DeviceContext
Access a DeviceContext
at a compile-time known index.
Parameters:
- index (
Int
): A compile-time integer index.
Returns:
The DeviceContext
at the specified index.
__getitem__[I: Index, //](self, idx: I) -> DeviceContext
Access a DeviceContext
using a runtime index value.
Parameters:
- I (
Index
): A type that conforms to theIndexer
trait.
Args:
- idx (
I
): A runtime index value that conforms to the Indexer trait.
Returns:
The DeviceContext
at the specified index.
__len__
__len__(self) -> Int
Get the number of DeviceContextPtr
objects in the collection.
Returns:
The size of the collection as specified by the size parameter.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!