tmp/tmp_myavd_p/{from.md → to.md}
RENAMED
|
@@ -3,25 +3,27 @@
|
|
| 3 |
The library provides the function template `declval` to simplify the
|
| 4 |
definition of expressions which occur as unevaluated operands (Clause
|
| 5 |
[[expr]]).
|
| 6 |
|
| 7 |
``` cpp
|
| 8 |
-
template <class T>
|
| 9 |
-
add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
|
| 10 |
```
|
| 11 |
|
| 12 |
*Remarks:* If this function is odr-used ([[basic.def.odr]]), the
|
| 13 |
program is ill-formed.
|
| 14 |
|
| 15 |
*Remarks:* The template parameter `T` of `declval` may be an incomplete
|
| 16 |
type.
|
| 17 |
|
|
|
|
|
|
|
| 18 |
``` cpp
|
| 19 |
-
template <class To, class From>
|
| 20 |
-
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
|
| 26 |
-
|
|
|
|
|
|
|
| 27 |
|
|
|
|
| 3 |
The library provides the function template `declval` to simplify the
|
| 4 |
definition of expressions which occur as unevaluated operands (Clause
|
| 5 |
[[expr]]).
|
| 6 |
|
| 7 |
``` cpp
|
| 8 |
+
template <class T> add_rvalue_reference_t<T> declval() noexcept; // as unevaluated operand
|
|
|
|
| 9 |
```
|
| 10 |
|
| 11 |
*Remarks:* If this function is odr-used ([[basic.def.odr]]), the
|
| 12 |
program is ill-formed.
|
| 13 |
|
| 14 |
*Remarks:* The template parameter `T` of `declval` may be an incomplete
|
| 15 |
type.
|
| 16 |
|
| 17 |
+
[*Example 1*:
|
| 18 |
+
|
| 19 |
``` cpp
|
| 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 |
|