Skip to content
VecPushBackArrL

VecPushBackArrL

Description

Append a contiguous range of elements to the end of the vector. 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 append.

Success

Returns true. The vector length grows by count; the appended elements occupy [old_length, new_length). When the vector has no copy_init handler, the count * sizeof(element) 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)
    
        // Test VecPushBackArrL
        VecPushBackArrL(&vec, arr, 3);
    
        // Check vector length
    
        // Test VecPushBackArrL
        VecPushBackArrL(&vec, items, 3);
    
        // Check that all items were zeroed
        // Test array operations
        int arr[] = {40, 50, 60};
        VecPushBackArrL(&vec, arr, 3);
    
        // Check that array elements are zeroed
    /// TAGS: Vec, PushBack, Range, Insert
    ///
    #define VecPushBackArr(v, arr, count) VecPushBackArrL((v), (arr), (count))
    
    ///
    #define VecMustPushBackArrL(v, arr, count)                                                                             \
        do {                                                                                                               \
            if (!VecPushBackArrL((v), (arr), (count))) {                                                                   \
                LOG_FATAL("VecMustPushBackArrL failed");                                                                   \
            }                                                                                                              \
    /// TAGS: Str, PushBack, Range, LValue
    ///
    #define StrPushBackArrL(str, arr, count) VecPushBackArrL((str), (arr), (count))
    
    ///
Last updated on