官术网_书友最值得收藏!

Function templates

A function template defines how a family of functions can be generated. A family here means a group of functions that behave similarly. As shown in the following diagram, this includes two phases:

  • Creating a function template; that is, the rules on how to write it.
  • Template instantiation; that is, the rules that are used to generate functions from their template:

Function template format

In part I of the preceding diagram, we discuss the format that will be used to create a function template for generic types, but with respect to the specialized template, which we also refer to as the primary template. Then, in part II, we introduce the three ways to generate functions from the template. Lastly, the specialization and overloading subsection tells us how to customize the primary template (by changing its behavior) for special types.

主站蜘蛛池模板: 祁阳县| 多伦县| 扬州市| 潮州市| 华蓥市| 正镶白旗| 仪征市| 台南市| 英超| 望都县| 阿合奇县| 红原县| 阿拉善盟| 中山市| 连山| 钟祥市| 鄂托克旗| 山西省| 靖远县| 确山县| 旌德县| 察哈| 太白县| 西华县| 扎囊县| 安吉县| 安顺市| 壶关县| 霍邱县| 龙川县| 专栏| 武川县| 望江县| 苍梧县| 萍乡市| 富民县| 玉龙| 舒兰市| 泰兴市| 镇江市| 句容市|