|
Template Numerical Library version\ main:4e6e2c1
|
This page provides an overview of all traversal functions available for segment operations, helping to understand the differences between variants and choose the right function for your needs.
Traversal functions are organized along two main dimensions:
| Category | Operates On | Lambda Parameter | Use Case |
|---|---|---|---|
| Element-wise (forElements, forAllElements) | Individual elements | Element indices | Operate on each element separately |
| Segment-wise (forSegments, forAllSegments) | Whole segments | SegmentView object | Operate on segments as units |
When to use:
Similar to other segment operations, traversal functions come in different scopes and conditional variants.
| Scope | Segments Processed | Parameters |
|---|---|---|
| All | All segments | No range/array parameters |
| Range | Segments [begin, end) | begin and end indices |
| Array | Specific segments | Array of segment indices |
| If | Segment condition | Process segments based on segment-level properties |
These functions iterate over individual elements within segments:
| Function | Segments Processed | Description |
|---|---|---|
| forAllElements | All segments | Process all elements in all segments |
| forElements (range) | Segments [begin, end) | Process elements in segment range |
| forElements (array) | Segments in array | Process elements in specified segments |
| forAllElementsIf | All segments | Segment-level condition |
| forElementsIf | Segments [begin, end) | Segment-level condition |
These functions iterate over segments as whole units:
| Function | Segments Processed | Description |
|---|---|---|
| forAllSegments | All segments | Process all segments |
| forSegments (range) | Segments [begin, end) | Process segments in range |
| forSegments (array) | Segments in array | Process specified segments |
| forAllSegmentsIf | All segments | Segment-level condition |
| forSegmentsIf | Segments [begin, end) | Segment-level condition |
All traversal functions share these common parameters:
Additional parameters for specific variants: