Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I came across a question which asked the difference between Function Templates and Template Functions in C++ and also Template Classes and Class Templates.

I was under the impression that Function Templates and Template Functions were the same thing. Is there any difference between the two, if so what is it?

share|improve this question

2 Answers

up vote 3 down vote accepted

Is there any difference between the two, if so what is it?

No difference at all. If you google for it, you can see that somewhere it is defined as function templates and somewhere as template function.

I was under the impression that Function Templates and Template Functions were the same thing.

Your understanding was correct.

share|improve this answer
1  
I think "function template" and "class template" are the official terms, though. A "function template" is not really a function as "template function" would imply. – UncleBens Nov 27 '11 at 12:57

They are the same thing. The Standardese is "function template" and "class template", however many people (including myself) tend to refer to them as "template function" and "template class", for the simple and obvious reason that when you define one, first you write "template" and then you write "class", or a function. Hence, they are often referred to as both.

share|improve this answer
While you're not writing a function, but a template which can be converted into a function by the compiler ;-) – johannes Nov 27 '11 at 13:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.