Reply to Trass3r,
BCS schrieb:
I don't do 2.0 but it looks to me like your mixing runtime and
compile time stuff. A foreach over an array is a runtime foreach.
Do you know how I could make it run at compile-time?
template Tpl(T...)
{
alias T Tpl;
}
template Range(int l, int u)
{
static if(l<u)
alias Tpl!(l, Range!(l+1,u)) Range;
else
alias Tpl!(l) Range;
}
const char[][] set = ["Hello"[], "world" ];
void main()
{
foreach(str; Range!(0,set.length-1)) // compile time foreach over the numbers
from 0 to set.length-1
pragma(msg, set[str]);
}