function
initialize_pointee_move
initialize_pointee_move[T: Movable](ptr: UnsafePointer[T, 0], 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
transferred 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 beMovable
.
Args:
- ptr (
UnsafePointer[T, 0]
): The pointer to initialize through. - value (
T
): The value to emplace.