Skip to content
VecPushFrontArrL

VecPushFrontArrL

Description

Prepend a contiguous range of elements at the front of the vector, preserving order of existing elements. L-value form takes ownership of the source on success when the vector has no copy_init handler.

Parameters

Name Direction Description
v in,out Vector handle.
arr in Pointer to the source array.
count in Number of elements to prepend.

Success

Returns true. The vector length grows by count; the prepended elements occupy [0, count); all previous elements have shifted right by count. When the vector has no copy_init handler, the source bytes have been zeroed.

Failure

Returns false on allocation failure. Both vector and source are unchanged.

Usage example (Cross-references)

Usage examples (Cross-references)
    
        // L-value array operations
        VecPushFrontArrL(&vec, arr, 3);
    
        // Check that the elements were added
    /// TAGS: Vec, PushFront, Range, Insert
    ///
    #define VecPushFrontArr(v, arr, count) VecPushFrontArrL((v), (arr), (count))
    
    ///
    #define VecMustPushFrontArrL(v, arr, count)                                                                            \
        do {                                                                                                               \
            if (!VecPushFrontArrL((v), (arr), (count))) {                                                                  \
                LOG_FATAL("VecMustPushFrontArrL failed");                                                                  \
            }                                                                                                              \
    /// TAGS: Str, PushFront, Range, LValue
    ///
    #define StrPushFrontArrL(str, arr, count) VecPushFrontArrL((str), (arr), (count))
    
    ///
Last updated on