[Issue 5550] std.range.enumerate()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 16 09:32:10 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=5550



--- Comment #11 from Jakob Ovrum <jakobovrum at gmail.com> 2014-01-16 09:32:06 PST ---
(In reply to comment #10)
> > This could also be implemented in the language (though
> > potentially ambiguous with automatic foreach unpacking),
> > but here's a library solution for review.
> 
> In some cases I like language-level solutions, but in this case I think the
> library solution is good enough and safer.

Review of a PR is probably best done on Github.

> Regarding your implementation, I suggest to add an optional "start" argument,
> as in Python enumerate():
> 
> auto data = [10, 20];
> foreach (i; x; data.enumerate(3))
>     write(i, " ");
> 
> ==>
> 
> 3 4

Thanks, I'll add it.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list