Why not convert the enum type explicitly to an integer and use this integer as an index in ```n_element_types```, for instance:
```
n_element_types[static_cast<int>(t)]++
```
I do not know if this works, but if it works it would save some lines :-)