----
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

Reply via email to