When using template template syntax as in template class T>
, it is requi
I'm looking for the rational behind this restriction [...]
Before C++11 was introduced, the only templates you could pass to a template template parameter were class templates.
That's why the use of the keyword class
was enforced.
Additionally, the keyword typename
implies that the template parameter is a substitution for an arbitrary type and not a template, so using typename
in that context would just blur the line between the names of types and (class) templates.
That's comprehensible.
Nowadays, such arguments can be the names of class templates or alias templates, and since those aren't even remotely connected, the enforcement of the keyword class
is more or less obsolete. The proposal N4051 opts to change this with C++1Z.