"the last change" for ranges

Nick Sabalausky a at a.a
Wed May 20 21:20:23 PDT 2009


"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
news:gv2hj8$k1n$1 at digitalmars.com...
> dsimcha wrote:
>
> Consider:
>
> struct R
> {
>     bool empty();
>     ref int front();
>     void popFront();
> }
>
> ref int popNext(ref R fwdRange)
> {
>     auto result = & fwdRange.front();
>     fwdRange.popFront;
>     return *result;
> }
>
> void main()
> {
>     R r;
>     int x = r.popNext;
> }
>
> This should work, I just noticed with surprise it doesn't. It's a bug, 
> specifically bug 3015:
>
> http://d.puremagic.com/issues/show_bug.cgi?id=3015
>

I thought that was only supposed to work for arrays. Has that changed? If 
so, what's the new rule?





More information about the Digitalmars-d mailing list