VecInsertRangeR
- Macro
- August 22, 2025
Table of Contents
VecInsertRangeR
VecInsertRangeR
Description
Insert array of items into vector, with R-value semantics. Insertion index must not exceed vector length. This preserves the ordering of elements. Best to be used with sorted vectors, if the sorted property is to be preserved.
Info
If copy_init
is set, then vector will create it’s own copy of items.
Note
Unlike VecInsertRangeL, this does NOT zero out the source array after insertion regardless of copy_init settings. Use this for temporary arrays or when you need to maintain the source array.
Parameters
Name | Direction | Description |
---|---|---|
v | in,out | Vector to insert item into |
val | in | Array of items to be inserted |
idx | in | Index to start inserting item at. |
count | in | Number of items to insert. |
Success
return
Failure
Does not return
Usage example (Cross-references)
- In
Insert.h:40
:
/// FAILURE : Does not return
///
#define StrInsertCstr(str, cstr, idx, len) VecInsertRangeR((str), (cstr), (idx), (len))
///
- In
Insert.h:78
:
/// FAILURE : NULL
///
#define StrPushCstr(str, cstr, len, pos) VecInsertRangeR((str), (cstr), (pos), (len))
///
- In
Insert.h:385
:
/// FAILURE : Does not return on failure
///
#define VecPushBackArrR(v, arr, count) VecInsertRangeR((v), (arr), (v)->length, (count))
///
- In
Insert.h:428
:
/// FAILURE : Does not return on failure
///
#define VecPushFrontArrR(v, arr, count) VecInsertRangeR((v), (arr), 0, (count))
///
- In
Vec.Insert.c:209
:
// Push an array at a specific index
int values[] = {30, 40, 50};
VecInsertRangeR(&vec, values, 1, 3);
// Check length
- In
Vec.Insert.c:246
:
// Insert range in the middle
VecInsertRangeR(&vec, src.data, 1, src.length);
// Check length