I was going over the D tutorials on tuples and noticed that it's possible to do 
a "foreach" across the tuple items.  I'm assuming this is a compile-time 
foreach, is that correct?

I've been looking for a way to do a compile-time "foreach" for a different 
problem, namely complete loop unrolling.  I have a performance-sensitive "atoi" 
routine that knows, at compile-time, the length of the string (but not the 
string itself).  I've been thinking of solving this problem using static if(len 
== 1) { .. } static if(len == 2) { .. } and so on up to len = 22, and not 
supporting any longer than that.  It severely violates the "DRY" principle, and 
the function becomes a thousand lines of code (and a nightmare to ever change, 
since changes have to be made 22x times).

I would like to solve this problem with a compile-time foreach; how do I do so? 
 "static foreach" is not valid syntax in D.

Reply via email to