cvector · Section 3
cvector_pop_back
NAME
cvector_pop_back - remove and return the last element from the vector
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cvector.h> ccol_retval cvector_pop_back(cvec v, void *target_elem);
DESCRIPTION
Removes the last element of the vector and copies it into the target buffer. When that leaves the vector less than 1/4 full, the capacity is halved, down to the minimum of 4.
PARAMETERS
v Vector to pop from
target_elem Pointer to the buffer that receives the element (must not
be NULL)
RETURN VALUE
ccol_success - The element was popped ccol_invalid_args - target_elem is NULL ccol_container_empty - The vector is empty
NOTES
O(1). The element is copied into target_elem, and the capacity halves when the vector is less than 1/4 full, never going below 4. Asserts if v is NULL.