> It's kind of the right idea, but.. it's also kind of weird. > > template ArrayDepth(T: T[]) { const ArrayDepth = 1 + ArrayDepth!(T); } > template ArrayDepth(T) { const ArrayDepth = 0; } > > This lets you get the depth of any array _type_, like > ArrayDepth!(int[][]) gives 2.
Although I don't fully understand your code, I think I modified it correctly to get the base type of an array :) template BaseType(T: T[]) { const BaseType = BaseType!(T); } template BaseType(T) {const BaseType = T; }