VecForeachInRange
- Macro
- August 22, 2025
Table of Contents
VecForeachInRange
VecForeachInRange
Description
Iterate over elements in a specific range of the given vector v
. This is a convenience macro that iterates over a range using an internally managed index. The variable var
is declared and defined by this macro.
Parameters
Name | Direction | Description |
---|---|---|
v | in,out | Vector to iterate over. |
var | in | Name of variable to be used which’ll contain value of the current element. |
start | in | Starting index (inclusive). |
end | in | Ending index (exclusive). |
Success
The body
is executed for each element of the vector v
from the start
index to the end-1
index.
Failure
If the vector v
is NULL, its length is zero, or the range is invalid, the loop body will not be executed. Any failures within the VecForeachInRangeIdx
macro will result in a fatal log message and program termination.
Usage example (Cross-references)
- In
Foreach.h:168
:
/// macro will result in a fatal log message and program termination.
///
#define StrForeachInRange(str, chr, start, end, body) VecForeachInRange((str), (chr), (start), (end), {body})
///