in modern code typename is preferred.
I got that that was what was being asserted, but what I wondered was why.
I looked it up. In this context, there's no actual difference between them. The "mandatory" typename use applies when using a nested type within a template parameter T, that is, T::bar, if that is supposed to be a type, must be qualified as typename T::bar otherwise it will be treated during syntax/etc. analysis as if it is a value / variable, and might cause ... hilarity.
Yes, there's places where
typename is required, which is an entirely different context and is extremely annoying because it adds up to a shit-ton of clutter obliterating the actual code.
@Steve_The_Cynic said in CppUnit:
I make class to be five letters.
Ok, ok, very large values of four maybe ; I'll let you borrow my for a while.
However, the human semantics of typename in a template parameter declaration are clearer
IMHO, if you try to apply human semantics and intuition to C++ template code, you've already lost; better to not start getting used to doing so. And also IMHO, given the number of times you have to write that in all but the most utterly trivial cases, the excessive length of
typename does quickly add up to being an actual code readability problem.