VecPushBackArrR
Description
Append a contiguous range of elements to the end of the vector. R-value form.
Success
Returns true. The vector length grows by count; copies of the source elements occupy [old_length, new_length). The source range is untouched.
Failure
Returns false on allocation failure. The vector is unchanged.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
VecInt.c:272:
values[i] = (i32)extract_u32(data, offset, data_size);
}
VecPushBackArrR(vec, values, count);
}
break;- In
Vec.Init.c:298:
// Clone the source vector into the destination
VecPushBackArrR(&clone, VecBegin(&src), VecLen(&src));
// Check that the clone has the same data but different memory
// Add some initial elements
int values[] = {10, 20, 30, 40, 50, 60, 70, 80, 90};
VecPushBackArrR(&vec, values, 9);
// Test VecDelete (regular delete)
// Add elements again
VecPushBackArrR(&vec, values, 9);
// Test VecDeleteFast (fast delete)
// Add elements again
VecPushBackArrR(&vec, values, 9);
// Create an L-value index to use with regular VecDelete
// Create a small array and use count=0
int small_arr[1] = {42};
VecPushBackArrR(&vec, small_arr, 0);
result = result && (VecLen(&vec) == 1); // Length should not change
- In
Vec.Insert.c:126:
// Push an array to the back
int values[] = {10, 20, 30, 40, 50};
VecPushBackArrR(&vec, values, 5);
// Check length
- In
Vec.Insert.c:138:
// Push another array to the back
int more_values[] = {60, 70, 80};
VecPushBackArrR(&vec, more_values, 3);
// Check length
- In
Vec.Insert.c:241:
// Add some initial elements
int initial[] = {10, 20, 30};
VecPushBackArrR(&vec, initial, 3);
// Create another vector with elements to insert
- In
Vec.Insert.c:246:
IntVec src = VecInit(&alloc);
int src_values[] = {40, 50, 60};
VecPushBackArrR(&src, src_values, 3);
// Insert range in the middle
- In
Vec.Insert.c:279:
// Add some elements to first vector
int values1[] = {10, 20, 30};
VecPushBackArrR(&vec1, values1, 3);
// Create second vector
- In
Vec.Insert.c:286:
// Add some elements to second vector
int values2[] = {40, 50, 60};
VecPushBackArrR(&vec2, values2, 3);
// Merge vec2 into vec1
- In
Vec.Insert.c:328:
IntVec src = VecInit(&local_heap);
int values[] = {10, 20, 30};
VecPushBackArrR(&src, values, 3);
// Build dst on the SAME allocator as src, then clone the data.
- In
Vec.Insert.c:339:
dst.copy_init = src.copy_init;
dst.copy_deinit = src.copy_deinit;
bool cloned = VecPushBackArrR(&dst, VecBegin(&src), VecLen(&src));
bool allocator_matches = VecAllocator(&dst) == VecAllocator(&src);- In
Vec.Insert.c:415:
// R-value array operations
VecPushBackArrR(&vec, arr, 3);
// Check that the elements were added
- In
Insert.h:778:
#define VecMustPushBackArrR(v, arr, count) \
do { \
if (!VecPushBackArrR((v), (arr), (count))) { \
LOG_FATAL("VecMustPushBackArrR failed"); \
} \- In
Insert.h:207:
#define StrPushBackMany(...) OVERLOAD(StrPushBackMany, __VA_ARGS__)
#define StrPushBackMany_2(str, zstr) \
_Generic((zstr), Zstr: VecPushBackArrR((str), (Zstr)(zstr), ZstrLen((Zstr)(zstr))), char *: VecPushBackArrR((str), (Zstr)(zstr), ZstrLen((Zstr)(zstr))))
#define StrPushBackMany_3(str, cstr, cstr_len) \
_Generic((cstr), Zstr: VecPushBackArrR((str), (Zstr)(cstr), (cstr_len)), char *: VecPushBackArrR((str), (Zstr)(cstr), (cstr_len)))- In
Insert.h:209:
_Generic((zstr), Zstr: VecPushBackArrR((str), (Zstr)(zstr), ZstrLen((Zstr)(zstr))), char *: VecPushBackArrR((str), (Zstr)(zstr), ZstrLen((Zstr)(zstr))))
#define StrPushBackMany_3(str, cstr, cstr_len) \
_Generic((cstr), Zstr: VecPushBackArrR((str), (Zstr)(cstr), (cstr_len)), char *: VecPushBackArrR((str), (Zstr)(cstr), (cstr_len)))
///
- In
Insert.h:657:
/// TAGS: Str, PushBack, Range, RValue
///
#define StrPushBackArrR(str, arr, count) VecPushBackArrR((str), (arr), (count))
///
Last updated on