On 12/17/13 7:59 AM, Jerry wrote:
Andrei Alexandrescu <[email protected]> writes:bool between(T, U1, U2)(T v, U1 lo, U2 hi) { return v >= lo && v <= hi; }+1uint among(T, Us...)(T v, Us vals) { foreach (i, U; Us) { if (v == vals[i]) return i + 1; } return 0; }This seems less useful to me. What was the example where you found it useful? Jerry
I gave a long litany of examples taken from real code in a subsequent post. In fact I couldn't find motivating examples for "between", or even significant evidence that it would be dramatically useful; I'd included it only for completion, and I have since retracted it.
Andrei
