http://d.puremagic.com/issues/show_bug.cgi?id=3514


Steven Schveighoffer <schvei...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |


--- Comment #4 from Steven Schveighoffer <schvei...@yahoo.com> 2009-11-16 
13:07:44 PST ---
This bug supersedes bug 2984, because solving this bug will not only address
the problem in 2984, but address a very important problem that is not
identified in 2984.  That is:  if opApply is present *at all* it should
override any range functionality when sending to foreach.  This includes the
case not identified in 2984 in which valid range operations are present
*alongside* opApply.  e.g.:

import std.stdio;

struct S
{
    int front()
    {
        return 0;
    }

    bool empty()
    {
        return true;
    }

    void popFront()
    {
    }

    int opApply(int delegate(ref int x) dg)
    {
        writeln("inside opapply");
        int x = 0;
        return dg(x);
    }
}

void main()
{
    S s;
    foreach(i; s)
    {
        writeln("inside loop %d", i);
    }
}

Currently outputs nothing, it should output:
inside opapply
inside loop 0

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to