From Jason Turner

[func.bind]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpbnb554bz/{from.md → to.md} +38 -22
tmp/tmpbnb554bz/{from.md → to.md} RENAMED
@@ -1,45 +1,60 @@
1
- #### Function object binders <a id="func.bind">[[func.bind]]</a>
2
 
3
  This subclause describes a uniform mechanism for binding arguments of
4
  callable objects.
5
 
6
- ##### Class template `is_bind_expression` <a id="func.bind.isbind">[[func.bind.isbind]]</a>
7
 
8
  ``` cpp
9
  namespace std {
10
- template<class T> struct is_bind_expression
11
- : integral_constant<bool, see below> { };
12
  }
13
  ```
14
 
15
  `is_bind_expression` can be used to detect function objects generated by
16
- `bind`. `bind` uses `is_bind_expression` to detect subexpressions. Users
17
- may specialize this template to indicate that a type should be treated
18
- as a subexpression in a `bind` call.
19
 
20
- If `T` is a type returned from `bind`, `is_bind_expression<T>` shall be
21
- publicly derived from `integral_constant<bool, true>`, otherwise from
22
- `integral_constant<bool, false>`.
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  `is_placeholder` can be used to detect the standard placeholders `_1`,
25
  `_2`, and so on. `bind` uses `is_placeholder` to detect placeholders.
26
- Users may specialize this template to indicate a placeholder type.
27
 
28
- If `T` is the type of `std::placeholders::_J`, `is_placeholder<T>` shall
29
- be publicly derived from `integral_constant<int, J>`, otherwise from
30
- `integral_constant<int, 0>`.
 
 
 
 
 
 
31
 
32
- ##### Function template `bind` <a id="func.bind.bind">[[func.bind.bind]]</a>
33
 
34
  In the text that follows, the following names have the following
35
  meanings:
36
 
37
- - `FD` is the type `decay<F>::type`,
38
  - `fd` is an lvalue of type `FD` constructed from `std::forward<F>(f)`,
39
- - `Ti` is the iᵗʰ type in the template parameter back `BoundArgs`,
40
- - `TiD` is the type `decay<Ti>::type`,
41
  - `ti` is the iᵗʰ argument in the function parameter pack `bound_args`,
42
  - `tid` is an lvalue of type `TiD` constructed from
43
  `std::forward<Ti>(ti)`,
44
  - `Uj` is the jᵗʰ deduced type of the `UnBoundArgs&&...` parameter of
45
  the forwarding call wrapper, and
@@ -56,11 +71,11 @@ template<class F, class... BoundArgs>
56
  expression for some values *w1, w2, ..., wN*, where
57
  `N == sizeof...(bound_args)`.
58
 
59
  *Returns:* A forwarding call wrapper `g` with a weak result
60
  type ([[func.require]]). The effect of `g(u1, u2, ..., uM)` shall be
61
- *`INVOKE`*`(fd, v1, v2, ..., vN, result_of<FD `*`cv`*` (V1, V2, ..., VN)>::type)`,
62
  where *`cv`* represents the *cv*-qualifiers of `g` and the values and
63
  types of the bound arguments `v1, v2, ..., vN` are determined as
64
  specified below. The copy constructor and move constructor of the
65
  forwarding call wrapper shall throw an exception if and only if the
66
  corresponding constructor of `FD` or of any of the types `TiD` throws an
@@ -85,11 +100,12 @@ template<class R, class F, class... BoundArgs>
85
  *`INVOKE`*`(fd, w1, w2, ..., wN)` shall be a valid expression for some
86
  values *w1, w2, ..., wN*, where `N == sizeof...(bound_args)`.
87
 
88
  *Returns:* A forwarding call wrapper `g` with a nested type
89
  `result_type` defined as a synonym for `R`. The effect of
90
- `g(u1, u2, ..., uM)` shall be *`INVOKE`*`(fd, v1, v2, ..., vN, R)`,
 
91
  where the values and types of the bound arguments `v1, v2, ..., vN` are
92
  determined as specified below. The copy constructor and move constructor
93
  of the forwarding call wrapper shall throw an exception if and only if
94
  the corresponding constructor of `FD` or of any of the types `TiD`
95
  throws an exception.
@@ -110,16 +126,16 @@ from the call to `bind` and the *cv*-qualifiers *cv* of the call wrapper
110
 
111
  - if `TiD` is `reference_wrapper<T>`, the argument is `tid.get()` and
112
  its type `Vi` is `T&`;
113
  - if the value of `is_bind_expression<TiD>::value` is `true`, the
114
  argument is `tid(std::forward<Uj>({}uj)...)` and its type `Vi` is
115
- `result_of<TiD cv (Uj...)>::type`;
116
  - if the value `j` of `is_placeholder<TiD>::value` is not zero, the
117
  argument is `std::forward<Uj>(uj)` and its type `Vi` is `Uj&&`;
