I’m curious as to why anonymous template typename/class declarations are allowed, such as the following:
template <typename, class, typename> struct TemplateTest1 { int a; float b ; } ;
TemplateTest1 <int, int, int> tt1 ;
Can anyone explain the practical value of these anonymous types? Do they affect the expression of the templated structure?
By anonymous, I assume you meant unnamed template parameter.
It’s allowed, because sometimes you may not need the template argument, and so making it anonymous makes it clear to programmer that the argument is not used anywhere in the class, although it’s not that necessary.
It is similar to the way a function with an unnamed parameter is allowed: