1. Function template
One of the most important concepts about templates is specialization . Although many templates can be written, none of them are function definitions. If you want to get the definition of a function, you have to dereify it. There are three methods of concretization:
- Implicit instantiation: that is, when it is used, it is judged according to the type of the parameter
- Explicit instantiation: that is, self-declaration instantiation
- Explicit reification: Declaring that a type does not conform to a template definition.
Two, class template
Forget it, dove.