Project

General

Profile

Feature #3069

Iterator over span and indices into this span (zip-style iterator)

Added by Christian Blau 4 months ago.

Status:
New
Priority:
Low
Category:
core library
Target version:
Difficulty:
uncategorized
Close

Description

We have a common pattern in code that we iterate over a span of values span, as well as a span of indices into it.

To make this type of code easier to write, understand and less error-prone we would like to have an iterator for this that allows range-based loops in these cases.

Implementation suggestion from Mark:
"An object that is constructed with a span of values and a span of indices into it, that can return begin and end iterators. The iterator objects are different, and have the span of values and an iterator into the indices. The end iterator contains the indices end iterator to support comparison with end."

Also available in: Atom PDF