118
  - otherwise, the value is `tid` and its type `Vi` is `TiD cv &`.
119
 
120
- ##### Placeholders <a id="func.bind.place">[[func.bind.place]]</a>
121
 
122
  ``` cpp
123
  namespace std {
124
  namespace placeholders {
125
  // M is the implementation-defined number of placeholders
 
1
+ ### Function object binders <a id="func.bind">[[func.bind]]</a>
2
 
3
  This subclause describes a uniform mechanism for binding arguments of
4
  callable objects.
5
 
6
+ #### Class template `is_bind_expression` <a id="func.bind.isbind">[[func.bind.isbind]]</a>
7
 
8
  ``` cpp
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 objects generated by
15
+ `bind`. `bind` uses `is_bind_expression` to detect subexpressions.
 
 
16
 
17
+ Instantiations of the `is_bind_expression` template shall meet the
18
+ UnaryTypeTrait requirements ([[meta.rqmts]]). The implementation shall
19
+ provide a definition that has a BaseCharacteristic of `true_type` if `T`
20
+ is a type returned from `bind`, otherwise it shall have a
21
+ BaseCharacteristic of `false_type`. A program may specialize this
22
+ template for a user-defined type `T` to have a BaseCharacteristic of
23
+ `true_type` to indicate that `T` should be treated as a subexpression in
24
+ a `bind` call.
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 placeholders `_1`,
35
  `_2`, and so on. `bind` uses `is_placeholder` to detect placeholders.
 
36
 
37
+ Instantiations of the `is_placeholder` template shall meet the
38
+ UnaryTypeTrait requirements ([[meta.rqmts]]). The implementation shall
39
+ provide a definition that has the BaseCharacteristic of
40
+ `integral_constant<int, J>` if `T` is the type of
41
+ `std::placeholders::_J`, otherwise it shall have a BaseCharacteristic of
42
+ `integral_constant<int, 0>`. A program may specialize this template for
43
+ a user-defined type `T` to have a BaseCharacteristic of
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, the following names have the following
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
+ - `Ti` is the iᵗʰ type in the template parameter pack `BoundArgs`,
55
+ - `TiD` is the type `decay_t<Ti>`,
56
  - `ti` is the iᵗʰ argument in the function parameter pack `bound_args`,
57
  - `tid` is an lvalue of type `TiD` constructed from
58
  `std::forward<Ti>(ti)`,
59
  - `Uj` is the jᵗʰ deduced type of the `UnBoundArgs&&...` parameter of
60
  the forwarding call wrapper, and
 
71
  expression for some values *w1, w2, ..., wN*, where
72
  `N == sizeof...(bound_args)`.
73
 
74
  *Returns:* A forwarding call wrapper `g` with a weak result
75
  type ([[func.require]]). The effect of `g(u1, u2, ..., uM)` shall be
76
+ *`INVOKE`*`(fd, std::forward<V1>(v1), std::forward<V2>(v2), ..., std::forward<VN>(vN), result_of_t<FD `*`cv`*` & (V1, V2, ..., VN)>)`,
77
  where *`cv`* represents the *cv*-qualifiers of `g` and the values and
78
  types of the bound arguments `v1, v2, ..., vN` are determined as
79
  specified below. The copy constructor and move constructor of the
80
  forwarding call wrapper shall throw an exception if and only if the
81
  corresponding constructor of `FD` or of any of the types `TiD` throws an
 
100
  *`INVOKE`*`(fd, w1, w2, ..., wN)` shall be a valid expression for some
101
  values *w1, w2, ..., wN*, where `N == sizeof...(bound_args)`.
102
 
103
  *Returns:* A forwarding call wrapper `g` with a nested type
104
  `result_type` defined as a synonym for `R`. The effect of
105
+ `g(u1, u2, ..., uM)` shall be
106
+ *`INVOKE`*`(fd, std::forward<V1>(v1), std::forward<V2>(v2), ..., std::forward<VN>(vN), R)`,
107
  where the values and types of the bound arguments `v1, v2, ..., vN` are
108
  determined as specified below. The copy constructor and move constructor
109
  of the forwarding call wrapper shall throw an exception if and only if
110
  the corresponding constructor of `FD` or of any of the types `TiD`
111
  throws an exception.
 
126
 
127
  - if `TiD` is `reference_wrapper<T>`, the argument is `tid.get()` and
128
  its type `Vi` is `T&`;
129
  - if the value of `is_bind_expression<TiD>::value` is `true`, the
130
  argument is `tid(std::forward<Uj>({}uj)...)` and its type `Vi` is
131
+ `result_of_t<TiD cv & (Uj&&...)>&&`;
132
  - if the value `j` of `is_placeholder<TiD>::value` is not zero, the
133
  argument is `std::forward<Uj>(uj)` and its type `Vi` is `Uj&&`;
134
  - otherwise, the value is `tid` and its type `Vi` is `TiD cv &`.
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