Reducing template constraint verbosity? [was Re: Slides from my ACCU Silicon Valley talk]
Patrick Down
pat at codemoon.com
Tue Dec 14 12:35:30 PST 2010
== Quote from Steven Schveighoffer (schveiguy at yahoo.com)'s article
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) {...}
More information about the Digitalmars-d
mailing list