[Issue 4508] New: tuples should be indexable with foreach over range

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 26 09:53:14 PDT 2010


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

           Summary: tuples should be indexable with foreach over range
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2010-07-26 09:53:12 PDT ---
The following should really work, as long as the bounds of the foreach loop are
known at compile time:

import std.typecons;

void main() {
    auto tup = tuple(1, "foo", 3.0).expand;
    foreach(i; 0..tup.length) {
        auto val = tup[i];
    }
}

-- 
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