On Monday, 16 December 2013 at 20:38:52 UTC, Andrei Alexandrescu wrote:
bool between(T, U1, U2)(T v, U1 lo, U2 hi)
{
    return v >= lo && v <= hi;
}


I must say that:

    if (val.between(3, 10))

sure is a lot easier to understand at a glance than:

    if (val >= 3 && val <= 10)

Although there is a problem with the word "between" not being clear about whether it is inclusive or not.

I do kind of enjoy the Ruby-style DSL-lite they use to make code more readable so I'm for it.

Reply via email to