Understanding isInfinite(Range)
Andrej Mitrovic
andrej.mitrovich at test.com
Mon Sep 6 12:48:49 PDT 2010
Yeah, that could work:
template isInputRange(R)
{
enum bool isInputRange = __traits(compiles,
{
R r; // can define a range object
if (r.empty) {} // can test for empty
r.popFront; // can invoke next
auto h = r.front; // can get the front of the range
});
}
It does look nice. It would look even nicer if __traits gets renamed to meta.
Stanislav Blinov Wrote:
> What about __traits(compiles) ?
More information about the Digitalmars-d-learn
mailing list