Skip to content
VecForeachPtrInRange

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)
                    if (start < end) {
                        size_t total_len = 0;
                        VecForeachPtrInRange(vec, str_ptr, start, end) {
                            total_len += ZstrLen(*str_ptr);
                        }
                    if (start < end) {
                        size_t total_len = 0;
                        VecForeachPtrInRange(vec, str_ptr, start, end) {
                            total_len += StrLen(str_ptr);
                        }
                    if (start < end) {
                        int sum = 0;
                        VecForeachPtrInRange(vec, item_ptr, start, end) {
                            sum += *item_ptr;
                        }
    /// TAGS: Str, Foreach, Iterate, Range
    ///
    #define StrForeachPtrInRange(str, chrptr, start, end) VecForeachPtrInRange((str), (chrptr), (start), (end))
    
    #ifdef __cplusplus
Last updated on