Typename or class?

N

nietoperz34

Welcome. What better use in templates C++? Typename or class?
Better yes:
template <class T1, class T2>
T1 function(T2 argument);
Or better yes:
template <typename T1, typename T2>
T1 function(T2 argument);
 
J

Juha Nieminen

Jorgen Grahn said:
I didn't know #2 was valid, so I have to say #1.

You didn't know that #2 is valid, so you have to say #1? What sense does
that make?
 
J

Jorgen Grahn

You didn't know that #2 is valid, so you have to say #1? What sense does
that make?

Do I really have to spell it out?

Ok: I have frequently seen #1, but never or rarely #2. So I assume #1
is the most common form, and thus the preferable one.

/Jorgen
 
P

Pavel

Leigh said:
Who says? You?
Count me in, too. Talleyrand once said that speech was given to man to disguise
his thoughts; this may be true for diplomats but I think programming languages
were given to engineers to honestly express their intentions (whether or not the
compilers enforce the implied contracts).

-Pavel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top