I have following code:

import std.array, std.range, std.stdio;

struct CommonInputRange(E)
{
    @property bool delegate() empty;
    @property E delegate() front;
    void delegate() popFront;
}

void main(string[] args)
{
    alias CommonInputRange!dchar DCRange;
    static assert(isInputRange!DCRange);
    DCRange dc;
    auto dcr = "abcdefg";
    auto t = dcr.takeExactly(3);
    dc.empty = &t.empty;
    dc.front = &t.front;
    dc.popFront = &t.popFront;

    for ( ; !dc.empty(); dc.popFront())
        writeln(dc.front());
}

As you can see in the for loop, range primitives must be called using parens (), otherwise they don't work.

Do you know if there are plans to implement @property for delegates and function pointers?

Reply via email to