C Collections

cvector · Section 3

cvector_reset

cvector_reset - clear all elements and reset capacity

C Collections (libccollections, -lccollections)

#include <ccollections/cvector.h>
 
void cvector_reset(cvec v);

Removes every element from the vector and then tries to shrink the
capacity back to the minimum of 4 elements. If that reallocation fails the
capacity stays as it was, but the element count becomes 0 anyway.

v    Vector to reset

The element count becomes 0, and the capacity goes back to the minimum
(4) when the reallocation succeeds.
 
The elements are not freed one by one; the caller has to do that first
when it is needed. Asserts if v is NULL.

cvec_reset(3), cvector_destroy(3)