VecInsertRangeL
- Macro
- August 22, 2025
Table of Contents
VecInsertRangeL
VecInsertRangeL
Description
Insert array of items into vector, with L-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
Ownership of items in array is transferred to vector if no copy_init
method is set. This is to prevent multiple ownership of same object, once inserted into vector. Object won’t be usable after this call if copy_init
is not set.
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:259
:
/// FAILURE : Does not return
///
#define VecInsertRange(v, varr, idx, count) VecInsertRangeL((v), (varr), (idx), (count))
///
- In
Insert.h:371
:
/// FAILURE : Does not return on failure
///
#define VecPushBackArrL(v, arr, count) VecInsertRangeL((v), (arr), (v)->length, (count))
///
- In
Insert.h:414
:
/// FAILURE : Does not return on failure
///
#define VecPushFrontArrL(v, arr, count) VecInsertRangeL((v), (arr), 0, (count))
///
- In
Vec.Insert.c:429
:
// Test VecInsertRangeL
int range[] = {80, 90, 100};
VecInsertRangeL(&vec, range, 1, 3);
// Check that array elements are memset to 0