VecRemove

Table of Contents

VecRemove

Description

Remove item from vector at given index and store in given pointer. Order of elements is guaranteed to be preserved.

Parameters

NameDirectionDescription
vin,outVector to remove item from.
ptroutWhere removed item will be stored. If not provided then it’s equivalent to deleting the item at specified index.
idxinIndex in vector to remove item from.

Success

return

Failure

Does not return

Usage example (Cross-references)

    /// FAILURE : Returns NULL otherwise.
    ///
    #define StrRemove(str, chr, idx) VecRemove((str), (chr), (idx))
    
    ///
    /// FAILURE : Does not return
    ///
    #define VecPopBack(v, ptr) VecRemove((v), (ptr), (v)->length - 1)
    
    ///
    ///              to deleting item from last position.
    ///
    #define VecPopFront(v, ptr) VecRemove((v), (ptr), 0)
    
    ///
    /// FAILURE : Does not return
    ///
    #define VecDelete(v, idx) VecRemove((v), (VEC_DATATYPE(v) *)NULL, (idx))
    
    ///

Share :