tmp/tmp24mse27k/{from.md → to.md}
RENAMED
|
@@ -49,20 +49,21 @@ state with an unspecified value.
|
|
| 49 |
``` cpp
|
| 50 |
template<class F> function(F f);
|
| 51 |
template <class F, class A> function(allocator_arg_t, const A& a, F f);
|
| 52 |
```
|
| 53 |
|
| 54 |
-
*Requires:* `F` shall be `CopyConstructible`.
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
| 58 |
|
| 59 |
*Postconditions:* `!*this` if any of the following hold:
|
| 60 |
|
| 61 |
-
- `f` is a
|
| 62 |
-
- `f` is a
|
| 63 |
-
- `F` is an instance of the `function` class template, and `!f`
|
| 64 |
|
| 65 |
Otherwise, `*this` targets a copy of `f` initialized with
|
| 66 |
`std::move(f)`. Implementations are encouraged to avoid the use of
|
| 67 |
dynamically allocated memory for small callable objects, for example,
|
| 68 |
where `f`’s target is an object holding only a pointer or reference to
|
|
@@ -90,11 +91,11 @@ function& operator=(function&& f);
|
|
| 90 |
|
| 91 |
``` cpp
|
| 92 |
function& operator=(nullptr_t);
|
| 93 |
```
|
| 94 |
|
| 95 |
-
*Effects:* If `*this !=
|
| 96 |
|
| 97 |
*Postconditions:* `!(*this)`.
|
| 98 |
|
| 99 |
*Returns:* `*this`
|
| 100 |
|
|
@@ -104,10 +105,15 @@ template<class F> function& operator=(F&& f);
|
|
| 104 |
|
| 105 |
*Effects:* `function(std::forward<F>(f)).swap(*this);`
|
| 106 |
|
| 107 |
*Returns:* `*this`
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
``` cpp
|
| 110 |
template<class F> function& operator=(reference_wrapper<F> f) noexcept;
|
| 111 |
```
|
| 112 |
|
| 113 |
*Effects:* `function(f).swap(*this);`
|
|
@@ -116,7 +122,7 @@ template<class F> function& operator=(reference_wrapper<F> f) noexcept;
|
|
| 116 |
|
| 117 |
``` cpp
|
| 118 |
~function();
|
| 119 |
```
|
| 120 |
|
| 121 |
-
*Effects:* If `*this !=
|
| 122 |
|
|
|
|
| 49 |
``` cpp
|
| 50 |
template<class F> function(F f);
|
| 51 |
template <class F, class A> function(allocator_arg_t, const A& a, F f);
|
| 52 |
```
|
| 53 |
|
| 54 |
+
*Requires:* `F` shall be `CopyConstructible`.
|
| 55 |
+
|
| 56 |
+
*Remarks:* These constructors shall not participate in overload
|
| 57 |
+
resolution unless `f` is Callable ([[func.wrap.func]]) for argument
|
| 58 |
+
types `ArgTypes...` and return type `R`.
|
| 59 |
|
| 60 |
*Postconditions:* `!*this` if any of the following hold:
|
| 61 |
|
| 62 |
+
- `f` is a null function pointer value.
|
| 63 |
+
- `f` is a null member pointer value.
|
| 64 |
+
- `F` is an instance of the `function` class template, and `!f`.
|
| 65 |
|
| 66 |
Otherwise, `*this` targets a copy of `f` initialized with
|
| 67 |
`std::move(f)`. Implementations are encouraged to avoid the use of
|
| 68 |
dynamically allocated memory for small callable objects, for example,
|
| 69 |
where `f`’s target is an object holding only a pointer or reference to
|
|
|
|
| 91 |
|
| 92 |
``` cpp
|
| 93 |
function& operator=(nullptr_t);
|
| 94 |
```
|
| 95 |
|
| 96 |
+
*Effects:* If `*this != nullptr`, destroys the target of `this`.
|
| 97 |
|
| 98 |
*Postconditions:* `!(*this)`.
|
| 99 |
|
| 100 |
*Returns:* `*this`
|
| 101 |
|
|
|
|
| 105 |
|
| 106 |
*Effects:* `function(std::forward<F>(f)).swap(*this);`
|
| 107 |
|
| 108 |
*Returns:* `*this`
|
| 109 |
|
| 110 |
+
*Remarks:* This assignment operator shall not participate in overload
|
| 111 |
+
resolution unless `declval<typename decay<F>::type&>()` is
|
| 112 |
+
Callable ([[func.wrap.func]]) for argument types `ArgTypes...` and
|
| 113 |
+
return type `R`.
|
| 114 |
+
|
| 115 |
``` cpp
|
| 116 |
template<class F> function& operator=(reference_wrapper<F> f) noexcept;
|
| 117 |
```
|
| 118 |
|
| 119 |
*Effects:* `function(f).swap(*this);`
|
|
|
|
| 122 |
|
| 123 |
``` cpp
|
| 124 |
~function();
|
| 125 |
```
|
| 126 |
|
| 127 |
+
*Effects:* If `*this != nullptr`, destroys the target of `this`.
|
| 128 |
|