www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4508] New: tuples should be indexable with foreach over range

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 puremagic.com
        ReportedBy: dsimcha yahoo.com


--- Comment #0 from David Simcha <dsimcha 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: -------
Jul 26 2010