Dimensions in compile time

Vindex tech.vindex at gmail.com
Mon Feb 8 11:42:45 UTC 2021


size_t ndim(A)(A arr) {
     return std.algorithm.count(typeid(A).to!string, '[');
}

Is there a way to find out the number of dimensions in an array 
at compile time?


More information about the Digitalmars-d-learn mailing list