vt_enlarge 3 2016-02-28 genvector manual

NAME

vt_enlarge - enlarge a vector to the size specified

SYNPOSIS

int vt_enlarge(vt_t *vect, vt_size_t idx)

DESCRIPTION

vt_enlarge calls vt_resize to enlarge a vector so that element idx exists. If the vector is already large enough, nothing happens and 0 is returned. Else the new element is always created (initialized, see vt_init_elem(7) or constructed, see vt_construction(7)).

Implicit element initialization: when idx is more than one element beyond the end of the vector, there are multiple new elements need to be created; they are also initialized and/or constructed. Such elements are called 'implicit' because they are added to the vector as a side effect of the enlarge operation.

If the vector is terminated (see vt_term(7)), after creating the new element, a terminator is placed behind it; the previous terminator is already overallocated and overwritten during the implicit element initialization.

Note: vt_t and the vt_ prefix are type-dependant, see vt_t(7).

Arguments:
vect A vector already initialized using vt_init.
idx The element index of which the vector should be longer than.

RETURN VALUE

Returns 0 on success or -1 on error. Error conditions include memory allocation failure or construction failure.

SEE ALSO

vt_enlarge 3 2016-02-28 genvector manual