> > Your template. Types are not values, you cannot declare a constant > that is a type. You have to use alias instead: > > template BaseType(T: T[]) { alias BaseType!(T) BaseType; } > template BaseType(T) { alias T BaseType; }
Erm, why did this print corretly? writefln(`BaseType = `, BaseType!(T).stringof ); btw. Thanks for everything !! It's nice to get some comments after a fews days of struggling with them templates :) I can now parse any numeric type (array) till depth 4; still haven't found a way to generalize this part :( private void Parse(T)(ref T parsed) { .. switch( depth ) { case 0: if( temp.length < index[depth] ) temp.length = temp.length * 2; break; static if( is(T A:A[][])) { case 1: if( temp[ index[0] ].length < index[depth] ) temp[index[0]].length = temp[index[0]].length * 2; break; } static if( is(T A:A[][][])) { case 2: if( temp[ index[0] ][ index[1] ].length < index[depth] ) temp[ index[0] ][ index[1] ].length = temp[ index[0] ][ index[1] ].length * 2; break; } default: assert(false); break; } .. }