template< typename T1> or template< class T1>

Eljay Love-Jensen eljay@adobe.com
Fri May 14 20:40:00 GMT 2004


Hi Jeff,

 >Which is the preferred syntax?

I prefer "typename T1", but Stroustrup prefers "class T1" (less typing).

 >Are these equivalent?

I believe so.

 >Can anything else besides "typename" or "class" be used?

Sort of.  You could have...
template <class T, int Value>
...but that int Value doesn't have the same broad range of types that class 
(or typename) have.

HTH,
--Eljay



More information about the Gcc-help mailing list