Skip to main content

Mojo struct

DeviceContextPtrList

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 of DeviceContextPtr objects in the collection.

Fields

  • ptrs (StaticTuple[DeviceContextPtr, size]): The underlying storage for the device context pointers.

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, RegisterPassable, Sized, TrivialRegisterPassable

Methods

__init__

__init__(ptrs: StaticTuple[DeviceContextPtr, size]) -> Self

Initialize with a InlineArray of DeviceContextPtrs.

Args:

  • ptrs (StaticTuple): An InlineArray containing the DeviceContextPtrs to store.

__getitem__

__getitem__[I: Indexer, //](self, idx: I) -> DeviceContext

Access a DeviceContext using a runtime index value.

Parameters:

  • I (Indexer): A type that conforms to the Indexer trait.

Args:

  • idx (I): A runtime index value that conforms to the Indexer trait.

Returns:

DeviceContext: The DeviceContext at the specified index.

__getitem_param__

__getitem_param__[index: Int](self) -> DeviceContext

Access a DeviceContext at a compile-time known index.

Parameters:

  • index (Int): A compile-time integer index.

Returns:

DeviceContext: The DeviceContext at the specified index.

__len__

__len__(self) -> Int

Get the number of DeviceContextPtr objects in the collection.

Returns:

Int: The size of the collection as specified by the size parameter.

Was this page helpful?