Skip to main content

function

move_pointee

move_pointee[T: Movable](*, src: UnsafePointer[T, address_space], dst: UnsafePointer[T, 0])

Moves the value src points to into the memory location pointed to by dest.

This performs a consuming move (using __moveinit__()) out of the memory location pointed to by src. Subsequent reads of this pointer are not valid unless and until a new, valid value has been moved into this pointer's memory location using initialize_pointee_move().

This transfers the value out of self and into dest using at most one __moveinit__() call.

Safety: * src must not be null * src must contain a valid, initialized instance of T * dst must not be null * The contents of dst should be uninitialized. If dst was previously written with a valid value, that value will be be overwritten and its destructor will NOT be run.

Parameters:

  • T (Movable): The type the pointer points to, which must be Movable.

Args:

  • src (UnsafePointer[T, address_space]): Source pointer that the value will be moved from.
  • dst (UnsafePointer[T, 0]): Destination pointer that the value will be moved into.