tmp/tmp02fgudy3/{from.md → to.md}
RENAMED
|
@@ -35,32 +35,31 @@ A type `T` containing a placeholder type, and a corresponding
|
|
| 35 |
single brace-enclosed *assignment-expression* and E is the
|
| 36 |
*assignment-expression*.
|
| 37 |
- If the initializer is a parenthesized *expression-list*, the
|
| 38 |
*expression-list* shall be a single *assignment-expression* and E is
|
| 39 |
the *assignment-expression*.
|
| 40 |
-
- For a
|
| 41 |
-
placeholder type, `T` is the declared type of the
|
| 42 |
parameter and E is the corresponding template argument.
|
| 43 |
|
| 44 |
`T` shall not be an array type.
|
| 45 |
|
| 46 |
If the *placeholder-type-specifier* is of the form *type-constraint*ₒₚₜ
|
| 47 |
`auto`, the deduced type T' replacing `T` is determined using the rules
|
| 48 |
for template argument deduction. If the initialization is
|
| 49 |
copy-list-initialization, a declaration of `std::initializer_list` shall
|
| 50 |
precede [[basic.lookup.general]] the *placeholder-type-specifier*.
|
| 51 |
-
Obtain `P` from `T` by replacing the
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
deduced `U` into `P`.
|
| 60 |
|
| 61 |
-
[*Example
|
| 62 |
|
| 63 |
``` cpp
|
| 64 |
auto x1 = { 1, 2 }; // decltype(x1) is std::initializer_list<int>
|
| 65 |
auto x2 = { 1, 2.0 }; // error: cannot deduce element type
|
| 66 |
auto x3{ 1, 2 }; // error: not a single element
|
|
@@ -68,11 +67,11 @@ auto x4 = { 3 }; // decltype(x4) is std::initializer_list<int>
|
|
| 68 |
auto x5{ 3 }; // decltype(x5) is int
|
| 69 |
```
|
| 70 |
|
| 71 |
— *end example*]
|
| 72 |
|
| 73 |
-
[*Example
|
| 74 |
|
| 75 |
``` cpp
|
| 76 |
const auto &i = expr;
|
| 77 |
```
|
| 78 |
|
|
@@ -88,11 +87,11 @@ template <class U> void f(const U& u);
|
|
| 88 |
If the *placeholder-type-specifier* is of the form *type-constraint*ₒₚₜ
|
| 89 |
`decltype(auto)`, `T` shall be the placeholder alone. The type deduced
|
| 90 |
for `T` is determined as described in [[dcl.type.decltype]], as though
|
| 91 |
E had been the operand of the `decltype`.
|
| 92 |
|
| 93 |
-
[*Example
|
| 94 |
|
| 95 |
``` cpp
|
| 96 |
int i;
|
| 97 |
int&& f();
|
| 98 |
auto x2a(i); // decltype(x2a) is int
|
|
|
|
| 35 |
single brace-enclosed *assignment-expression* and E is the
|
| 36 |
*assignment-expression*.
|
| 37 |
- If the initializer is a parenthesized *expression-list*, the
|
| 38 |
*expression-list* shall be a single *assignment-expression* and E is
|
| 39 |
the *assignment-expression*.
|
| 40 |
+
- For a constant template parameter declared with a type that contains a
|
| 41 |
+
placeholder type, `T` is the declared type of the constant template
|
| 42 |
parameter and E is the corresponding template argument.
|
| 43 |
|
| 44 |
`T` shall not be an array type.
|
| 45 |
|
| 46 |
If the *placeholder-type-specifier* is of the form *type-constraint*ₒₚₜ
|
| 47 |
`auto`, the deduced type T' replacing `T` is determined using the rules
|
| 48 |
for template argument deduction. If the initialization is
|
| 49 |
copy-list-initialization, a declaration of `std::initializer_list` shall
|
| 50 |
precede [[basic.lookup.general]] the *placeholder-type-specifier*.
|
| 51 |
+
Obtain `P` from `T` by replacing the occurrence of *type-constraint*ₒₚₜ
|
| 52 |
+
`auto` either with a new invented type template parameter `U` or, if the
|
| 53 |
+
initialization is copy-list-initialization, with
|
| 54 |
+
`std::initializer_list<U>`. Deduce a value for `U` using the rules of
|
| 55 |
+
template argument deduction from a function call [[temp.deduct.call]],
|
| 56 |
+
where `P` is a function template parameter type and the corresponding
|
| 57 |
+
argument is E. If the deduction fails, the declaration is ill-formed.
|
| 58 |
+
Otherwise, T' is obtained by substituting the deduced `U` into `P`.
|
|
|
|
| 59 |
|
| 60 |
+
[*Example 9*:
|
| 61 |
|
| 62 |
``` cpp
|
| 63 |
auto x1 = { 1, 2 }; // decltype(x1) is std::initializer_list<int>
|
| 64 |
auto x2 = { 1, 2.0 }; // error: cannot deduce element type
|
| 65 |
auto x3{ 1, 2 }; // error: not a single element
|
|
|
|
| 67 |
auto x5{ 3 }; // decltype(x5) is int
|
| 68 |
```
|
| 69 |
|
| 70 |
— *end example*]
|
| 71 |
|
| 72 |
+
[*Example 10*:
|
| 73 |
|
| 74 |
``` cpp
|
| 75 |
const auto &i = expr;
|
| 76 |
```
|
| 77 |
|
|
|
|
| 87 |
If the *placeholder-type-specifier* is of the form *type-constraint*ₒₚₜ
|
| 88 |
`decltype(auto)`, `T` shall be the placeholder alone. The type deduced
|
| 89 |
for `T` is determined as described in [[dcl.type.decltype]], as though
|
| 90 |
E had been the operand of the `decltype`.
|
| 91 |
|
| 92 |
+
[*Example 11*:
|
| 93 |
|
| 94 |
``` cpp
|
| 95 |
int i;
|
| 96 |
int&& f();
|
| 97 |
auto x2a(i); // decltype(x2a) is int
|