I can't help it. Slot templates, template classes, function templates, template functions

Source: Internet
Author: User

Recently in the data, found some blog on the "Class template, template class, function templates, template functions of the difference" and the like article. At a glance, close your eyes and think of yourself writing for so long C + +, know the template, know the function, also know the class. If I were to ask myself, a class template or a template class, I would assume that it was a class with a template. But I don't know what this "class template, template class, function template, template function" is.

Carefully read the next article, can not help but spit groove. In fact, the template is called a class template, instantiated called template class. The function of template is called function template, and it is called template function after instantiation. All right, you win. Knowing the template will know that the template will be instantiated by the compiler to generate concrete classes (functions). But not all programmers will know the template class, template function so awkward name. In other words, you go up the street and ask, does anyone know what "model Moon cake" is? Because all moon cakes are made from the moon cake mold, it should be called "Model Moon Cake".

So, I think this concept is still not good. One is that many books do not say the term template function (a lot of C + +), and second, we all think that after the instantiation is the ordinary class, function, called the class, function is good, if really need to emphasize, called after the instantiation of the function is easy to understand.

Check on the Internet, found that there are many. Among them, StackOverflow also found the relevant statement:

Q:Is there a difference between afunctionTemplate and a templatefunction, or between a class template and a template class?a:the Term"function Template"Refers to a kind of template. The term"template function"is sometimes used to mean the same thing,
And sometimes to mean afunctionInstantiated from afunctionTemplate. This ambiguity was best avoided by using"function Template"

For the former and something like "function template instance" or "instance of a function template" for the latter. Note that a function
Template is not a function. The same distinction applies to "class template" versus "template class". Note that the 1998 C + + standard used the terms "template class" and "template function" in some places, but this is Corre CTED in the 2003 version.

Http://stackoverflow.com/questions/1117755/what-is-the-difference-between-function-template-and-template-function

Http://womble.decadent.org.uk/c++/template-faq.html#phrase-order

PS: Just graduated interview was asked to the template of the special, I said I do not understand. Then said a half-day, the original is an instantiation, really embarrassing.

I can't help it. Slot templates, template classes, function templates, template functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.