D-Programming-Language/phobos — pull request #2032 by AndrejMitrovic (2014-03-20 11:16:28+00:00)
Title: Add the DimensionCount trait.

New template matching rules in git-head allow this code to work and be implemented in a very simple way. For 2.065 you can use:

```D
enum DimensionCount(T : E[], E) = DimCountImpl!E + 1;

private enum DimCountImpl(T : E[], E) = DimCountImpl!E + 1;
static if (__VERSION__ > 2065)
private enum DimCountImpl(T) = 0;
else
template DimCountImpl(T) if (!is(T : E[], E)) { enum DimCountImpl = 0; }
```

I'm ok either way if this makes it in or not, but it looks so nice I thought I'd make a pull.