Skip to main content

function

initialize_pointee_move

initialize_pointee_move[T: Movable](ptr: UnsafePointer[T, address_space], owned value: T)

Emplace a new value into the pointer location, moving from value.

The pointer memory location is assumed to contain uninitialized data, and consequently the current contents of this pointer are not destructed before writing value. Similarly, ownership of value is logically transfered into the pointer location.

When compared to initialize_pointee_copy, this avoids an extra copy on the caller side when the value is an owned rvalue.

Parameters:

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

Args:

  • ptr (UnsafePointer[T, address_space]): The pointer to initialize through.
  • value (T): The value to emplace.