VecForeachPtrInRange
Description
Walk elements of v in the half-open range [start, end), binding var to a pointer to each element. Convenience wrapper around VecForeachPtrInRangeIdx with an internally-managed index. See VecForeachPtrInRangeIdx for the full SUCCESS/FAILURE contract.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
VecCharPtr.c:617:
if (start < end) {
size_t total_len = 0;
VecForeachPtrInRange(vec, str_ptr, start, end) {
total_len += ZstrLen(*str_ptr);
}- In
VecStr.c:595:
if (start < end) {
size_t total_len = 0;
VecForeachPtrInRange(vec, str_ptr, start, end) {
total_len += StrLen(str_ptr);
}- In
VecInt.c:528:
if (start < end) {
int sum = 0;
VecForeachPtrInRange(vec, item_ptr, start, end) {
sum += *item_ptr;
}- In
Foreach.h:135:
/// TAGS: Str, Foreach, Iterate, Range
///
#define StrForeachPtrInRange(str, chrptr, start, end) VecForeachPtrInRange((str), (chrptr), (start), (end))
#ifdef __cplusplus
Last updated on