book chapter · Apress eBooks · 2023
Function Templates
Cited by 0Abstract and details only
Abstract
You may have noticed that some of the overloaded functions in Ex8_15 consisted of exactly the same code. The only difference were the types that appear in the parameter list. It seems an unnecessary overhead to have to write the same code over and over, just because it has to work for different types. And indeed it is. In such situations you can write the code just once, as a function template. The Standard Library, for instance, makes heavy use of this feature to ensure that its functions work optimally with any type, including your own custom types, which of course the library cannot know about in advance. This chapter introduces the basics of defining your own function templates that work with any type you desire.
Cite this paper
Horton, I., & Van Weert, P. (2023). Function Templates. Apress eBooks, 371–390. https://doi.org/10.1007/978-1-4842-9343-0_10
Horton, Ivor, and Peter Van Weert. “Function Templates.” Apress eBooks, 2023, pp. 371–90, https://doi.org/10.1007/978-1-4842-9343-0_10.
Horton, Ivor, and Peter Van Weert. 2023. “Function Templates.” Apress eBooks: 371–90. https://doi.org/10.1007/978-1-4842-9343-0_10.
Horton, I. and Van Weert, P. (2023) ‘Function Templates’, Apress eBooks, pp. 371–390. Available at: https://doi.org/10.1007/978-1-4842-9343-0_10.
@incollection{horton2023function,
title = {{Function Templates}},
author = {Horton, Ivor and Van Weert, Peter},
booktitle = {Apress eBooks},
pages = {371--390},
year = {2023},
doi = {10.1007/978-1-4842-9343-0_10}
}Made from the index record. Check names, capitalisation and page numbers against the paper. Need another style? AI for Research has over 10,000.
Related papers
Template routes to interlocked molecular structures and orderly molecular entanglements
Timothy Jay Hubin, Daryle H. Busch · Coordination Chemistry Reviews · 2000
Cited by 383
Writing Generic Code with Templates
Marc Gregoire · Wiley eBooks · 2018
Cited by 0
The preparation of Mg–Al spinels through the method of using templates
Qiang Zhang, Jie Yang, Ya-nan Gao et al. · Applied Petrochemical Research · 2015
Cited by 3Open access
Templates
Nancy Gill · Apress eBooks · 2003
Cited by 0
Writing Generic Code with Templates
Marc Gregoire · Wiley eBooks · 2021
Cited by 0
New Tin Templates for the Synthesis of Macrocyclic Polythiaether−Polythiaester Ligands
Ines Vujasinović, Jelena Veljković, Kata Mlinarić‐Majerski · The Journal of Organic Chemistry · 2004
Cited by 17
Novel Method to Modify the Surface of Templates in the Fabrication of Porous Ceramics
Liping Jia · Cailiao daobao · 2007
Cited by 0
Advanced Templates
Marc Gregoire · Wiley eBooks · 2024
Cited by 0Open access