H. S. Teoh:
I implemented this before, but it got rejected because people
insisted
that it must return a range of Tuple, but Tuple is defined in
Phobos and
druntime can't have dependencies on Phobos. :-(
Maybe I'll take another shot at this, since this question keeps
coming up.
One possible solution: have a hidden but documented runtime
function that yields 2-item structs, and add a
"std.range.byPairs" range and a "std.range.pairs" function to
Phobos that yield the tuples (byPairs could use a cast to convert
the runtime struct to the Phobos tuple).
Bye,
bearophile