I use:
template<class T>
Arbol<T>::Arbol(){
}
when T
you are going to do a class.
and use:
template<typename T>
Arbol<T>::Arbol(){
}
when it is going T
to be a type, for example bool
, that is, char
fundamental types.
But looking at a code fragment of a program (not created by me) I saw that it used typename
where I usually use class
, and until now I had not noticed that. if now you ask me why, well, I wouldn't be able to say one hundred percent why, but perhaps somehow I (imagine) that the compiler differentiated when it was a type included in the language and acted accordingly.
My question is:
Is it the same to use one or the other?
Well, now I've tested both of them and they work fine, but I don't know if I'm missing something, or maybe there's some subtle difference between class
and typename
in this context.