VecRemoveRangeFast
Description
Remove count elements starting at start without preserving order. The removed slots are filled by swapping in elements from the tail.
Parameters
| Name | Direction | Description |
|---|---|---|
v |
in,out | Vector handle. |
ptr |
out | Optional destination buffer. Pass NULL to discard (the configured copy_deinit is invoked instead). |
start |
in | First removed index. |
count |
in | Number of elements to remove. |
Success
Returns to the caller. The vector length shrinks by count; the slots [start, start + count) are populated by elements pulled from what was previously the tail (no defined order). When ptr is non-NULL, the removed values have been bit-copied into *ptr (ownership transfers, copy_deinit not invoked). When ptr is NULL and copy_deinit is configured, the handler is invoked on each removed element.
Failure
Function cannot fail. start + count exceeding length is a caller bug and aborts via LOG_FATAL.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
VecCharPtr.c:288:
size_t index = extract_u32(data, offset, data_size) % VecLen(vec);
size_t count = extract_u32(data, offset, data_size) % (VecLen(vec) - index + 1);
VecRemoveRangeFast(vec, (char **)NULL, index, count);
}
break;- In
VecStr.c:294:
size_t index = extract_u32(data, offset, data_size) % VecLen(vec);
size_t count = extract_u32(data, offset, data_size) % (VecLen(vec) - index + 1);
VecRemoveRangeFast(vec, (Str *)NULL, index, count);
}
break;- In
VecInt.c:238:
if (len > 0 && start < len && count > 0 && start + count <= len) {
i32 removed_items[16];
VecRemoveRangeFast(vec, removed_items, start, count);
// Access removed items to test functionality
- In
Remove.h:244:
/// TAGS: Vec, Delete, Range, Fast, Unordered
///
#define VecDeleteRangeFast(v, start, count) VecRemoveRangeFast((v), (VEC_DATATYPE(v) *)NULL, (start), (count))
- In
Remove.h:97:
/// TAGS: Str, Remove, Range, Fast, Unordered
///
#define StrRemoveRangeFast(str, rd, start, count) VecRemoveRangeFast((str), (rd), (start), (count))
///
Last updated on