I just discovered that the is-operator can be used as in template ElementType(R) { static if (is(typeof(R.init.front.init) T)) alias ElementType = T; else alias ElementType = void; } . Very powerful. Is this documented?