VecInsertRangeFastL

Table of Contents

VecInsertRangeFastL

Description

Quickly insert array of items into vector, with L-value semantics. Ordering of elements is not guaranteed to be preserved. This call makes significant difference only for sufficiently large vectors and when idx is quite less than (v)->length. Insertion time is guaranteed to be constant for same data types.

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

NameDirectionDescription
vin,outVector to insert item into
valinArray of items to be inserted
idxinIndex to insert item at.
countinNumber of items to insert.

Success

return

Failure

Does not return

Usage example (Cross-references)

    /// FAILURE : Does not return
    ///
    #define VecInsertRangeFast(v, varr, idx, count) VecInsertRangeFastL((v), (varr), (idx), (count))
    
    ///
    /// FAILURE : Does not return on failure
    ///
    #define VecPushFrontArrFastL(v, arr, count) VecInsertRangeFastL((v), (arr), 0, (count))
    
    ///
    // Test VecInsertRangeFastL
    int fast_range[] = {110, 120, 130};
    VecInsertRangeFastL(&vec, fast_range, 3, 3);
    
    // Check that array elements are memset to 0

Share :