VecPushFrontArrL
Description
Prepend a contiguous range of elements at the front of the vector, preserving order of existing elements. L-value form takes ownership of the source on success when the vector has no copy_init handler.
Parameters
| Name | Direction | Description |
|---|---|---|
v |
in,out | Vector handle. |
arr |
in | Pointer to the source array. |
count |
in | Number of elements to prepend. |
Success
Returns true. The vector length grows by count; the prepended elements occupy [0, count); all previous elements have shifted right by count. When the vector has no copy_init handler, the source bytes have been zeroed.
Failure
Returns false on allocation failure. Both vector and source are unchanged.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Vec.Insert.c:424:
// L-value array operations
VecPushFrontArrL(&vec, arr, 3);
// Check that the elements were added
- In
Insert.h:338:
/// TAGS: Vec, PushFront, Range, Insert
///
#define VecPushFrontArr(v, arr, count) VecPushFrontArrL((v), (arr), (count))
///
- In
Insert.h:813:
#define VecMustPushFrontArrL(v, arr, count) \
do { \
if (!VecPushFrontArrL((v), (arr), (count))) { \
LOG_FATAL("VecMustPushFrontArrL failed"); \
} \- In
Insert.h:702:
/// TAGS: Str, PushFront, Range, LValue
///
#define StrPushFrontArrL(str, arr, count) VecPushFrontArrL((str), (arr), (count))
///
Last updated on