From Jason Turner

[depr.func.adaptor.typedefs]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpw0hniolk/{from.md → to.md} +242 -0
tmp/tmpw0hniolk/{from.md → to.md} RENAMED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Typedefs to support function binders <a id="depr.func.adaptor.typedefs">[[depr.func.adaptor.typedefs]]</a>
2
+
3
+ To enable old function adaptors to manipulate function objects that take
4
+ one or two arguments, many of the function objects in this International
5
+ Standard correspondingly provide *typedef-name*s `argument_type` and
6
+ `result_type` for function objects that take one argument and
7
+ `first_argument_type`, `second_argument_type`, and `result_type` for
8
+ function objects that take two arguments.
9
+
10
+ The following member names are defined in addition to names specified in
11
+ Clause  [[function.objects]]:
12
+
13
+ ``` cpp
14
+ namespace std {
15
+ template<class T> struct owner_less<shared_ptr<T>> {
16
+ using result_type = bool;
17
+ using first_argument_type = shared_ptr<T>;
18
+ using second_argument_type = shared_ptr<T>;
19
+ };
20
+
21
+ template<class T> struct owner_less<weak_ptr<T>> {
22
+ using result_type = bool;
23
+ using first_argument_type = weak_ptr<T>;
24
+ using second_argument_type = weak_ptr<T>;
25
+ };
26
+
27
+ template <class T> class reference_wrapper {
28
+ public :
29
+ using result_type = see below; // not always defined
30
+ using argument_type = see below; // not always defined
31
+ using first_argument_type = see below; // not always defined
32
+ using second_argument_type = see below; // not always defined
33
+ };
34
+
35
+ template <class T> struct plus {
36
+ using first_argument_type = T;
37
+ using second_argument_type = T;
38
+ using result_type = T;
39
+ };
40
+
41
+ template <class T> struct minus {
42
+ using first_argument_type = T;
43
+ using second_argument_type = T;
44
+ using result_type = T;
45
+ };
46
+
47
+ template <class T> struct multiplies {
48
+ using first_argument_type = T;
49
+ using second_argument_type = T;
50
+ using result_type = T;
51
+ };
52
+
53
+ template <class T> struct divides {
54
+ using first_argument_type = T;
55
+ using second_argument_type = T;
56
+ using result_type = T;
57
+ };
58
+
59
+ template <class T> struct modulus {
60
+ using first_argument_type = T;
61
+ using second_argument_type = T;
62
+ using result_type = T;
63
+ };
64
+
65
+ template <class T> struct negate {
66
+ using argument_type = T;
67
+ using result_type = T;
68
+ };
69
+
70
+ template <class T> struct equal_to {
71
+ using first_argument_type = T;
72
+ using second_argument_type = T;
73
+ using result_type = bool;
74
+ };
75
+
76
+ template <class T> struct not_equal_to {
77
+ using first_argument_type = T;
78
+ using second_argument_type = T;
79
+ using result_type = bool;
80
+ };
81
+
82
+ template <class T> struct greater {
83
+ using first_argument_type = T;
84
+ using second_argument_type = T;
85
+ using result_type = bool;
86
+ };
87
+
88
+ template <class T> struct less {
89
+ using first_argument_type = T;
90
+ using second_argument_type = T;
91
+ using result_type = bool;
92
+ };
93
+
94
+ template <class T> struct greater_equal {
95
+ using first_argument_type = T;
96
+ using second_argument_type = T;
97
+ using result_type = bool;
98
+ };
99
+
100
+ template <class T> struct less_equal {
101
+ using first_argument_type = T;
102
+ using second_argument_type = T;
103
+ using result_type = bool;
104
+ };
105
+
106
+ template <class T> struct logical_and {
107
+ using first_argument_type = T;
108
+ using second_argument_type = T;
109
+ using result_type = bool;
110
+ };
111
+
112
+ template <class T> struct logical_or {
113
+ using first_argument_type = T;
114
+ using second_argument_type = T;
115
+ using result_type = bool;
116
+ };
117
+
118
+ template <class T> struct logical_not {
119
+ using argument_type = T;
120
+ using result_type = bool;
121
+ };
122
+
123
+ template <class T> struct bit_and {
124
+ using first_argument_type = T;
125
+ using second_argument_type = T;
126
+ using result_type = T;
127
+ };
128
+
129
+ template <class T> struct bit_or {
130
+ using first_argument_type = T;
131
+ using second_argument_type = T;
132
+ using result_type = T;
133
+ };
134
+
135
+ template <class T> struct bit_xor {
136
+ using first_argument_type = T;
137
+ using second_argument_type = T;
138
+ using result_type = T;
139
+ };
140
+
141
+ template <class T> struct bit_not {
142
+ using argument_type = T;
143
+ using result_type = T;
144
+ };
145
+
146
+ template<class R, class T1>
147
+ class function<R(T1)> {
148
+ public:
149
+ using argument_type = T1;
150
+ };
151
+
152
+ template<class R, class T1, class T2>
153
+ class function<R(T1, T2)> {
154
+ public:
155
+ using first_argument_type = T1;
156
+ using second_argument_type = T2;
157
+ };
158
+ }
159
+ ```
160
+
161
+ `reference_wrapper<T>` has a weak result type (
162
+ [[depr.weak.result_type]]). If `T` is a function type, `result_type`
163
+ shall be a synonym for the return type of `T`.
164
+
165
+ The template specialization `reference_wrapper<T>` shall define a nested
166
+ type named `argument_type` as a synonym for `T1` only if the type `T` is
167
+ any of the following:
168
+
169
+ - a function type or a pointer to function type taking one argument of
170
+ type `T1`
171
+ - a pointer to member function `R T0::f()` cv (where cv represents the
172
+ member function’s cv-qualifiers); the type `T1` is cv `T0*`
173
+ - a class type where the *qualified-id* `T::argument_type` is valid and
174
+ denotes a type ([[temp.deduct]]); the type `T1` is
175
+ `T::argument_type`.
176
+
177
+ The template instantiation `reference_wrapper<T>` shall define two
178
+ nested types named `first_argument_type` and `second_argument_type` as
179
+ synonyms for `T1` and `T2`, respectively, only if the type `T` is any of
180
+ the following:
181
+
182
+ - a function type or a pointer to function type taking two arguments of
183
+ types `T1` and `T2`
184
+ - a pointer to member function `R T0::f(T2)` cv (where cv represents the
185
+ member function’s cv-qualifiers); the type `T1` is cv `T0*`
186
+ - a class type where the *qualified-id*s `T::first_argument_type` and
187
+ `T::second_argument_type` are both valid and both denote types (
188
+ [[temp.deduct]]); the type `T1` is `T::first_argument_type` and the
189
+ type `T2` is `T::second_argument_type`.
190
+
191
+ All enabled specializations `hash<Key>` of `hash` ([[unord.hash]])
192
+ provide two nested types, `result_type` and `argument_type`, which shall
193
+ be synonyms for `size_t` and `Key`, respectively.
194
+
195
+ The forwarding call wrapper `g` returned by a call to
196
+ `bind(f, bound_args...)` ([[func.bind.bind]]) shall have a weak result
197
+ type ([[depr.weak.result_type]]).
198
+
199
+ The forwarding call wrapper `g` returned by a call to
200
+ `bind<R>(f, bound_args...)` ([[func.bind.bind]]) shall have a nested
201
+ type `result_type` defined as a synonym for `R`.
202
+
203
+ The simple call wrapper returned from a call to `mem_fn(pm)` shall have
204
+ a nested type `result_type` that is a synonym for the return type of
205
+ `pm` when `pm` is a pointer to member function.
206
+
207
+ The simple call wrapper returned from a call to `mem_fn(pm)` shall
208
+ define two nested types named `argument_type` and `result_type` as
209
+ synonyms for cv `T*` and `Ret`, respectively, when `pm` is a pointer to
210
+ member function with cv-qualifier cv and taking no arguments, where
211
+ `Ret` is `pm`'s return type.
212
+
213
+ The simple call wrapper returned from a call to `mem_fn(pm)` shall
214
+ define three nested types named `first_argument_type`,
215
+ `second_argument_type`, and `result_type` as synonyms for cv `T*`, `T1`,
216
+ and `Ret`, respectively, when `pm` is a pointer to member function with
217
+ cv-qualifier cv and taking one argument of type `T1`, where `Ret` is
218
+ `pm`'s return type.
219
+
220
+ The following member names are defined in addition to names specified in
221
+ Clause  [[containers]]:
222
+
223
+ ``` cpp
224
+ namespace std {
225
+ template <class Key, class T, class Compare, class Allocator>
226
+ class map<Key, T, Compare, Allocator>::value_compare {
227
+ public:
228
+ using result_type = bool;
229
+ using first_argument_type = value_type;
230
+ using second_argument_type = value_type;
231
+ };
232
+
233
+ template <class Key, class T, class Compare, class Allocator>
234
+ class multimap<Key, T, Compare, Allocator>::value_compare {
235
+ public:
236
+ using result_type = bool;
237
+ using first_argument_type = value_type;
238
+ using second_argument_type = value_type;
239
+ };
240
+ }
241
+ ```
242
+