From Jason Turner

[depr.func.adaptor.binding]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpg0dh51v5/{from.md → to.md} +329 -0
tmp/tmpg0dh51v5/{from.md → to.md} RENAMED
@@ -0,0 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Old adaptable function bindings <a id="depr.func.adaptor.binding">[[depr.func.adaptor.binding]]</a>
2
+
3
+ ### Weak result types <a id="depr.weak.result_type">[[depr.weak.result_type]]</a>
4
+
5
+ A call wrapper ([[func.def]]) may have a *weak result type*. If it
6
+ does, the type of its member type `result_type` is based on the type `T`
7
+ of the wrapper’s target object:
8
+
9
+ - if `T` is a pointer to function type, `result_type` shall be a synonym
10
+ for the return type of `T`;
11
+ - if `T` is a pointer to member function, `result_type` shall be a
12
+ synonym for the return type of `T`;
13
+ - if `T` is a class type and the *qualified-id* `T::result_type` is
14
+ valid and denotes a type ([[temp.deduct]]), then `result_type` shall
15
+ be a synonym for `T::result_type`;
16
+ - otherwise `result_type` shall not be defined.
17
+
18
+ ### Typedefs to support function binders <a id="depr.func.adaptor.typedefs">[[depr.func.adaptor.typedefs]]</a>
19
+
20
+ To enable old function adaptors to manipulate function objects that take
21
+ one or two arguments, many of the function objects in this International
22
+ Standard correspondingly provide *typedef-name*s `argument_type` and
23
+ `result_type` for function objects that take one argument and
24
+ `first_argument_type`, `second_argument_type`, and `result_type` for
25
+ function objects that take two arguments.
26
+
27
+ The following member names are defined in addition to names specified in
28
+ Clause  [[function.objects]]:
29
+
30
+ ``` cpp
31
+ namespace std {
32
+ template<class T> struct owner_less<shared_ptr<T>> {
33
+ using result_type = bool;
34
+ using first_argument_type = shared_ptr<T>;
35
+ using second_argument_type = shared_ptr<T>;
36
+ };
37
+
38
+ template<class T> struct owner_less<weak_ptr<T>> {
39
+ using result_type = bool;
40
+ using first_argument_type = weak_ptr<T>;
41
+ using second_argument_type = weak_ptr<T>;
42
+ };
43
+
44
+ template <class T> class reference_wrapper {
45
+ public :
46
+ using result_type = see below; // not always defined
47
+ using argument_type = see below; // not always defined
48
+ using first_argument_type = see below; // not always defined
49
+ using second_argument_type = see below; // not always defined
50
+ };
51
+
52
+ template <class T> struct plus {
53
+ using first_argument_type = T;
54
+ using second_argument_type = T;
55
+ using result_type = T;
56
+ };
57
+
58
+ template <class T> struct minus {
59
+ using first_argument_type = T;
60
+ using second_argument_type = T;
61
+ using result_type = T;
62
+ };
63
+
64
+ template <class T> struct multiplies {
65
+ using first_argument_type = T;
66
+ using second_argument_type = T;
67
+ using result_type = T;
68
+ };
69
+
70
+ template <class T> struct divides {
71
+ using first_argument_type = T;
72
+ using second_argument_type = T;
73
+ using result_type = T;
74
+ };
75
+
76
+ template <class T> struct modulus {
77
+ using first_argument_type = T;
78
+ using second_argument_type = T;
79
+ using result_type = T;
80
+ };
81
+
82
+ template <class T> struct negate {
83
+ using argument_type = T;
84
+ using result_type = T;
85
+ };
86
+
87
+ template <class T> struct equal_to {
88
+ using first_argument_type = T;
89
+ using second_argument_type = T;
90
+ using result_type = bool;
91
+ };
92
+
93
+ template <class T> struct not_equal_to {
94
+ using first_argument_type = T;
95
+ using second_argument_type = T;
96
+ using result_type = bool;
97
+ };
98
+
99
+ template <class T> struct greater {
100
+ using first_argument_type = T;
101
+ using second_argument_type = T;
102
+ using result_type = bool;
103
+ };
104
+
105
+ template <class T> struct less {
106
+ using first_argument_type = T;
107
+ using second_argument_type = T;
108
+ using result_type = bool;
109
+ };
110
+
111
+ template <class T> struct greater_equal {
112
+ using first_argument_type = T;
113
+ using second_argument_type = T;
114
+ using result_type = bool;
115
+ };
116
+
117
+ template <class T> struct less_equal {
118
+ using first_argument_type = T;
119
+ using second_argument_type = T;
120
+ using result_type = bool;
121
+ };
122
+
123
+ template <class T> struct logical_and {
124
+ using first_argument_type = T;
125
+ using second_argument_type = T;
126
+ using result_type = bool;
127
+ };
128
+
129
+ template <class T> struct logical_or {
130
+ using first_argument_type = T;
131
+ using second_argument_type = T;
132
+ using result_type = bool;
133
+ };
134
+
135
+ template <class T> struct logical_not {
136
+ using argument_type = T;
137
+ using result_type = bool;
138
+ };
139
+
140
+ template <class T> struct bit_and {
141
+ using first_argument_type = T;
142
+ using second_argument_type = T;
143
+ using result_type = T;
144
+ };
145
+
146
+ template <class T> struct bit_or {
147
+ using first_argument_type = T;
148
+ using second_argument_type = T;
149
+ using result_type = T;
150
+ };
151
+
152
+ template <class T> struct bit_xor {
153
+ using first_argument_type = T;
154
+ using second_argument_type = T;
155
+ using result_type = T;
156
+ };
157
+
158
+ template <class T> struct bit_not {
159
+ using argument_type = T;
160
+ using result_type = T;
161
+ };
162
+
163
+ template<class R, class T1>
164
+ class function<R(T1)> {
165
+ public:
166
+ using argument_type = T1;
167
+ };
168
+
169
+ template<class R, class T1, class T2>
170
+ class function<R(T1, T2)> {
171
+ public:
172
+ using first_argument_type = T1;
173
+ using second_argument_type = T2;
174
+ };
175
+ }
176
+ ```
177
+
178
+ `reference_wrapper<T>` has a weak result type (
179
+ [[depr.weak.result_type]]). If `T` is a function type, `result_type`
180
+ shall be a synonym for the return type of `T`.
181
+
182
+ The template specialization `reference_wrapper<T>` shall define a nested
183
+ type named `argument_type` as a synonym for `T1` only if the type `T` is
184
+ any of the following:
185
+
186
+ - a function type or a pointer to function type taking one argument of
187
+ type `T1`
188
+ - a pointer to member function `R T0::f()` cv (where cv represents the
189
+ member function’s cv-qualifiers); the type `T1` is cv `T0*`
190
+ - a class type where the *qualified-id* `T::argument_type` is valid and
191
+ denotes a type ([[temp.deduct]]); the type `T1` is
192
+ `T::argument_type`.
193
+
194
+ The template instantiation `reference_wrapper<T>` shall define two
195
+ nested types named `first_argument_type` and `second_argument_type` as
196
+ synonyms for `T1` and `T2`, respectively, only if the type `T` is any of
197
+ the following:
198
+
199
+ - a function type or a pointer to function type taking two arguments of
200
+ types `T1` and `T2`
201
+ - a pointer to member function `R T0::f(T2)` cv (where cv represents the
202
+ member function’s cv-qualifiers); the type `T1` is cv `T0*`
203
+ - a class type where the *qualified-id*s `T::first_argument_type` and
204
+ `T::second_argument_type` are both valid and both denote types (
205
+ [[temp.deduct]]); the type `T1` is `T::first_argument_type` and the
206
+ type `T2` is `T::second_argument_type`.
207
+
208
+ All enabled specializations `hash<Key>` of `hash` ([[unord.hash]])
209
+ provide two nested types, `result_type` and `argument_type`, which shall
210
+ be synonyms for `size_t` and `Key`, respectively.
211
+
212
+ The forwarding call wrapper `g` returned by a call to
213
+ `bind(f, bound_args...)` ([[func.bind.bind]]) shall have a weak result
214
+ type ([[depr.weak.result_type]]).
215
+
216
+ The forwarding call wrapper `g` returned by a call to
217
+ `bind<R>(f, bound_args...)` ([[func.bind.bind]]) shall have a nested
218
+ type `result_type` defined as a synonym for `R`.
219
+
220
+ The simple call wrapper returned from a call to `mem_fn(pm)` shall have
221
+ a nested type `result_type` that is a synonym for the return type of
222
+ `pm` when `pm` is a pointer to member function.
223
+
224
+ The simple call wrapper returned from a call to `mem_fn(pm)` shall
225
+ define two nested types named `argument_type` and `result_type` as
226
+ synonyms for cv `T*` and `Ret`, respectively, when `pm` is a pointer to
227
+ member function with cv-qualifier cv and taking no arguments, where
228
+ `Ret` is `pm`'s return type.
229
+
230
+ The simple call wrapper returned from a call to `mem_fn(pm)` shall
231
+ define three nested types named `first_argument_type`,
232
+ `second_argument_type`, and `result_type` as synonyms for cv `T*`, `T1`,
233
+ and `Ret`, respectively, when `pm` is a pointer to member function with
234
+ cv-qualifier cv and taking one argument of type `T1`, where `Ret` is
235
+ `pm`'s return type.
236
+
237
+ The following member names are defined in addition to names specified in
238
+ Clause  [[containers]]:
239
+
240
+ ``` cpp
241
+ namespace std {
242
+ template <class Key, class T, class Compare, class Allocator>
243
+ class map<Key, T, Compare, Allocator>::value_compare {
244
+ public:
245
+ using result_type = bool;
246
+ using first_argument_type = value_type;
247
+ using second_argument_type = value_type;
248
+ };
249
+
250
+ template <class Key, class T, class Compare, class Allocator>
251
+ class multimap<Key, T, Compare, Allocator>::value_compare {
252
+ public:
253
+ using result_type = bool;
254
+ using first_argument_type = value_type;
255
+ using second_argument_type = value_type;
256
+ };
257
+ }
258
+ ```
259
+
260
+ ### Negators <a id="depr.negators">[[depr.negators]]</a>
261
+
262
+ The header `<functional>` has the following additions:
263
+
264
+ ``` cpp
265
+ namespace std {
266
+ template <class Predicate> class unary_negate;
267
+ template <class Predicate>
268
+ constexpr unary_negate<Predicate> not1(const Predicate&);
269
+ template <class Predicate> class binary_negate;
270
+ template <class Predicate>
271
+ constexpr binary_negate<Predicate> not2(const Predicate&);
272
+ }
273
+ ```
274
+
275
+ Negators `not1` and `not2` take a unary and a binary predicate,
276
+ respectively, and return their logical negations ([[expr.unary.op]]).
277
+
278
+ ``` cpp
279
+ template <class Predicate>
280
+ class unary_negate {
281
+ public:
282
+ constexpr explicit unary_negate(const Predicate& pred);
283
+ constexpr bool operator()(const typename Predicate::argument_type& x) const;
284
+ using argument_type = typename Predicate::argument_type;
285
+ using result_type = bool;
286
+ };
287
+ ```
288
+
289
+ ``` cpp
290
+ constexpr bool operator()(const typename Predicate::argument_type& x) const;
291
+ ```
292
+
293
+ *Returns:* `!pred(x)`.
294
+
295
+ ``` cpp
296
+ template <class Predicate>
297
+ constexpr unary_negate<Predicate> not1(const Predicate& pred);
298
+ ```
299
+
300
+ *Returns:* `unary_negate<Predicate>(pred)`.
301
+
302
+ ``` cpp
303
+ template <class Predicate>
304
+ class binary_negate {
305
+ public:
306
+ constexpr explicit binary_negate(const Predicate& pred);
307
+ constexpr bool operator()(const typename Predicate::first_argument_type& x,
308
+ const typename Predicate::second_argument_type& y) const;
309
+ using first_argument_type = typename Predicate::first_argument_type;
310
+ using second_argument_type = typename Predicate::second_argument_type;
311
+ using result_type = bool;
312
+
313
+ };
314
+ ```
315
+
316
+ ``` cpp
317
+ constexpr bool operator()(const typename Predicate::first_argument_type& x,
318
+ const typename Predicate::second_argument_type& y) const;
319
+ ```
320
+
321
+ *Returns:* `!pred(x,y)`.
322
+
323
+ ``` cpp
324
+ template <class Predicate>
325
+ constexpr binary_negate<Predicate> not2(const Predicate& pred);
326
+ ```
327
+
328
+ *Returns:* `binary_negate<Predicate>(pred)`.
329
+