tmp/tmpc4rchgph/{from.md → to.md}
RENAMED
|
@@ -1,16 +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 |
-
[[
|
| 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 [[
|
| 12 |
|
| 13 |
*Remarks:* The template parameter `T` of `declval` may be an incomplete
|
| 14 |
type.
|
| 15 |
|
| 16 |
[*Example 1*:
|
|
@@ -18,11 +18,11 @@ type.
|
|
| 18 |
``` cpp
|
| 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 |
-
|
| 24 |
-
For another example see class template `common_type`
|
| 25 |
[[meta.trans.other]].
|
| 26 |
|
| 27 |
— *end example*]
|
| 28 |
|
|
|
|
| 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 |
+
[[term.unevaluated.operand]].
|
| 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 [[term.odr.use]].
|
| 12 |
|
| 13 |
*Remarks:* The template parameter `T` of `declval` may be an incomplete
|
| 14 |
type.
|
| 15 |
|
| 16 |
[*Example 1*:
|
|
|
|
| 18 |
``` cpp
|
| 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 |
+
overload resolution if the type `From` can be explicitly converted to
|
| 24 |
+
type `To`. For another example see class template `common_type`
|
| 25 |
[[meta.trans.other]].
|
| 26 |
|
| 27 |
— *end example*]
|
| 28 |
|