Structs with a disabled default ctor can't pass as ranges

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Sep 24 14:33:37 PDT 2011


I've ran into a bit of an issue. isInputRange is defined like this:

template isInputRange(R)
{
    enum bool isInputRange = is(typeof(
    {
        R r;              // can define a range object
        if (r.empty) {}   // can test for empty
        r.popFront();     // can invoke popFront()
        auto h = r.front; // can get the front of the range
    }()));
}

But this will fail for structs which have a disabled default ctor. Was
this planned?


More information about the Digitalmars-d mailing list