[Issue 6366] New: alias this doesn't work with foreach range.front

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 23 05:24:41 PDT 2011


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

           Summary: alias this doesn't work with foreach range.front
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2011-07-23 05:24:39 PDT ---
This is similar bug2781, but different.

If range.front is alias this tuple (like std.typecons.Tuple), foreach statement
does not expand it automatically.

Example:
auto r = zip(sequence!"n", "hello");
// typeof(r.front) == Tuple!(int, char)
foreach (i, ch; r)
{
   if (i == 0) assert(ch == 'h');
   if (i == 1) assert(ch == 'e');
   if (i == 2) assert(ch == 'l');
   if (i == 3) assert(ch == 'l');
   if (i == 4) assert(ch == 'o');
}

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


More information about the Digitalmars-d-bugs mailing list