On 9/18/12, Andrej Mitrovic <[email protected]> wrote: > On 9/18/12, Andrej Mitrovic <[email protected]> wrote: >> foreach (aa, bb; lockstep(arr1, arr2)) >> { >> if (aa == sentinel) >> { >> if (aa % 2 == 0) > > Gah I've messed up the simple example. If aa was a sentinel then it > meant I wouldn't check it at all, I'd try to check 'bb' instead. >
Here we go: http://dpaste.dzfl.pl/dff850fb Hardcoded but could be made to work with multiple ranges (+ i have way too many runtime checks there). For floating-point this might even work since a sentinel could be NaN, but for ints there's no reasonable sentinel. We could use pointers instead and use NULL when the range is empty.
