Files
2025-10-25 03:02:53 +03:00

42 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[temp.deduct.decl]
# 13 Templates [[temp]](./#temp)
## 13.10 Function template specializations [[temp.fct.spec]](temp.fct.spec#temp.deduct.decl)
### 13.10.3 Template argument deduction [[temp.deduct]](temp.deduct#decl)
#### 13.10.3.7 Deducing template arguments from a function declaration [temp.deduct.decl]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L9479)
In a declaration whose [*declarator-id*](dcl.decl.general#nt:declarator-id "9.3.1General[dcl.decl.general]") refers to a specialization
of a function template, template argument deduction is performed to identify
the specialization to which the declaration refers[.](#1.sentence-1)
Specifically, this is done
for [explicit instantiations](temp.explicit "13.9.3Explicit instantiation[temp.explicit]"), [explicit specializations](temp.expl.spec "13.9.4Explicit specialization[temp.expl.spec]"),
and certain [friend declarations](temp.friend "13.7.5Friends[temp.friend]")[.](#1.sentence-2)
This is also done to
determine whether a deallocation function template specialization matches a placementoperator new ([[basic.stc.dynamic.deallocation]](basic.stc.dynamic.deallocation "6.8.6.5.3Deallocation functions"), [[expr.new]](expr.new "7.6.2.8New"))[.](#1.sentence-3)
In all these cases, P is the type of the function template being considered
as a potential match and A is either the function type from the
declaration
or the type of the deallocation function that would match the placementoperator new as described in [[expr.new]](expr.new "7.6.2.8New")[.](#1.sentence-4)
The
deduction is done as described in [[temp.deduct.type]](temp.deduct.type "13.10.3.6Deducing template arguments from a type")[.](#1.sentence-5)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L9494)
If, for the set of function templates so considered, there is either no match or
more than one match after partial ordering has been considered ([[temp.func.order]](temp.func.order "13.7.7.3Partial ordering of function templates")),
deduction fails and, in the declaration cases, the
program is ill-formed[.](#2.sentence-1)