Ray's playground

 

C++ templates chapter 7(Basic Template Terminology)

  • The term class template states that the class is a template. That is, it is a parameterized description of a family of classes.

  • The term template class on the other hand has been used

    - as a synonym for class template.

    - to refer to classes generated from templates.

    - to refer to classes with a name that is a template-id.


  • The process of creating a regular class, function, or member function from a template by substituting actual values for its arguments is called template instantiation. This resulting entity (class, function, or member function) is generically called a specialization.

    The One-Definition Rule:
  • Noninline functions and member functions, as well as global variables and static data members should be defined only once across the whole program.

  • Class types (including structs and unions) and inline functions should be defined at most once per translation unit, and all these definitions should be identical.

  •  

  • Template parameters are those names that are listed after the keyword template in the template declaration or definition (T and N in our example).

  • Template arguments are the items that are substituted for template parameters (double and 10 in our example). Unlike template parameters, template arguments can be more than just "names."


  • posted on 2009-09-25 09:17  Ray Z  阅读(222)  评论(0)    收藏  举报

    导航