vt_get 3 | 2016-02-28 | genvector manual |
---|
vt_get - return a pointer to an element
vt_elem_t *vt_get(vt_t *vect, vt_size_t idx, int alloc)
vt_get attempts to return a pointer to the element addressed by idx. If the element doesn't exist and alloc is non-zero, it is created (among with all other elements between the new element and the original vector end) and the pointer to the new element is returned. When creating new element(s), the usual initialization and/or construction scheme is in place.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 index of the element to be returned. alloc Whether new element(s) should be allocated if idx is beyond the end of the vector.
Returns the pointer to the element addressed, if the element exists or if alloc allowed it to be created. Else return NULL and leave the vector unchanged.
vt_get 3 | 2016-02-28 | genvector manual |
---|