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

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.

主站蜘蛛池模板: 宝坻区| 醴陵市| 固阳县| 东丽区| 尚志市| 武隆县| 额尔古纳市| 麻栗坡县| 九寨沟县| 涟源市| 乌兰察布市| 诸暨市| 衡南县| 贡山| 浑源县| 农安县| 柳河县| 柳河县| 康平县| 琼海市| 南丹县| 瑞安市| 宜阳县| 方山县| 乌海市| 华坪县| 长葛市| 离岛区| 琼中| 阿坝| 富源县| 纳雍县| 诸城市| 临安市| 修武县| 武安市| 八宿县| 双鸭山市| 石河子市| 广饶县| 崇州市|