From Jason Turner

[func.bind.bind]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpm8nv4mu2/{from.md → to.md} +45 -65
tmp/tmpm8nv4mu2/{from.md → to.md} RENAMED
@@ -1,101 +1,81 @@
1
  #### Function template `bind` <a id="func.bind.bind">[[func.bind.bind]]</a>
2
 
3
  In the text that follows:
4
 
 
5
  - `FD` is the type `decay_t<F>`,
6
- - `fd` is an lvalue of type `FD` constructed from `std::forward<F>(f)`,
 
7
  - `Tᵢ` is the iᵗʰ type in the template parameter pack `BoundArgs`,
8
  - `TDᵢ` is the type `decay_t<Tᵢ>`,
9
  - `tᵢ` is the iᵗʰ argument in the function parameter pack `bound_args`,
10
- - `tdᵢ` is an lvalue of type `TDᵢ` constructed from
11
- `std::forward<Tᵢ>(tᵢ)`,
12
  - `Uⱼ` is the jᵗʰ deduced type of the `UnBoundArgs&&...` parameter of
13
- the forwarding call wrapper, and
14
  - `uⱼ` is the jᵗʰ argument associated with `Uⱼ`.
15
 
16
  ``` cpp
17
  template<class F, class... BoundArgs>
18
- unspecified bind(F&& f, BoundArgs&&... bound_args);
19
- ```
20
-
21
- *Requires:* `is_constructible_v<FD, F>` shall be `true`. For each `Tᵢ`
22
- in `BoundArgs`, `is_constructible_v<``TDᵢ``, ``Tᵢ``>` shall be `true`.
23
- *INVOKE*(fd, w₁, w₂, …, $w_N$) ([[func.require]]) shall be a valid
24
- expression for some values `w₁`, `w₂`, …, `w_N`, where N has the value
25
- `sizeof...(bound_args)`. The cv-qualifiers cv of the call wrapper `g`,
26
- as specified below, shall be neither `volatile` nor `const volatile`.
27
-
28
- *Returns:* A forwarding call wrapper `g` ([[func.require]]). The effect
29
- of `g(``u₁``, ``u₂``, …, ``u_M``)` shall be
30
-
31
- ``` cpp
32
- INVOKE(fd, std::forward<$V_1$>($v_1$), std::forward<$V_2$>($v_2$), … , std::forward<$V_N$>($v_N$))
33
- ```
34
-
35
- where the values and types of the bound arguments `v₁`, `v₂`, …, `v_N`
36
- are determined as specified below. The copy constructor and move
37
- constructor of the forwarding call wrapper shall throw an exception if
38
- and only if the corresponding constructor of `FD` or of any of the types
39
- `TDᵢ` throws an exception.
40
-
41
- *Throws:* Nothing unless the construction of `fd` or of one of the
42
- values `tdᵢ` throws an exception.
43
-
44
- *Remarks:* The return type shall satisfy the requirements of
45
- `MoveConstructible`. If all of `FD` and `TDᵢ` satisfy the requirements
46
- of `CopyConstructible`, then the return type shall satisfy the
47
- requirements of `CopyConstructible`.
48
-
49
- [*Note 1*: This implies that all of `FD` and `TDᵢ` are
50
- `MoveConstructible`. — *end note*]
51
-
52
- ``` cpp
53
  template<class R, class F, class... BoundArgs>
54
- unspecified bind(F&& f, BoundArgs&&... bound_args);
55
  ```
56
 
57
- *Requires:* `is_constructible_v<FD, F>` shall be `true`. For each `Tᵢ`
58
- in `BoundArgs`, `is_constructible_v<``TDᵢ``, ``Tᵢ``>` shall be `true`.
59
- *INVOKE*(fd, w₁, w₂, …, $w_N$) shall be a valid expression for some
60
- values `w₁`, `w₂`, …, `w_N`, where N has the value
61
- `sizeof...(bound_args)`. The cv-qualifiers cv of the call wrapper `g`,
62
- as specified below, shall be neither `volatile` nor `const volatile`.
63
 
64
- *Returns:* A forwarding call wrapper `g` ([[func.require]]). The effect
65
- of `g(``u``, ``u``, …, ``u_M``)` shall be
 
 
 
 
 
 
 
 
66
 
67
  ``` cpp
68
- INVOKE<R>(fd, std::forward<$V_1$>($v_1$), std::forward<$V_2$>($v_2$), … , std::forward<$V_N$>($v_N$))
 
69
  ```
70
 
71
- where the values and types of the bound arguments `v₁`, `v₂`, …, `v_N`
72
- are determined as specified below. The copy constructor and move
73
- constructor of the forwarding call wrapper shall throw an exception if
74
- and only if the corresponding constructor of `FD` or of any of the types
75
- `TDᵢ` throws an exception.
 
76
 
77
- *Throws:* Nothing unless the construction of `fd` or of one of the
78
- values `tdᵢ` throws an exception.
 
79
 
80
- *Remarks:* The return type shall satisfy the requirements of
81
- `MoveConstructible`. If all of `FD` and `TDᵢ` satisfy the requirements
82
- of `CopyConstructible`, then the return type shall satisfy the
83
- requirements of `CopyConstructible`.
84
 
85
- [*Note 2*: This implies that all of `FD` and `TDᵢ` are
86
- `MoveConstructible`. *end note*]
 
87
 
88
  The values of the *bound arguments* `v₁`, `v₂`, …, `v_N` and their
89
  corresponding types `V₁`, `V₂`, …, `V_N` depend on the types `TDᵢ`
90
  derived from the call to `bind` and the cv-qualifiers cv of the call
91
  wrapper `g` as follows:
92
 
93
  - if `TDᵢ` is `reference_wrapper<T>`, the argument is `tdᵢ.get()` and
