- tmp/tmprz7c8qo7/{from.md → to.md} +102 -78
tmp/tmprz7c8qo7/{from.md → to.md}
RENAMED
|
@@ -9,149 +9,173 @@ callable objects.
|
|
| 9 |
namespace std {
|
| 10 |
template<class T> struct is_bind_expression; // see below
|
| 11 |
}
|
| 12 |
```
|
| 13 |
|
| 14 |
-
`is_bind_expression` can be used to detect function
|
| 15 |
-
`bind`.
|
|
|
|
| 16 |
|
| 17 |
Instantiations of the `is_bind_expression` template shall meet the
|
| 18 |
-
UnaryTypeTrait requirements ([[meta.rqmts]]). The implementation
|
| 19 |
-
provide a definition that has a
|
| 20 |
-
is a type returned from `bind`, otherwise it shall have a
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
#### Class template `is_placeholder` <a id="func.bind.isplace">[[func.bind.isplace]]</a>
|
| 27 |
|
| 28 |
``` cpp
|
| 29 |
namespace std {
|
| 30 |
template<class T> struct is_placeholder; // see below
|
| 31 |
}
|
| 32 |
```
|
| 33 |
|
| 34 |
-
`is_placeholder` can be used to detect the standard
|
| 35 |
-
`_2`, and so on.
|
|
|
|
| 36 |
|
| 37 |
Instantiations of the `is_placeholder` template shall meet the
|
| 38 |
-
UnaryTypeTrait requirements ([[meta.rqmts]]). The implementation
|
| 39 |
-
provide a definition that has the
|
| 40 |
`integral_constant<int, J>` if `T` is the type of
|
| 41 |
-
`std::placeholders::_J`, otherwise it shall have a
|
| 42 |
-
`integral_constant<int, 0>`. A program may specialize this template
|
| 43 |
-
a user-defined type `T` to have a
|
| 44 |
`integral_constant<int, N>` with `N > 0` to indicate that `T` should be
|
| 45 |
treated as a placeholder type.
|
| 46 |
|
| 47 |
#### Function template `bind` <a id="func.bind.bind">[[func.bind.bind]]</a>
|
| 48 |
|
| 49 |
-
In the text that follows
|
| 50 |
-
meanings:
|
| 51 |
|
| 52 |
- `FD` is the type `decay_t<F>`,
|
| 53 |
- `fd` is an lvalue of type `FD` constructed from `std::forward<F>(f)`,
|
| 54 |
-
- `
|
| 55 |
-
- `
|
| 56 |
-
- `
|
| 57 |
-
- `
|
| 58 |
-
`std::forward<
|
| 59 |
-
- `
|
| 60 |
the forwarding call wrapper, and
|
| 61 |
-
- `
|
| 62 |
|
| 63 |
``` cpp
|
| 64 |
template<class F, class... BoundArgs>
|
| 65 |
unspecified bind(F&& f, BoundArgs&&... bound_args);
|
| 66 |
```
|
| 67 |
|
| 68 |
-
*Requires:* `
|
| 69 |
-
|
| 70 |
-
*
|
| 71 |
-
expression for some values
|
| 72 |
-
`
|
|
|
|
| 73 |
|
| 74 |
-
*Returns:* A forwarding call wrapper `g`
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
*Throws:* Nothing unless the construction of `fd` or of one of the
|
| 85 |
-
values `
|
| 86 |
|
| 87 |
*Remarks:* The return type shall satisfy the requirements of
|
| 88 |
-
`MoveConstructible`. If all of `FD` and `
|
| 89 |
of `CopyConstructible`, then the return type shall satisfy the
|
| 90 |
-
requirements of `CopyConstructible`.
|
| 91 |
-
|
|
|
|
|
|
|
| 92 |
|
| 93 |
``` cpp
|
| 94 |
template<class R, class F, class... BoundArgs>
|
| 95 |
unspecified bind(F&& f, BoundArgs&&... bound_args);
|
| 96 |
```
|
| 97 |
|
| 98 |
-
*Requires:* `
|
| 99 |
-
|
| 100 |
-
*
|
| 101 |
-
values
|
|
|
|
|
|
|
| 102 |
|
| 103 |
-
*Returns:* A forwarding call wrapper `g`
|
| 104 |
-
`
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
the
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
*Throws:* Nothing unless the construction of `fd` or of one of the
|
| 114 |
-
values `
|
| 115 |
|
| 116 |
*Remarks:* The return type shall satisfy the requirements of
|
| 117 |
-
`MoveConstructible`. If all of `FD` and `
|
| 118 |
of `CopyConstructible`, then the return type shall satisfy the
|
| 119 |
-
requirements of `CopyConstructible`.
|
| 120 |
-
`TiD` are `MoveConstructible`.
|
| 121 |
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
from the call to `bind` and the *cv*-qualifiers *cv* of the call wrapper
|
| 125 |
-
`g` as follows:
|
| 126 |
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
- if
|
| 133 |
-
|
| 134 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
#### Placeholders <a id="func.bind.place">[[func.bind.place]]</a>
|
| 137 |
|
| 138 |
``` cpp
|
| 139 |
-
namespace std {
|
| 140 |
-
namespace placeholders {
|
| 141 |
// M is the implementation-defined number of placeholders
|
| 142 |
-
|
| 143 |
-
|
| 144 |
.
|
| 145 |
.
|
| 146 |
.
|
| 147 |
-
|
| 148 |
-
}
|
| 149 |
}
|
| 150 |
```
|
| 151 |
|
| 152 |
All placeholder types shall be `DefaultConstructible` and
|
| 153 |
`CopyConstructible`, and their default constructors and copy/move
|
| 154 |
constructors shall not throw exceptions. It is *implementation-defined*
|
| 155 |
whether placeholder types are `CopyAssignable`. `CopyAssignable`
|
| 156 |
placeholders’ copy assignment operators shall not throw exceptions.
|
| 157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
namespace std {
|
| 10 |
template<class T> struct is_bind_expression; // see below
|
| 11 |
}
|
| 12 |
```
|
| 13 |
|
| 14 |
+
The class template `is_bind_expression` can be used to detect function
|
| 15 |
+
objects generated by `bind`. The function template `bind` uses
|
| 16 |
+
`is_bind_expression` to detect subexpressions.
|
| 17 |
|
| 18 |
Instantiations of the `is_bind_expression` template shall meet the
|
| 19 |
+
`UnaryTypeTrait` requirements ([[meta.rqmts]]). The implementation
|
| 20 |
+
shall provide a definition that has a base characteristic of `true_type`
|
| 21 |
+
if `T` is a type returned from `bind`, otherwise it shall have a base
|
| 22 |
+
characteristic of `false_type`. A program may specialize this template
|
| 23 |
+
for a user-defined type `T` to have a base characteristic of `true_type`
|
| 24 |
+
to indicate that `T` should be treated as a subexpression in a `bind`
|
| 25 |
+
call.
|
| 26 |
|
| 27 |
#### Class template `is_placeholder` <a id="func.bind.isplace">[[func.bind.isplace]]</a>
|
| 28 |
|
| 29 |
``` cpp
|
| 30 |
namespace std {
|
| 31 |
template<class T> struct is_placeholder; // see below
|
| 32 |
}
|
| 33 |
```
|
| 34 |
|
| 35 |
+
The class template `is_placeholder` can be used to detect the standard
|
| 36 |
+
placeholders `_1`, `_2`, and so on. The function template `bind` uses
|
| 37 |
+
`is_placeholder` to detect placeholders.
|
| 38 |
|
| 39 |
Instantiations of the `is_placeholder` template shall meet the
|
| 40 |
+
`UnaryTypeTrait` requirements ([[meta.rqmts]]). The implementation
|
| 41 |
+
shall provide a definition that has the base characteristic of
|
| 42 |
`integral_constant<int, J>` if `T` is the type of
|
| 43 |
+
`std::placeholders::_J`, otherwise it shall have a base characteristic
|
| 44 |
+
of `integral_constant<int, 0>`. A program may specialize this template
|
| 45 |
+
for a user-defined type `T` to have a base characteristic of
|
| 46 |
`integral_constant<int, N>` with `N > 0` to indicate that `T` should be
|
| 47 |
treated as a placeholder type.
|
| 48 |
|
| 49 |
#### Function template `bind` <a id="func.bind.bind">[[func.bind.bind]]</a>
|
| 50 |
|
| 51 |
+
In the text that follows:
|
|
|
|
| 52 |
|
| 53 |
- `FD` is the type `decay_t<F>`,
|
| 54 |
- `fd` is an lvalue of type `FD` constructed from `std::forward<F>(f)`,
|
| 55 |
+
- `Tᵢ` is the iᵗʰ type in the template parameter pack `BoundArgs`,
|
| 56 |
+
- `TDᵢ` is the type `decay_t<Tᵢ>`,
|
| 57 |
+
- `tᵢ` is the iᵗʰ argument in the function parameter pack `bound_args`,
|
| 58 |
+
- `tdᵢ` is an lvalue of type `TDᵢ` constructed from
|
| 59 |
+
`std::forward<Tᵢ>(tᵢ)`,
|
| 60 |
+
- `Uⱼ` is the jᵗʰ deduced type of the `UnBoundArgs&&...` parameter of
|
| 61 |
the forwarding call wrapper, and
|
| 62 |
+
- `uⱼ` is the jᵗʰ argument associated with `Uⱼ`.
|
| 63 |
|
| 64 |
``` cpp
|
| 65 |
template<class F, class... BoundArgs>
|
| 66 |
unspecified bind(F&& f, BoundArgs&&... bound_args);
|
| 67 |
```
|
| 68 |
|
| 69 |
+
*Requires:* `is_constructible_v<FD, F>` shall be `true`. For each `Tᵢ`
|
| 70 |
+
in `BoundArgs`, `is_constructible_v<``TDᵢ``, ``Tᵢ``>` shall be `true`.
|
| 71 |
+
*INVOKE*(fd, w₁, w₂, …, $w_N$) ([[func.require]]) shall be a valid
|
| 72 |
+
expression for some values `w₁`, `w₂`, …, `w_N`, where N has the value
|
| 73 |
+
`sizeof...(bound_args)`. The cv-qualifiers cv of the call wrapper `g`,
|
| 74 |
+
as specified below, shall be neither `volatile` nor `const volatile`.
|
| 75 |
|
| 76 |
+
*Returns:* A forwarding call wrapper `g` ([[func.require]]). The effect
|
| 77 |
+
of `g(``u₁``, ``u₂``, …, ``u_M``)` shall be
|
| 78 |
+
|
| 79 |
+
``` cpp
|
| 80 |
+
INVOKE(fd, std::forward<$V_1$>($v_1$), std::forward<$V_2$>($v_2$), … , std::forward<$V_N$>($v_N$))
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
where the values and types of the bound arguments `v₁`, `v₂`, …, `v_N`
|
| 84 |
+
are determined as specified below. The copy constructor and move
|
| 85 |
+
constructor of the forwarding call wrapper shall throw an exception if
|
| 86 |
+
and only if the corresponding constructor of `FD` or of any of the types
|
| 87 |
+
`TDᵢ` throws an exception.
|
| 88 |
|
| 89 |
*Throws:* Nothing unless the construction of `fd` or of one of the
|
| 90 |
+
values `tdᵢ` throws an exception.
|
| 91 |
|
| 92 |
*Remarks:* The return type shall satisfy the requirements of
|
| 93 |
+
`MoveConstructible`. If all of `FD` and `TDᵢ` satisfy the requirements
|
| 94 |
of `CopyConstructible`, then the return type shall satisfy the
|
| 95 |
+
requirements of `CopyConstructible`.
|
| 96 |
+
|
| 97 |
+
[*Note 1*: This implies that all of `FD` and `TDᵢ` are
|
| 98 |
+
`MoveConstructible`. — *end note*]
|
| 99 |
|
| 100 |
``` cpp
|
| 101 |
template<class R, class F, class... BoundArgs>
|
| 102 |
unspecified bind(F&& f, BoundArgs&&... bound_args);
|
| 103 |
```
|
| 104 |
|
| 105 |
+
*Requires:* `is_constructible_v<FD, F>` shall be `true`. For each `Tᵢ`
|
| 106 |
+
in `BoundArgs`, `is_constructible_v<``TDᵢ``, ``Tᵢ``>` shall be `true`.
|
| 107 |
+
*INVOKE*(fd, w₁, w₂, …, $w_N$) shall be a valid expression for some
|
| 108 |
+
values `w₁`, `w₂`, …, `w_N`, where N has the value
|
| 109 |
+
`sizeof...(bound_args)`. The cv-qualifiers cv of the call wrapper `g`,
|
| 110 |
+
as specified below, shall be neither `volatile` nor `const volatile`.
|
| 111 |
|
| 112 |
+
*Returns:* A forwarding call wrapper `g` ([[func.require]]). The effect
|
| 113 |
+
of `g(``u₁``, ``u₂``, …, ``u_M``)` shall be
|
| 114 |
+
|
| 115 |
+
``` cpp
|
| 116 |
+
INVOKE<R>(fd, std::forward<$V_1$>($v_1$), std::forward<$V_2$>($v_2$), … , std::forward<$V_N$>($v_N$))
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
where the values and types of the bound arguments `v₁`, `v₂`, …, `v_N`
|
| 120 |
+
are determined as specified below. The copy constructor and move
|
| 121 |
+
constructor of the forwarding call wrapper shall throw an exception if
|
| 122 |
+
and only if the corresponding constructor of `FD` or of any of the types
|
| 123 |
+
`TDᵢ` throws an exception.
|
| 124 |
|
| 125 |
*Throws:* Nothing unless the construction of `fd` or of one of the
|
| 126 |
+
values `tdᵢ` throws an exception.
|
| 127 |
|
| 128 |
*Remarks:* The return type shall satisfy the requirements of
|
| 129 |
+
`MoveConstructible`. If all of `FD` and `TDᵢ` satisfy the requirements
|
| 130 |
of `CopyConstructible`, then the return type shall satisfy the
|
| 131 |
+
requirements of `CopyConstructible`.
|
|
|
|
| 132 |
|
| 133 |
+
[*Note 2*: This implies that all of `FD` and `TDᵢ` are
|
| 134 |
+
`MoveConstructible`. — *end note*]
|
|
|
|
|
|
|
| 135 |
|
| 136 |
+
The values of the *bound arguments* `v₁`, `v₂`, …, `v_N` and their
|
| 137 |
+
corresponding types `V₁`, `V₂`, …, `V_N` depend on the types `TDᵢ`
|
| 138 |
+
derived from the call to `bind` and the cv-qualifiers cv of the call
|
| 139 |
+
wrapper `g` as follows:
|
| 140 |
+
|
| 141 |
+
- if `TDᵢ` is `reference_wrapper<T>`, the argument is `tdᵢ.get()` and
|
| 142 |
+
its type `Vᵢ` is `T&`;
|
| 143 |
+
- if the value of `is_bind_expression_v<TDᵢ>` is `true`, the argument is
|
| 144 |
+
`tdᵢ(std::forward<Uⱼ>(uⱼ)...)` and its type `Vᵢ` is
|
| 145 |
+
`invoke_result_t<TDᵢ cv &, Uⱼ...>&&`;
|
| 146 |
+
- if the value `j` of `is_placeholder_v<TDᵢ>` is not zero, the argument
|
| 147 |
+
is `std::forward<Uⱼ>(uⱼ)` and its type `Vᵢ` is `Uⱼ&&`;
|
| 148 |
+
- otherwise, the value is `tdᵢ` and its type `Vᵢ` is `TDᵢ cv &`.
|
| 149 |
|
| 150 |
#### Placeholders <a id="func.bind.place">[[func.bind.place]]</a>
|
| 151 |
|
| 152 |
``` cpp
|
| 153 |
+
namespace std::placeholders {
|
|
|
|
| 154 |
// M is the implementation-defined number of placeholders
|
| 155 |
+
see below _1;
|
| 156 |
+
see below _2;
|
| 157 |
.
|
| 158 |
.
|
| 159 |
.
|
| 160 |
+
see below _M;
|
|
|
|
| 161 |
}
|
| 162 |
```
|
| 163 |
|
| 164 |
All placeholder types shall be `DefaultConstructible` and
|
| 165 |
`CopyConstructible`, and their default constructors and copy/move
|
| 166 |
constructors shall not throw exceptions. It is *implementation-defined*
|
| 167 |
whether placeholder types are `CopyAssignable`. `CopyAssignable`
|
| 168 |
placeholders’ copy assignment operators shall not throw exceptions.
|
| 169 |
|
| 170 |
+
Placeholders should be defined as:
|
| 171 |
+
|
| 172 |
+
``` cpp
|
| 173 |
+
inline constexpr unspecified _1{};
|
| 174 |
+
```
|
| 175 |
+
|
| 176 |
+
If they are not, they shall be declared as:
|
| 177 |
+
|
| 178 |
+
``` cpp
|
| 179 |
+
extern unspecified _1;
|
| 180 |
+
```
|
| 181 |
+
|