VecPushBackArrR
- Macro
- August 22, 2025
Table of Contents
VecPushBackArrR
VecPushBackArrR
Description
Push a complete array into this vector, with R-value semantics.
Note
Unlike VecPushBackArrL, this does NOT zero out the source array after insertion.
Parameters
Name | Direction | Description |
---|---|---|
v | in,out | Vector to insert array items into. |
arr | in | Array to be inserted. |
count | in | Number (non-zero) of items in array. |
Success
v
Failure
Does not return on failure
Usage example (Cross-references)
- In
Insert.h:103
:
/// FAILURE : NULL
///
#define StrPushBackCstr(str, cstr, len) VecPushBackArrR((str), (cstr), (len))
///
- In
Insert.h:541
:
/// FAILURE : Does not return on failure
///
#define VecMergeR(v, v2) VecPushBackArrR((v), (v2)->data, (v2)->length)
///
- In
Vec.Insert.c:123
:
// Push an array to the back
int values[] = {10, 20, 30, 40, 50};
VecPushBackArrR(&vec, values, 5);
// Check length
- In
Vec.Insert.c:135
:
// Push another array to the back
int more_values[] = {60, 70, 80};
VecPushBackArrR(&vec, more_values, 3);
// Check length
- In
Vec.Insert.c:238
:
// Add some initial elements
int initial[] = {10, 20, 30};
VecPushBackArrR(&vec, initial, 3);
// Create another vector with elements to insert
- In
Vec.Insert.c:243
:
IntVec src = VecInit();
int src_values[] = {40, 50, 60};
VecPushBackArrR(&src, src_values, 3);
// Insert range in the middle
- In
Vec.Insert.c:276
:
// Add some elements to first vector
int values1[] = {10, 20, 30};
VecPushBackArrR(&vec1, values1, 3);
// Create second vector
- In
Vec.Insert.c:283
:
// Add some elements to second vector
int values2[] = {40, 50, 60};
VecPushBackArrR(&vec2, values2, 3);
// Merge vec2 into vec1
- In
Vec.Insert.c:367
:
// R-value array operations
VecPushBackArrR(&vec, arr, 3);
// Check that the elements were added
// 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 && (vec.length == 1); // Length should not change
- In
Vec.Init.c:228
:
// Clone the source vector into the destination
VecPushBackArrR(&clone, src.data, src.length);
// Check that the clone has the same data but different memory