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

  • Expert C++
  • Vardan Grigoryan Shunguang Wu
  • 141字
  • 2021-06-24 16:34:05

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.

主站蜘蛛池模板: 福泉市| 霞浦县| 正安县| 涿州市| 河曲县| 吉首市| 铁力市| 太白县| 句容市| 恩平市| 乐安县| 阳东县| 雅江县| 桂平市| 辽中县| 桂阳县| 南城县| 富裕县| 昌邑市| 商丘市| 肇州县| 苏尼特左旗| 安多县| 密山市| 汕尾市| 红原县| 呈贡县| 利川市| 岗巴县| 荆州市| 黑河市| 梁平县| 贡嘎县| 无锡市| 海原县| 咸阳市| 鞍山市| 合水县| 茂名市| 孙吴县| 米易县|