Hi
Actually from point of programming language usage
using class and typename in template declaration/definition are same.
For who likes less typing, class is shorter than typename.
I believe programmers has some personal convention for using class or
typename. For example Andrei Alexandrescu wrote in his book
Modern C++ Design:
Template parameters are declared with class if they can be only a user-
defined type, and with
typename if they can also be a primitive type.
But, please note: typename has another totally separated usage when
programming
templates. For example:
template<class Container>
void SomeFunc(Container c)
{
typename Container::ElemType e; // You have to use typename
// ...
}

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!