When defining a function template or class template in C++, one can write this:
template <class T> ...
or one can write this:
template <typename T> ...
Is there a good reason to prefer one over the other?
I accepted the most popular (and interesting) answer, but the real answer seems to be "No, there is no good reason to prefer one over the other."
- They are equivalent.
- Some people have reasons to always use
typename
. - Some people have reasons to always use
class
. - Some people have reasons to use both.
- Some people don't care which one they use.