IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

pointer

Implements the Pointer type.

You can import these APIs from the memory package. For example:

from std.memory import Pointer

comptime values

ImmPointer

comptime ImmPointer[T: AnyType, origin: ImmOrigin, *, address_space: AddressSpace = AddressSpace.GENERIC] = Pointer[T, origin, address_space=address_space]

An immutable pointer.

Parameters

  • T (AnyType): The pointee type.
  • origin (ImmOrigin): The origin of the pointer.
  • address_space (AddressSpace): The address space of the pointer.

MutPointer

comptime MutPointer[T: AnyType, origin: MutOrigin, *, address_space: AddressSpace = AddressSpace.GENERIC] = Pointer[T, origin, address_space=address_space]

A mutable pointer.

Parameters

  • T (AnyType): The pointee type.
  • origin (MutOrigin): The origin of the pointer.
  • address_space (AddressSpace): The address space of the pointer.

Pointer

comptime Pointer = Pointer[_, _, address_space=_]

A non-nullable pointer to a value of T.

Structs