tmp/tmpi7ioxpvs/{from.md → to.md}
RENAMED
|
@@ -2,12 +2,10 @@
|
|
| 2 |
|
| 3 |
##### General <a id="func.wrap.func.general">[[func.wrap.func.general]]</a>
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
-
template<class> class function; // not defined
|
| 8 |
-
|
| 9 |
template<class R, class... ArgTypes>
|
| 10 |
class function<R(ArgTypes...)> {
|
| 11 |
public:
|
| 12 |
using result_type = R;
|
| 13 |
|
|
@@ -51,16 +49,10 @@ namespace std {
|
|
| 51 |
The `function` class template provides polymorphic wrappers that
|
| 52 |
generalize the notion of a function pointer. Wrappers can store, copy,
|
| 53 |
and call arbitrary callable objects [[func.def]], given a call signature
|
| 54 |
[[func.def]].
|
| 55 |
|
| 56 |
-
A callable type [[func.def]] `F` is *Lvalue-Callable* for argument types
|
| 57 |
-
`ArgTypes` and return type `R` if the expression
|
| 58 |
-
`INVOKE<R>(declval<F&>(), declval<ArgTypes>()...)`, considered as an
|
| 59 |
-
unevaluated operand [[term.unevaluated.operand]], is well-formed
|
| 60 |
-
[[func.require]].
|
| 61 |
-
|
| 62 |
The `function` class template is a call wrapper [[func.def]] whose call
|
| 63 |
signature [[func.def]] is `R(ArgTypes...)`.
|
| 64 |
|
| 65 |
[*Note 1*: The types deduced by the deduction guides for `function`
|
| 66 |
might change in future revisions of C++. — *end note*]
|
|
@@ -82,11 +74,11 @@ function(nullptr_t) noexcept;
|
|
| 82 |
``` cpp
|
| 83 |
function(const function& f);
|
| 84 |
```
|
| 85 |
|
| 86 |
*Ensures:* `!*this` if `!f`; otherwise, the target object of `*this` is
|
| 87 |
-
a copy of `f
|
| 88 |
|
| 89 |
*Throws:* Nothing if `f`’s target is a specialization of
|
| 90 |
`reference_wrapper` or a function pointer. Otherwise, may throw
|
| 91 |
`bad_alloc` or any exception thrown by the copy constructor of the
|
| 92 |
stored callable object.
|
|
@@ -116,12 +108,11 @@ template<class F> function(F&& f);
|
|
| 116 |
Let `FD` be `decay_t<F>`.
|
| 117 |
|
| 118 |
*Constraints:*
|
| 119 |
|
| 120 |
- `is_same_v<remove_cvref_t<F>, function>` is `false`, and
|
| 121 |
-
- `FD
|
| 122 |
-
`ArgTypes...` and return type `R`.
|
| 123 |
|
| 124 |
*Mandates:*
|
| 125 |
|
| 126 |
- `is_copy_constructible_v<FD>` is `true`, and
|
| 127 |
- `is_constructible_v<FD, F>` is `true`.
|
|
@@ -202,12 +193,12 @@ function& operator=(nullptr_t) noexcept;
|
|
| 202 |
|
| 203 |
``` cpp
|
| 204 |
template<class F> function& operator=(F&& f);
|
| 205 |
```
|
| 206 |
|
| 207 |
-
*Constraints:* `decay_t<F>
|
| 208 |
-
|
| 209 |
|
| 210 |
*Effects:* As if by: `function(std::forward<F>(f)).swap(*this);`
|
| 211 |
|
| 212 |
*Returns:* `*this`.
|
| 213 |
|
|
|
|
| 2 |
|
| 3 |
##### General <a id="func.wrap.func.general">[[func.wrap.func.general]]</a>
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
|
|
|
|
|
|
| 7 |
template<class R, class... ArgTypes>
|
| 8 |
class function<R(ArgTypes...)> {
|
| 9 |
public:
|
| 10 |
using result_type = R;
|
| 11 |
|
|
|
|
| 49 |
The `function` class template provides polymorphic wrappers that
|
| 50 |
generalize the notion of a function pointer. Wrappers can store, copy,
|
| 51 |
and call arbitrary callable objects [[func.def]], given a call signature
|
| 52 |
[[func.def]].
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
The `function` class template is a call wrapper [[func.def]] whose call
|
| 55 |
signature [[func.def]] is `R(ArgTypes...)`.
|
| 56 |
|
| 57 |
[*Note 1*: The types deduced by the deduction guides for `function`
|
| 58 |
might change in future revisions of C++. — *end note*]
|
|
|
|
| 74 |
``` cpp
|
| 75 |
function(const function& f);
|
| 76 |
```
|
| 77 |
|
| 78 |
*Ensures:* `!*this` if `!f`; otherwise, the target object of `*this` is
|
| 79 |
+
a copy of the target object of `f`.
|
| 80 |
|
| 81 |
*Throws:* Nothing if `f`’s target is a specialization of
|
| 82 |
`reference_wrapper` or a function pointer. Otherwise, may throw
|
| 83 |
`bad_alloc` or any exception thrown by the copy constructor of the
|
| 84 |
stored callable object.
|
|
|
|
| 108 |
Let `FD` be `decay_t<F>`.
|
| 109 |
|
| 110 |
*Constraints:*
|
| 111 |
|
| 112 |
- `is_same_v<remove_cvref_t<F>, function>` is `false`, and
|
| 113 |
+
- `is_invocable_r_v<R, FD&, ArgTypes...>` is `true`.
|
|
|
|
| 114 |
|
| 115 |
*Mandates:*
|
| 116 |
|
| 117 |
- `is_copy_constructible_v<FD>` is `true`, and
|
| 118 |
- `is_constructible_v<FD, F>` is `true`.
|
|
|
|
| 193 |
|
| 194 |
``` cpp
|
| 195 |
template<class F> function& operator=(F&& f);
|
| 196 |
```
|
| 197 |
|
| 198 |
+
*Constraints:* `is_invocable_r_v<R, decay_t<F>&, ArgTypes...>` is
|
| 199 |
+
`true`.
|
| 200 |
|
| 201 |
*Effects:* As if by: `function(std::forward<F>(f)).swap(*this);`
|
| 202 |
|
| 203 |
*Returns:* `*this`.
|
| 204 |
|