On Sun, Nov 24, 2013 at 8:09 PM, Uranuz <neura...@gmail.com> wrote: > As far as I understand I can't use immutable values as template arguments.
Indeed not. They are not defined at compile-time. > //Some template method > void foo(string arg)() > { //Some actions here > > } > > void main() > { > foreach( name, item; pohodEnumValues ) > { foo!(name)(); //I need name at compile time here > } > } > //----------------- > > Because we have only compile time foreach over tuple this is not working. > Can someone give an advice, please? I see some possibilities, but they might be a bit overkill. In increasing order of coding effort: 1) use a tuple (as you suggest in another post) 2) use functions to build the code you want (as a string) and then mix it in. Using functions, you can use iterative code as much as you wish. 3) Another, more far-fetched, option is to use a struct. Since your AA is defined at compile-time, I would not create an AA, but a struct, crafting it to mimic your AA.