Skip to content
VecInsertRangeR

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.

If copy_init is set, then vector will create it’s own copy of items.
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)

Usage examples (Cross-references)
                        values[i] = (i32)extract_u32(data, offset, size);
                    }
                    VecInsertRangeR(vec, values, idx, count);
                }
                break;
        // Push an array at a specific index
        int values[] = {30, 40, 50};
        VecInsertRangeR(&vec, values, 1, 3);
    
        // Check length
    
        // Insert range in the middle
        VecInsertRangeR(&vec, src.data, 1, src.length);
    
        // Check length
    /// FAILURE : Does not return on failure
    ///
    #define VecPushBackArrR(v, arr, count) VecInsertRangeR((v), (arr), (v)->length, (count))
    
    ///
    /// FAILURE : Does not return on failure
    ///
    #define VecPushFrontArrR(v, arr, count) VecInsertRangeR((v), (arr), 0, (count))
    
    ///
    /// FAILURE : Does not return
    ///
    #define StrInsertCstr(str, cstr, idx, len) VecInsertRangeR((str), (cstr), (idx), (len))
    
    ///
    /// FAILURE : NULL
    ///
    #define StrPushCstr(str, cstr, len, pos) VecInsertRangeR((str), (cstr), (pos), (len))
    
    ///
Last updated on