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).
unsafe_destroy_n
def unsafe_destroy_n[T: Deinitable](pointer: Pointer[T], 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 unsafe_deinit_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 (
Deinitable): The type of values to destroy, which must beDeinitable.
Args:
- pointer (
Pointer[T]): Pointer to the memory region containing values to destroy. - count (
Int): The number of elements to destroy.