"Patrick Down" <[email protected]> wrote in message
news:[email protected]...
> Would it help to allow 'else' and 'else if' on the template constraints?
>
> void foo(R)(R r) if(isRandomAccessRange!R)
> {...}
> else if(isInputRange!R)
> {...}
>
> This could basically be translated into two specializations like this:
>
> void foo(R)(R r) if(isRandomAccessRange!R) {...}
> void foo(R)(R r) if(isInputRange!R && !isRandomAccessRange!R) {...}
>
>
You can sorta already do this...
template foo(R)
{
static if (isRandomAccessRange!R)
foo(R r) {}
else static if (isInputRange!R)
foo(R r) {}
else
static assert(0, "R must be at least an input range");
}