https://issues.dlang.org/show_bug.cgi?id=15357
Alex Parrill <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #3 from Alex Parrill <[email protected]> --- >From looking at the code of `each`, it seems to be intended to only work on opApply structs that only pass one value per iteration; if you instantiate `each` with a two-argument function, `each` supplies the index of the current element as the first parameter, and the element itself as the second element. The problem is that the latter case is implemented via a standard foreach loop, i.e. `foreach(i, elem; iter)`; if iter returns pairs of elements, then the `i` value is hijacked to become the first element instead. So the question is whether `each` should support n-ary opApply iterators at all. If yes, then the opApply case for `each` should be expanded; if no, then some additional checks should be placed on `each` to prevent accepting `opApply` functions that pass in more than 1 element. --
