Extract base type of any array?

Kirill kirill.saidov at mail.com
Sun Sep 19 03:58:41 UTC 2021


How can I get the base type of any 
(multidimensional/static/dynamic/associative) array?

Example:
```
void main() {
     int[][] intArr;
     double[4][] doubleArr;
     string[string][] strArr;

     intArr.example; // T = int
     doubleArr.example; // T = double
     strArr.example; // T = string
}

void example(T)(<...> data) {
     // extract the base of data (inside func's body or in <...>)
     // preferably, T must become data's base type
}
```


More information about the Digitalmars-d-learn mailing list