[Issue 10765] Cannot Use Index in Foreach When Iteratee is a Tuple

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 5 21:18:23 PDT 2013


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


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #1 from bearophile_hugs at eml.cc 2013-08-05 21:18:21 PDT ---
(In reply to comment #0)

>     foreach(i, left, right; zip("test", "test"))

A solution, that I think is the right one, is to use enumerate(), from Issue
5550 :

foreach (i, left, right; zip("test", "test").enumerate)

(But note that the unpacking of tuples in foreach is a very experimental
feature, don't rely too much on it.)

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