94
  its type `Vᵢ` is `T&`;
95
  - if the value of `is_bind_expression_v<TDᵢ>` is `true`, the argument is
96
- `tdᵢ(std::forward<Uⱼ>(uⱼ)...)` and its type `Vᵢ` is
97
- `invoke_result_t<TDᵢ cv &, Uⱼ...>&&`;
 
 
 
98
  - if the value `j` of `is_placeholder_v<TDᵢ>` is not zero, the argument
99
  is `std::forward<Uⱼ>(uⱼ)` and its type `Vᵢ` is `Uⱼ&&`;
100
- - otherwise, the value is `tdᵢ` and its type `Vᵢ` is `TDᵢ cv &`.
 
 
 
101
 
 
1
  #### Function template `bind` <a id="func.bind.bind">[[func.bind.bind]]</a>
2
 
3
  In the text that follows:
4
 
5
+ - `g` is a value of the result of a `bind` invocation,
6
  - `FD` is the type `decay_t<F>`,
7
+ - `fd` is an lvalue that is a target object of `g` [[func.def]] of type
8
+ `FD` direct-non-list-initialized with `std::forward<F>(f)`,
9
  - `Tᵢ` is the iᵗʰ type in the template parameter pack `BoundArgs`,
10
  - `TDᵢ` is the type `decay_t<Tᵢ>`,
11
  - `tᵢ` is the iᵗʰ argument in the function parameter pack `bound_args`,
12
+ - `tdᵢ` is a bound argument entity of `g` [[func.def]] of type `TDᵢ`
13
+ direct-non-list-initialized with `std::forward<{}Tᵢ>(tᵢ)`,
14
  - `Uⱼ` is the jᵗʰ deduced type of the `UnBoundArgs&&...` parameter of
15
+ the argument forwarding call wrapper, and
16
  - `uⱼ` is the jᵗʰ argument associated with `Uⱼ`.
17
 
18
  ``` cpp
19
  template<class F, class... BoundArgs>
20
+ constexpr unspecified bind(F&& f, BoundArgs&&... bound_args);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  template<class R, class F, class... BoundArgs>
22
+ constexpr unspecified bind(F&& f, BoundArgs&&... bound_args);
23
  ```
24
 
25
+ *Mandates:* `is_constructible_v<FD, F>` is `true`. For each `Tᵢ` in
26
+ `BoundArgs`, `is_constructible_v<``TDᵢ``, ``Tᵢ``>` is `true`.
 
 
 
 
27
 
28
+ *Preconditions:* `FD` and each `TDᵢ` meet the *Cpp17MoveConstructible*
29
+ and *Cpp17Destructible* requirements. *INVOKE*(fd, w₁, w₂, …,
30
+ $w_N$) [[func.require]] is a valid expression for some values `w₁`,
31
+ `w₂`, …, `w_N`, where N has the value `sizeof...(bound_args)`.
32
+
33
+ *Returns:* An argument forwarding call wrapper `g` [[func.require]]. A
34
+ program that attempts to invoke a volatile-qualified `g` is ill-formed.
35
+ When `g` is not volatile-qualified, invocation of
36
+ `g(``u₁``, ``u₂``, `…`, ``u_M``)` is
37
+ expression-equivalent [[defns.expression-equivalent]] to
38
 
39
  ``` cpp
40
+ INVOKE(static_cast<$V_fd$>($v_fd$),
41
+ static_cast<$V_1$>($v_1$), static_cast<$V_2$>($v_2$), …, static_cast<$V_N$>($v_N$))
42
  ```
43
 
44
+ for the first overload, and
45
+
46
+ ``` cpp
47
+ INVOKE<R>(static_cast<$V_fd$>($v_fd$),
48
+ static_cast<$V_1$>($v_1$), static_cast<$V_2$>($v_2$), …, static_cast<$V_N$>($v_N$))
49
+ ```
50
 
51
+ for the second overload, where the values and types of the target
52
+ argument `v`_`fd` and of the bound arguments `v₁`, `v₂`, …, `v_N` are
53
+ determined as specified below.
54
 
55
+ *Throws:* Any exception thrown by the initialization of the state
56
+ entities of `g`.
 
 
57
 
58
+ [*Note 1*: If all of `FD` and `TDᵢ` meet the requirements of
59
+ *Cpp17CopyConstructible*, then the return type meets the requirements of
60
+ *Cpp17CopyConstructible*. — *end note*]
61
 
62
  The values of the *bound arguments* `v₁`, `v₂`, …, `v_N` and their
63
  corresponding types `V₁`, `V₂`, …, `V_N` depend on the types `TDᵢ`
64
  derived from the call to `bind` and the cv-qualifiers cv of the call
65
  wrapper `g` as follows:
66
 
67
  - if `TDᵢ` is `reference_wrapper<T>`, the argument is `tdᵢ.get()` and
68
  its type `Vᵢ` is `T&`;
69
  - if the value of `is_bind_expression_v<TDᵢ>` is `true`, the argument is
70
+ ``` cpp
71
+ static_cast<cv `TD`_i&>(td_i)(std::forward<U_j>(u_j)...)
72
+ ```
73
+
74
+ and its type `Vᵢ` is `invoke_result_t<cv TDᵢ&, Uⱼ...>&&`;
75
  - if the value `j` of `is_placeholder_v<TDᵢ>` is not zero, the argument
76
  is `std::forward<Uⱼ>(uⱼ)` and its type `Vᵢ` is `Uⱼ&&`;
77
+ - otherwise, the value is `tdᵢ` and its type `Vᵢ` is `cv TDᵢ&`.
78
+
79
+ The value of the target argument `v`_`fd` is `fd` and its corresponding
80
+ type `V`_`fd` is `cv FD&`.
81