VecPushFrontR
Description
Prepend a single element at the front of the vector. R-value form.
Success
Returns true. The vector length grows by one; the value of val occupies index 0; previous elements have shifted right by one.
Failure
Returns false on allocation failure. The vector is unchanged.
Usage example (Cross-references)
Usage examples (Cross-references)
// Push items to the vector
VecPushBackR(&vec, item1);
VecPushFrontR(&vec, item2);
VecPushBackR(&vec, item3);- In
Vec.Insert.c:64:
int values[] = {10, 20, 30, 40, 50};
for (int i = 0; i < 5; i++) {
VecPushFrontR(&vec, values[i]);
}- In
Insert.h:1038:
#define VecMustPushFrontR(v, val) \
do { \
if (!VecPushFrontR((v), (val))) { \
LOG_FATAL("VecMustPushFrontR failed"); \
} \- In
Insert.h:248:
/// TAGS: Str, PushFront, Char, RValue
///
#define StrPushFrontR(str, rval) VecPushFrontR((str), (rval))
///
Last updated on