Understanding isInfinite(Range)

Andrej Mitrovic andrej.mitrovich at test.com
Fri Sep 3 08:12:29 PDT 2010


I was reading about the various range templates in std.range and I found this:

http://www.digitalmars.com/d/2.0/phobos/std_range.html#isInfinite

Seems simple enough. But I dont understand it's implementation, this from range.d:

template isInfinite(Range)
{
    static if (isInputRange!Range && is(char[1 + Range.empty]))
        enum bool isInfinite = !Range.empty;
    else
        enum bool isInfinite = false;
}

What does char[1 + Range.empty] do? It looks rather cryptic..


More information about the Digitalmars-d-learn mailing list