Mojo function
destroy_n
destroy_n[T: ImplicitlyDestructible](pointer: UnsafePointer[T, pointer.origin], count: Int)
Destroy count initialized values at pointer.
This function runs the destructor for each of the count values, leaving
the memory uninitialized.
For types with trivial destructors, this is a no-op and generates no code.
Otherwise, it calls destroy_pointee() on each element.
Safety:
pointermust point to a valid memory region containing at leastcountinitialized elements of typeT.- After this call, the values at
pointer[0:count]are uninitialized and must not be read or destroyed again until re-initialized.
Parameters:
- โT (
ImplicitlyDestructible): The type of values to destroy, which must beImplicitlyDestructible.
Args:
- โpointer (
UnsafePointer): Pointer to the memory region containing values to destroy. - โcount (
Int): The number of elements to destroy.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!