[Issue 1642] static foreach support for arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 10 01:52:03 PDT 2010


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


Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras at gmail.com


--- Comment #2 from Simen Kjaeraas <simen.kjaras at gmail.com> 2010-05-10 01:51:48 PDT ---
This template lets you iterate through a compile-time array as a tuple. Not as
good as the real thing, but might be worth having around.

template ArrayToTuple( alias T ) {
    static if( T.length > 1 ) {
        alias TypeTuple!( T[ 0 ], ArrayToTuple!( T[ 1..$ ] ) ) ArrayToTuple;
    } else {
        alias TypeTuple!( T[ 0 ] ) ArrayToTuple;
    }
}

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