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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 17 16:32:04 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=4508

Dmitry Olshansky <dmitry.olsh at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dmitry.olsh at gmail.com
         Resolution|---                         |FIXED

--- Comment #5 from Dmitry Olshansky <dmitry.olsh at gmail.com> ---
With static foreach you can do this, and AFAICT is exactly what is required:

import std.typecons;

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

--


More information about the Digitalmars-d-bugs mailing list