tmp/tmpp0jee2qe/{from.md → to.md}
RENAMED
|
@@ -1,17 +1,16 @@
|
|
| 1 |
### Function template `declval` <a id="declval">[[declval]]</a>
|
| 2 |
|
| 3 |
The library provides the function template `declval` to simplify the
|
| 4 |
-
definition of expressions which occur as unevaluated operands
|
| 5 |
-
[[expr]]
|
| 6 |
|
| 7 |
``` cpp
|
| 8 |
template<class T> add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
|
| 9 |
```
|
| 10 |
|
| 11 |
-
*
|
| 12 |
-
program is ill-formed.
|
| 13 |
|
| 14 |
*Remarks:* The template parameter `T` of `declval` may be an incomplete
|
| 15 |
type.
|
| 16 |
|
| 17 |
[*Example 1*:
|
|
@@ -20,10 +19,10 @@ type.
|
|
| 20 |
template<class To, class From> decltype(static_cast<To>(declval<From>())) convert(From&&);
|
| 21 |
```
|
| 22 |
|
| 23 |
declares a function template `convert` which only participates in
|
| 24 |
overloading if the type `From` can be explicitly converted to type `To`.
|
| 25 |
-
For another example see class template `common_type`
|
| 26 |
-
[[meta.trans.other]]
|
| 27 |
|
| 28 |
— *end example*]
|
| 29 |
|
|
|
|
| 1 |
### Function template `declval` <a id="declval">[[declval]]</a>
|
| 2 |
|
| 3 |
The library provides the function template `declval` to simplify the
|
| 4 |
+
definition of expressions which occur as unevaluated operands
|
| 5 |
+
[[expr.prop]].
|
| 6 |
|
| 7 |
``` cpp
|
| 8 |
template<class T> add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
|
| 9 |
```
|
| 10 |
|
| 11 |
+
*Mandates:* This function is not odr-used [[basic.def.odr]].
|
|
|
|
| 12 |
|
| 13 |
*Remarks:* The template parameter `T` of `declval` may be an incomplete
|
| 14 |
type.
|
| 15 |
|
| 16 |
[*Example 1*:
|
|
|
|
| 19 |
template<class To, class From> decltype(static_cast<To>(declval<From>())) convert(From&&);
|
| 20 |
```
|
| 21 |
|
| 22 |
declares a function template `convert` which only participates in
|
| 23 |
overloading if the type `From` can be explicitly converted to type `To`.
|
| 24 |
+
For another example see class template `common_type`
|
| 25 |
+
[[meta.trans.other]].
|
| 26 |
|
| 27 |
— *end example*]
|
| 28 |
|