DMD 0.170 release

Bill Baxter dnewsgroup at billbaxter.com
Tue Oct 17 22:54:51 PDT 2006


Oskar Linde wrote:
> Tom S wrote:
> 
> [snip proposal]
> 

> The possibilities seem endless. It is almost scary. And best of all: It 
> doesn't contain a single template. :)

Er, but what if you want to support more than int[] as the type to be 
looped over?

 > void each(int[] a, void delegate(int) dg, inout void* ret) {
 >     for (int i = 0; i < a.length; ++i) {
 >         dg(a[i]);
 >         if (ret) return;
 >     }
 > }

Looks to me like you've got you an int[]-specific looper there.  Gonna 
need some templates to make that generic, no?

--bb



More information about the Digitalmars-d-announce mailing list