On Wednesday, 17 June 2015 at 20:33:11 UTC, Namespace wrote:
---- import std.stdio;template BaseTypeOf(T) { static if (is(T : U[], U)) alias BaseTypeOf = BaseTypeOf!(U); else alias BaseTypeOf = T; } void foo(T : U[], U)(T arr) if (is(BaseTypeOf!(U) == real)) { } void main() { //real _x; real[2] x; real[2][2] xx; real[2][2][2] xxx; //float[2] yy; //foo(_x); foo(x); foo(xx); foo(xxx); //foo(yy); } ---- should work
Thanks. I'm going to make a lot of use of this. I would say it deserves to be in std.traits.
