On Wednesday, 18 July 2012 at 04:54:51 UTC, Jonathan M Davis wrote:
On Wednesday, July 18, 2012 06:27:28 Mike L. wrote:
Thanks for the reply. Not sure how I missed it there. Interesting
that the compiler has to be made aware of a concept that I had
thought was only supposed to be part of phobos. Would it be
possible to implement it in std.range using the new UFCs?

You can do

for(; !range.empty; range.popFront())
{
    auto e = range.front;
}

without the compiler doing anything at all. But if you want

for(e; range)
{}

you need a way in the language for the compiler to translate that into the above. UFCS has nothing to do with it. All UFCS does is take a.b(c, d) and
make it b(a, c, d).

- Jonathan M Davi

If UFCS worked on operators, you would be able to make ranges without any compiler support.

int opApply(T)(T Range) if(isInputRange!T) {
    // Stuff.
}

Reply via email to