ListRemoveRange

Table of Contents

ListRemoveRange

Description

Remove data from list in given range [start, start + count) Order of elements is guaranteed to be preserved.

Parameters

NameDirectionDescription
lin,outList to remove item from.
rdoutWhere removed data will be stored. If not provided then it’s equivalent to deleting the items in specified range.
startinIndex in list to removing items from.
countinNumber of items from starting index.

Success

Returns v on success.

Failure

Returns NULL otherwise.

Usage example (Cross-references)

    if (list->length > 0 && start < list->length && count > 0 && start + count <= list->length) {
    i32 removed_items[16];
    ListRemoveRange(list, removed_items, start, count);
    }
    break;
    /// Delete items in given range [start, start + count)
    ///
    #define ListDeleteRange(l, start, count) ListRemoveRange((l), NULL, (start), (count))
    
    #endif // MISRA_STD_CONTAINER_LIST_REMOVE_H

Share :