This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
[temp.deduct.conv]
# 13 Templates [[temp]](./#temp)
## 13.10 Function template specializations [[temp.fct.spec]](temp.fct.spec#temp.deduct.conv)
### 13.10.3 Template argument deduction [[temp.deduct]](temp.deduct#conv)
#### 13.10.3.4 Deducing conversion function template arguments [temp.deduct.conv]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L8494)
Template argument deduction is done by comparing the return type of
the
conversion function template
(call itP)
with the type specified by the [*conversion-type-id*](class.conv.fct#nt:conversion-type-id "11.4.8.3Conversion functions[class.conv.fct]") of the[*conversion-function-id*](class.conv.fct#nt:conversion-function-id "11.4.8.3Conversion functions[class.conv.fct]") being looked up
(call it A) as described in [[temp.deduct.type]](temp.deduct.type "13.10.3.6Deducing template arguments from a type")[.](#1.sentence-1)
If the [*conversion-function-id*](class.conv.fct#nt:conversion-function-id "11.4.8.3Conversion functions[class.conv.fct]") is constructed during
overload resolution ([[over.match.funcs]](over.match.funcs "12.2.2Candidate functions and argument lists")),
the rules in the remainder of this subclause apply[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L8507)
If P is a reference type, the type referred to by P is used in place
of P for type deduction and for any further references to or transformations ofP in the remainder of this subclause[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L8512)
IfA is not a reference type:
- [(3.1)](#3.1)
IfP is an array type, the pointer type produced by the[array-to-pointer standard conversion](conv.array "7.3.3Array-to-pointer conversion[conv.array]") is used in place ofP for type
deduction; otherwise,
- [(3.2)](#3.2)
IfP is a function type, the pointer type produced by the[function-to-pointer standard conversion](conv.func "7.3.4Function-to-pointer conversion[conv.func]") is used in place ofP for
type deduction; otherwise,
- [(3.3)](#3.3)
IfP is a cv-qualified type, the top-level cv-qualifiers ofP's
type are ignored for type deduction[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L8541)
IfA is a cv-qualified type, the top-level cv-qualifiers ofA's
type are ignored for type deduction[.](#4.sentence-1)
IfA is a
reference type, the type referred to byA is used for type deduction[.](#4.sentence-2)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/templates.tex#L8554)
In general, the deduction process attempts to find template argument
values that will make the deducedA identical toA[.](#5.sentence-1)
However, certain attributes of A may be ignored:
- [(5.1)](#5.1)
If the original A is a reference type,
any cv-qualifiers of A (i.e., the type referred to by the reference)[.](#5.1.sentence-1)
- [(5.2)](#5.2)
If the original A is
a function pointer or pointer-to-member-function type
with a potentially-throwing exception specification ([[except.spec]](except.spec "14.5Exception specifications")),
the exception specification[.](#5.2.sentence-1)
- [(5.3)](#5.3)
Any cv-qualifiers in A that can be restored by a qualification conversion[.](#5.3.sentence-1)
These attributes are ignored only if type deduction would
otherwise fail[.](#5.sentence-3)
If ignoring them allows more than one possible deducedA,
the type deduction fails[.](#5.sentence-4)