Skip to content

VecRemoveFast

VecRemoveFast

Description

Remove item from vector at given index and store in given pointer. Order of elements inside vector is not guaranteed to be preserved. The implementation is faster in some scenarios that VecRemove

Parameters

Name Direction Description
v in,out Vector to remove item from.
ptr out Where removed item will be stored. If not provided then it’s equivalent to deleting the item at specified index.
idx in Index in vector to remove item from.

Success

return

Failure

Does not return

Usage example (Cross-references)

Usage examples (Cross-references)
                    size_t index = extract_u32(data, offset, size) % VecLen(vec);
                    char  *str;
                    VecRemoveFast(vec, &str, index);
                    // char_ptr_deinit is called automatically by the vector
                }
                    size_t index = extract_u32(data, offset, size) % VecLen(vec);
                    Str    str;
                    VecRemoveFast(vec, &str, index);
                    // StrDeinit is called automatically by the vector
                }
                if (idx < VecLen(vec)) {
                    i32 removed;
                    VecRemoveFast(vec, &removed, idx);
                }
                break;
    /// FAILURE : Does not return
    ///
    #define VecDeleteFast(v, idx) VecRemoveFast((v), (VEC_DATATYPE(v) *)NULL, (idx))
    
    ///
Last updated on