Am 21.07.2014 03:34, schrieb Vlad Levenfeld:
You're very welcome. The reason foreach(int i, x; argTuple) failed is because argTuple is a value (of type T), and so known only at run-time.
Hmm but the only thing the compiler would need to know at compile-time is still i, which only depends on argTuple.length which is known at compile-time.
But ok, I can kinda understand that this doesn't work, probably foreach either operates completely on compile-time stuff (and does so statically) or completely on runtime-stuff, done dynamically.
To get a foreach to run at compile-time, you have to give it something whose value is known to the compiler (so, T and typeof(argTuple) would suffice, and 0..T.length really should as well).
Yup
A nice way to test is "pragma(msg, Foo)" where Foo is your argument... if its knowable at compile-time, then your compiler should output "Foo" (or the name of whatever its aliasing) to the console.
Thanks for the advice! Cheers, Daniel