Files
cppdraft_translate/cppdraft/temp/fct/general.md
2025-10-25 03:02:53 +03:00

2.0 KiB

[temp.fct.general]

13 Templates [temp]

13.7 Template declarations [temp.decls]

13.7.7 Function templates [temp.fct]

13.7.7.1 General [temp.fct.general]

1

#

A function template defines an unbounded set of related functions.

[Example 1:

A family of sort functions can be declared like this:template class Array { };template void sort(Array&);

— end example]

2

#

[Note 1:

A function template can have the same name as other function templates and non-template functions ([dcl.fct]) in the same scope.

— end note]

A non-template function is not related to a function template (i.e., it is never considered to be a specialization), even if it has the same name and type as a potentially generated function template specialization.115

115)115)

That is, declarations of non-template functions do not merely guide overload resolution of function template specializations with the same name.

If such a non-template function is odr-used ([basic.def.odr]) in a program, it must be defined; it will not be implicitly instantiated using the function template definition.