Function ScratchBuffer.reset

Ends all live element lifetimes and retains the backing allocation.

void reset();

After return, length == 0 and capacity is unchanged. Previously borrowed element references and slices are invalid.

Complexity

O(1) for trivial pointer-free T; otherwise O(length) when element destruction or GC-root sanitation is required.

Allocation

None.