- 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.
推薦閱讀
- Web程序設(shè)計及應(yīng)用
- MySQL數(shù)據(jù)庫管理實戰(zhàn)
- R語言數(shù)據(jù)分析從入門到精通
- 零基礎(chǔ)學(xué)C++程序設(shè)計
- Rake Task Management Essentials
- Python機器學(xué)習(xí):手把手教你掌握150個精彩案例(微課視頻版)
- Hands-On Natural Language Processing with Python
- ANSYS Fluent 二次開發(fā)指南
- Node.js全程實例
- SQL基礎(chǔ)教程(第2版)
- C++20高級編程
- Vue.js 2 Web Development Projects
- Android傳感器開發(fā)與智能設(shè)備案例實戰(zhàn)
- Serverless Web Applications with React and Firebase
- Building Slack Bots