williamr@4
|
1 |
/*
|
williamr@4
|
2 |
*
|
williamr@4
|
3 |
* Copyright (c) 1994
|
williamr@4
|
4 |
* Hewlett-Packard Company
|
williamr@4
|
5 |
*
|
williamr@4
|
6 |
* Copyright (c) 1996-1998
|
williamr@4
|
7 |
* Silicon Graphics Computer Systems, Inc.
|
williamr@4
|
8 |
*
|
williamr@4
|
9 |
* Copyright (c) 1997
|
williamr@4
|
10 |
* Moscow Center for SPARC Technology
|
williamr@4
|
11 |
*
|
williamr@4
|
12 |
* Copyright (c) 1999
|
williamr@4
|
13 |
* Boris Fomitchev
|
williamr@4
|
14 |
*
|
williamr@4
|
15 |
* Copyright (c) 2000
|
williamr@4
|
16 |
* Pavel Kuznetsov
|
williamr@4
|
17 |
*
|
williamr@4
|
18 |
* Copyright (c) 2001
|
williamr@4
|
19 |
* Meridian'93
|
williamr@4
|
20 |
*
|
williamr@4
|
21 |
* This material is provided "as is", with absolutely no warranty expressed
|
williamr@4
|
22 |
* or implied. Any use is at your own risk.
|
williamr@4
|
23 |
*
|
williamr@4
|
24 |
* Permission to use or copy this software for any purpose is hereby granted
|
williamr@4
|
25 |
* without fee, provided the above notices are retained on all copies.
|
williamr@4
|
26 |
* Permission to modify the code and to distribute modified code is granted,
|
williamr@4
|
27 |
* provided the above notices are retained, and a notice that the code was
|
williamr@4
|
28 |
* modified is included with the above copyright notice.
|
williamr@4
|
29 |
*
|
williamr@4
|
30 |
*/
|
williamr@4
|
31 |
|
williamr@4
|
32 |
/* NOTE: This is an internal header file, included by other STL headers.
|
williamr@4
|
33 |
* You should not attempt to use it directly.
|
williamr@4
|
34 |
*/
|
williamr@4
|
35 |
|
williamr@4
|
36 |
// This file has noo macro protection as it is meant to be included several times
|
williamr@4
|
37 |
// from other header.
|
williamr@4
|
38 |
// Adaptor function objects: pointers to member functions.
|
williamr@4
|
39 |
|
williamr@4
|
40 |
// There are a total of 16 = 2^4 function objects in this family.
|
williamr@4
|
41 |
// (1) Member functions taking no arguments vs member functions taking
|
williamr@4
|
42 |
// one argument.
|
williamr@4
|
43 |
// (2) Call through pointer vs call through reference.
|
williamr@4
|
44 |
// (3) Member function with void return type vs member function with
|
williamr@4
|
45 |
// non-void return type.
|
williamr@4
|
46 |
// (4) Const vs non-const member function.
|
williamr@4
|
47 |
|
williamr@4
|
48 |
// Note that choice (3) is nothing more than a workaround: according
|
williamr@4
|
49 |
// to the draft, compilers should handle void and non-void the same way.
|
williamr@4
|
50 |
// This feature is not yet widely implemented, though. You can only use
|
williamr@4
|
51 |
// member functions returning void if your compiler supports partial
|
williamr@4
|
52 |
// specialization.
|
williamr@4
|
53 |
|
williamr@4
|
54 |
// All of this complexity is in the function objects themselves. You can
|
williamr@4
|
55 |
// ignore it by using the helper function mem_fun and mem_fun_ref,
|
williamr@4
|
56 |
// which create whichever type of adaptor is appropriate.
|
williamr@4
|
57 |
|
williamr@4
|
58 |
_STLP_BEGIN_NAMESPACE
|
williamr@4
|
59 |
|
williamr@4
|
60 |
//This implementation will only be used if needed, that is to say when there is the return void bug
|
williamr@4
|
61 |
//and when there is no partial template specialization
|
williamr@4
|
62 |
#if defined(_STLP_DONT_RETURN_VOID) && defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined(_STLP_MEMBER_TEMPLATE_CLASSES)
|
williamr@4
|
63 |
|
williamr@4
|
64 |
template<class _Result, class _Tp>
|
williamr@4
|
65 |
class _Mem_fun0_ptr : public unary_function<_Tp*, _Result> {
|
williamr@4
|
66 |
protected:
|
williamr@4
|
67 |
typedef _Result (_Tp::*__fun_type) ();
|
williamr@4
|
68 |
explicit _Mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
69 |
|
williamr@4
|
70 |
public:
|
williamr@4
|
71 |
_Result operator ()(_Tp* __p) const { return (__p->*_M_f)(); }
|
williamr@4
|
72 |
|
williamr@4
|
73 |
private:
|
williamr@4
|
74 |
__fun_type _M_f;
|
williamr@4
|
75 |
};
|
williamr@4
|
76 |
|
williamr@4
|
77 |
template<class _Result, class _Tp, class _Arg>
|
williamr@4
|
78 |
class _Mem_fun1_ptr : public binary_function<_Tp*,_Arg,_Result> {
|
williamr@4
|
79 |
protected:
|
williamr@4
|
80 |
typedef _Result (_Tp::*__fun_type) (_Arg);
|
williamr@4
|
81 |
explicit _Mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
82 |
|
williamr@4
|
83 |
public:
|
williamr@4
|
84 |
_Result operator ()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
|
williamr@4
|
85 |
|
williamr@4
|
86 |
private:
|
williamr@4
|
87 |
__fun_type _M_f;
|
williamr@4
|
88 |
};
|
williamr@4
|
89 |
|
williamr@4
|
90 |
template<class _Result, class _Tp>
|
williamr@4
|
91 |
class _Const_mem_fun0_ptr : public unary_function<const _Tp*,_Result> {
|
williamr@4
|
92 |
protected:
|
williamr@4
|
93 |
typedef _Result (_Tp::*__fun_type) () const;
|
williamr@4
|
94 |
explicit _Const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
95 |
|
williamr@4
|
96 |
public:
|
williamr@4
|
97 |
_Result operator ()(const _Tp* __p) const { return (__p->*_M_f)(); }
|
williamr@4
|
98 |
|
williamr@4
|
99 |
private:
|
williamr@4
|
100 |
__fun_type _M_f;
|
williamr@4
|
101 |
};
|
williamr@4
|
102 |
|
williamr@4
|
103 |
template<class _Result, class _Tp, class _Arg>
|
williamr@4
|
104 |
class _Const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,_Result> {
|
williamr@4
|
105 |
protected:
|
williamr@4
|
106 |
typedef _Result (_Tp::*__fun_type) (_Arg) const;
|
williamr@4
|
107 |
explicit _Const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
108 |
|
williamr@4
|
109 |
public:
|
williamr@4
|
110 |
_Result operator ()(const _Tp* __p, _Arg __x) const {
|
williamr@4
|
111 |
return (__p->*_M_f)(__x); }
|
williamr@4
|
112 |
|
williamr@4
|
113 |
private:
|
williamr@4
|
114 |
__fun_type _M_f;
|
williamr@4
|
115 |
};
|
williamr@4
|
116 |
|
williamr@4
|
117 |
template<class _Result, class _Tp>
|
williamr@4
|
118 |
class _Mem_fun0_ref : public unary_function<_Tp&,_Result> {
|
williamr@4
|
119 |
protected:
|
williamr@4
|
120 |
typedef _Result (_Tp::*__fun_type) ();
|
williamr@4
|
121 |
explicit _Mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
122 |
|
williamr@4
|
123 |
public:
|
williamr@4
|
124 |
_Result operator ()(_Tp& __p) const { return (__p.*_M_f)(); }
|
williamr@4
|
125 |
|
williamr@4
|
126 |
private:
|
williamr@4
|
127 |
__fun_type _M_f;
|
williamr@4
|
128 |
};
|
williamr@4
|
129 |
|
williamr@4
|
130 |
template<class _Result, class _Tp, class _Arg>
|
williamr@4
|
131 |
class _Mem_fun1_ref : public binary_function<_Tp&,_Arg,_Result> {
|
williamr@4
|
132 |
protected:
|
williamr@4
|
133 |
typedef _Result (_Tp::*__fun_type) (_Arg);
|
williamr@4
|
134 |
explicit _Mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
135 |
|
williamr@4
|
136 |
public:
|
williamr@4
|
137 |
_Result operator ()(_Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
|
williamr@4
|
138 |
|
williamr@4
|
139 |
private:
|
williamr@4
|
140 |
__fun_type _M_f;
|
williamr@4
|
141 |
};
|
williamr@4
|
142 |
|
williamr@4
|
143 |
template<class _Result, class _Tp>
|
williamr@4
|
144 |
class _Const_mem_fun0_ref : public unary_function<const _Tp&,_Result> {
|
williamr@4
|
145 |
protected:
|
williamr@4
|
146 |
typedef _Result (_Tp::*__fun_type) () const;
|
williamr@4
|
147 |
explicit _Const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
148 |
|
williamr@4
|
149 |
public:
|
williamr@4
|
150 |
_Result operator ()(const _Tp& __p) const { return (__p.*_M_f)(); }
|
williamr@4
|
151 |
|
williamr@4
|
152 |
private:
|
williamr@4
|
153 |
__fun_type _M_f;
|
williamr@4
|
154 |
};
|
williamr@4
|
155 |
|
williamr@4
|
156 |
template<class _Result, class _Tp, class _Arg>
|
williamr@4
|
157 |
class _Const_mem_fun1_ref : public binary_function<const _Tp&,_Arg,_Result> {
|
williamr@4
|
158 |
protected:
|
williamr@4
|
159 |
typedef _Result (_Tp::*__fun_type) (_Arg) const;
|
williamr@4
|
160 |
explicit _Const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
161 |
|
williamr@4
|
162 |
public:
|
williamr@4
|
163 |
_Result operator ()(const _Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
|
williamr@4
|
164 |
|
williamr@4
|
165 |
private:
|
williamr@4
|
166 |
__fun_type _M_f;
|
williamr@4
|
167 |
};
|
williamr@4
|
168 |
|
williamr@4
|
169 |
template<class _Result>
|
williamr@4
|
170 |
struct _Mem_fun_traits {
|
williamr@4
|
171 |
template<class _Tp>
|
williamr@4
|
172 |
struct _Args0 {
|
williamr@4
|
173 |
typedef _Mem_fun0_ptr<_Result,_Tp> _Ptr;
|
williamr@4
|
174 |
typedef _Const_mem_fun0_ptr<_Result,_Tp> _Ptr_const;
|
williamr@4
|
175 |
typedef _Mem_fun0_ref<_Result,_Tp> _Ref;
|
williamr@4
|
176 |
typedef _Const_mem_fun0_ref<_Result,_Tp> _Ref_const;
|
williamr@4
|
177 |
};
|
williamr@4
|
178 |
|
williamr@4
|
179 |
template<class _Tp, class _Arg>
|
williamr@4
|
180 |
struct _Args1 {
|
williamr@4
|
181 |
typedef _Mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr;
|
williamr@4
|
182 |
typedef _Const_mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr_const;
|
williamr@4
|
183 |
typedef _Mem_fun1_ref<_Result,_Tp,_Arg> _Ref;
|
williamr@4
|
184 |
typedef _Const_mem_fun1_ref<_Result,_Tp,_Arg> _Ref_const;
|
williamr@4
|
185 |
};
|
williamr@4
|
186 |
};
|
williamr@4
|
187 |
|
williamr@4
|
188 |
template<class _Arg, class _Result>
|
williamr@4
|
189 |
class _Ptr_fun1_base : public unary_function<_Arg, _Result> {
|
williamr@4
|
190 |
protected:
|
williamr@4
|
191 |
typedef _Result (*__fun_type) (_Arg);
|
williamr@4
|
192 |
explicit _Ptr_fun1_base(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
193 |
|
williamr@4
|
194 |
public:
|
williamr@4
|
195 |
_Result operator()(_Arg __x) const { return _M_f(__x); }
|
williamr@4
|
196 |
|
williamr@4
|
197 |
private:
|
williamr@4
|
198 |
__fun_type _M_f;
|
williamr@4
|
199 |
};
|
williamr@4
|
200 |
|
williamr@4
|
201 |
template <class _Arg1, class _Arg2, class _Result>
|
williamr@4
|
202 |
class _Ptr_fun2_base : public binary_function<_Arg1,_Arg2,_Result> {
|
williamr@4
|
203 |
protected:
|
williamr@4
|
204 |
typedef _Result (*__fun_type) (_Arg1, _Arg2);
|
williamr@4
|
205 |
explicit _Ptr_fun2_base(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
206 |
|
williamr@4
|
207 |
public:
|
williamr@4
|
208 |
_Result operator()(_Arg1 __x, _Arg2 __y) const { return _M_f(__x, __y); }
|
williamr@4
|
209 |
|
williamr@4
|
210 |
private:
|
williamr@4
|
211 |
__fun_type _M_f;
|
williamr@4
|
212 |
};
|
williamr@4
|
213 |
|
williamr@4
|
214 |
template<class _Result>
|
williamr@4
|
215 |
struct _Ptr_fun_traits {
|
williamr@4
|
216 |
template<class _Arg> struct _Args1 {
|
williamr@4
|
217 |
typedef _Ptr_fun1_base<_Arg,_Result> _Fun;
|
williamr@4
|
218 |
};
|
williamr@4
|
219 |
|
williamr@4
|
220 |
template<class _Arg1, class _Arg2> struct _Args2 {
|
williamr@4
|
221 |
typedef _Ptr_fun2_base<_Arg1,_Arg2,_Result> _Fun;
|
williamr@4
|
222 |
};
|
williamr@4
|
223 |
};
|
williamr@4
|
224 |
|
williamr@4
|
225 |
/*Specialization for void return type
|
williamr@4
|
226 |
*/
|
williamr@4
|
227 |
template<class _Tp>
|
williamr@4
|
228 |
class _Void_mem_fun0_ptr : public unary_function<_Tp*,void> {
|
williamr@4
|
229 |
protected:
|
williamr@4
|
230 |
typedef void (_Tp::*__fun_type) ();
|
williamr@4
|
231 |
explicit _Void_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
232 |
|
williamr@4
|
233 |
public:
|
williamr@4
|
234 |
void operator ()(_Tp* __p) const { (__p->*_M_f)(); }
|
williamr@4
|
235 |
|
williamr@4
|
236 |
private:
|
williamr@4
|
237 |
__fun_type _M_f;
|
williamr@4
|
238 |
};
|
williamr@4
|
239 |
|
williamr@4
|
240 |
template<class _Tp, class _Arg>
|
williamr@4
|
241 |
class _Void_mem_fun1_ptr : public binary_function<_Tp*,_Arg,void> {
|
williamr@4
|
242 |
protected:
|
williamr@4
|
243 |
typedef void (_Tp::*__fun_type) (_Arg);
|
williamr@4
|
244 |
explicit _Void_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
245 |
|
williamr@4
|
246 |
public:
|
williamr@4
|
247 |
void operator ()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
|
williamr@4
|
248 |
|
williamr@4
|
249 |
private:
|
williamr@4
|
250 |
__fun_type _M_f;
|
williamr@4
|
251 |
};
|
williamr@4
|
252 |
|
williamr@4
|
253 |
template<class _Tp>
|
williamr@4
|
254 |
class _Void_const_mem_fun0_ptr : public unary_function<const _Tp*,void> {
|
williamr@4
|
255 |
protected:
|
williamr@4
|
256 |
typedef void (_Tp::*__fun_type) () const;
|
williamr@4
|
257 |
explicit _Void_const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
258 |
|
williamr@4
|
259 |
public:
|
williamr@4
|
260 |
void operator ()(const _Tp* __p) const { (__p->*_M_f)(); }
|
williamr@4
|
261 |
|
williamr@4
|
262 |
private:
|
williamr@4
|
263 |
__fun_type _M_f;
|
williamr@4
|
264 |
};
|
williamr@4
|
265 |
|
williamr@4
|
266 |
template<class _Tp, class _Arg>
|
williamr@4
|
267 |
class _Void_const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,void> {
|
williamr@4
|
268 |
protected:
|
williamr@4
|
269 |
typedef void (_Tp::*__fun_type) (_Arg) const;
|
williamr@4
|
270 |
explicit _Void_const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
271 |
|
williamr@4
|
272 |
public:
|
williamr@4
|
273 |
void operator ()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
|
williamr@4
|
274 |
|
williamr@4
|
275 |
private:
|
williamr@4
|
276 |
__fun_type _M_f;
|
williamr@4
|
277 |
};
|
williamr@4
|
278 |
|
williamr@4
|
279 |
template<class _Tp>
|
williamr@4
|
280 |
class _Void_mem_fun0_ref : public unary_function<_Tp&,void> {
|
williamr@4
|
281 |
protected:
|
williamr@4
|
282 |
typedef void (_Tp::*__fun_type) ();
|
williamr@4
|
283 |
explicit _Void_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
284 |
|
williamr@4
|
285 |
public:
|
williamr@4
|
286 |
void operator ()(_Tp& __p) const { (__p.*_M_f)(); }
|
williamr@4
|
287 |
|
williamr@4
|
288 |
private:
|
williamr@4
|
289 |
__fun_type _M_f;
|
williamr@4
|
290 |
};
|
williamr@4
|
291 |
|
williamr@4
|
292 |
template<class _Tp, class _Arg>
|
williamr@4
|
293 |
class _Void_mem_fun1_ref : public binary_function<_Tp&,_Arg,void> {
|
williamr@4
|
294 |
protected:
|
williamr@4
|
295 |
typedef void (_Tp::*__fun_type) (_Arg);
|
williamr@4
|
296 |
explicit _Void_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
297 |
|
williamr@4
|
298 |
public:
|
williamr@4
|
299 |
void operator ()(_Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
|
williamr@4
|
300 |
|
williamr@4
|
301 |
private:
|
williamr@4
|
302 |
__fun_type _M_f;
|
williamr@4
|
303 |
};
|
williamr@4
|
304 |
|
williamr@4
|
305 |
template<class _Tp>
|
williamr@4
|
306 |
class _Void_const_mem_fun0_ref : public unary_function<const _Tp&,void> {
|
williamr@4
|
307 |
protected:
|
williamr@4
|
308 |
typedef void (_Tp::*__fun_type) () const;
|
williamr@4
|
309 |
explicit _Void_const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
310 |
|
williamr@4
|
311 |
public:
|
williamr@4
|
312 |
void operator ()(const _Tp& __p) const { (__p.*_M_f)(); }
|
williamr@4
|
313 |
|
williamr@4
|
314 |
private:
|
williamr@4
|
315 |
__fun_type _M_f;
|
williamr@4
|
316 |
};
|
williamr@4
|
317 |
|
williamr@4
|
318 |
template<class _Tp, class _Arg>
|
williamr@4
|
319 |
class _Void_const_mem_fun1_ref : public binary_function<const _Tp&,_Arg,void> {
|
williamr@4
|
320 |
protected:
|
williamr@4
|
321 |
typedef void (_Tp::*__fun_type) (_Arg) const;
|
williamr@4
|
322 |
explicit _Void_const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
323 |
|
williamr@4
|
324 |
public:
|
williamr@4
|
325 |
void operator ()(const _Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
|
williamr@4
|
326 |
|
williamr@4
|
327 |
private:
|
williamr@4
|
328 |
__fun_type _M_f;
|
williamr@4
|
329 |
};
|
williamr@4
|
330 |
|
williamr@4
|
331 |
_STLP_TEMPLATE_NULL
|
williamr@4
|
332 |
struct _Mem_fun_traits<void> {
|
williamr@4
|
333 |
template<class _Tp> struct _Args0 {
|
williamr@4
|
334 |
typedef _Void_mem_fun0_ptr<_Tp> _Ptr;
|
williamr@4
|
335 |
typedef _Void_const_mem_fun0_ptr<_Tp> _Ptr_const;
|
williamr@4
|
336 |
typedef _Void_mem_fun0_ref<_Tp> _Ref;
|
williamr@4
|
337 |
typedef _Void_const_mem_fun0_ref<_Tp> _Ref_const;
|
williamr@4
|
338 |
};
|
williamr@4
|
339 |
|
williamr@4
|
340 |
template<class _Tp, class _Arg> struct _Args1 {
|
williamr@4
|
341 |
typedef _Void_mem_fun1_ptr<_Tp,_Arg> _Ptr;
|
williamr@4
|
342 |
typedef _Void_const_mem_fun1_ptr<_Tp,_Arg> _Ptr_const;
|
williamr@4
|
343 |
typedef _Void_mem_fun1_ref<_Tp,_Arg> _Ref;
|
williamr@4
|
344 |
typedef _Void_const_mem_fun1_ref<_Tp,_Arg> _Ref_const;
|
williamr@4
|
345 |
};
|
williamr@4
|
346 |
};
|
williamr@4
|
347 |
|
williamr@4
|
348 |
template<class _Arg>
|
williamr@4
|
349 |
class _Ptr_void_fun1_base : public unary_function<_Arg, void> {
|
williamr@4
|
350 |
protected:
|
williamr@4
|
351 |
typedef void (*__fun_type) (_Arg);
|
williamr@4
|
352 |
explicit _Ptr_void_fun1_base(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
353 |
|
williamr@4
|
354 |
public:
|
williamr@4
|
355 |
void operator()(_Arg __x) const { _M_f(__x); }
|
williamr@4
|
356 |
|
williamr@4
|
357 |
private:
|
williamr@4
|
358 |
__fun_type _M_f;
|
williamr@4
|
359 |
};
|
williamr@4
|
360 |
|
williamr@4
|
361 |
template <class _Arg1, class _Arg2>
|
williamr@4
|
362 |
class _Ptr_void_fun2_base : public binary_function<_Arg1,_Arg2,void> {
|
williamr@4
|
363 |
protected:
|
williamr@4
|
364 |
typedef void (*__fun_type) (_Arg1, _Arg2);
|
williamr@4
|
365 |
explicit _Ptr_void_fun2_base(__fun_type __f) : _M_f(__f) {}
|
williamr@4
|
366 |
|
williamr@4
|
367 |
public:
|
williamr@4
|
368 |
void operator()(_Arg1 __x, _Arg2 __y) const { _M_f(__x, __y); }
|
williamr@4
|
369 |
|
williamr@4
|
370 |
private:
|
williamr@4
|
371 |
__fun_type _M_f;
|
williamr@4
|
372 |
};
|
williamr@4
|
373 |
|
williamr@4
|
374 |
_STLP_TEMPLATE_NULL
|
williamr@4
|
375 |
struct _Ptr_fun_traits<void> {
|
williamr@4
|
376 |
template<class _Arg> struct _Args1 {
|
williamr@4
|
377 |
typedef _Ptr_void_fun1_base<_Arg> _Fun;
|
williamr@4
|
378 |
};
|
williamr@4
|
379 |
|
williamr@4
|
380 |
template<class _Arg1, class _Arg2> struct _Args2 {
|
williamr@4
|
381 |
typedef _Ptr_void_fun2_base<_Arg1,_Arg2> _Fun;
|
williamr@4
|
382 |
};
|
williamr@4
|
383 |
};
|
williamr@4
|
384 |
|
williamr@4
|
385 |
// pavel: need extra level of inheritance here since MSVC++ does not
|
williamr@4
|
386 |
// accept traits-based fake partial specialization for template
|
williamr@4
|
387 |
// arguments other than first
|
williamr@4
|
388 |
|
williamr@4
|
389 |
template<class _Result, class _Arg>
|
williamr@4
|
390 |
class _Ptr_fun1 :
|
williamr@4
|
391 |
public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun {
|
williamr@4
|
392 |
protected:
|
williamr@4
|
393 |
typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun _Base;
|
williamr@4
|
394 |
explicit _Ptr_fun1(typename _Base::__fun_type __f) : _Base(__f) {}
|
williamr@4
|
395 |
};
|
williamr@4
|
396 |
|
williamr@4
|
397 |
template<class _Result, class _Arg1, class _Arg2>
|
williamr@4
|
398 |
class _Ptr_fun2 :
|
williamr@4
|
399 |
public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun {
|
williamr@4
|
400 |
protected:
|
williamr@4
|
401 |
typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun _Base;
|
williamr@4
|
402 |
explicit _Ptr_fun2(typename _Base::__fun_type __f) : _Base(__f) {}
|
williamr@4
|
403 |
};
|
williamr@4
|
404 |
|
williamr@4
|
405 |
|
williamr@4
|
406 |
#endif /*_STLP_DONT_RETURN_VOID && _STLP_NO_CLASS_PARTIAL_SPECIALIZATION && _STLP_MEMBER_TEMPLATE_CLASSES*/
|
williamr@4
|
407 |
|
williamr@4
|
408 |
|
williamr@4
|
409 |
#if !defined(_STLP_DONT_RETURN_VOID) || !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) || !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
|
williamr@4
|
410 |
|
williamr@4
|
411 |
template <class _Ret, class _Tp>
|
williamr@4
|
412 |
class mem_fun_t : public unary_function<_Tp*,_Ret> {
|
williamr@4
|
413 |
typedef _Ret (_Tp::*__fun_type)(void);
|
williamr@4
|
414 |
public:
|
williamr@4
|
415 |
explicit mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
416 |
_Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); }
|
williamr@4
|
417 |
private:
|
williamr@4
|
418 |
__fun_type _M_f;
|
williamr@4
|
419 |
};
|
williamr@4
|
420 |
|
williamr@4
|
421 |
template <class _Ret, class _Tp>
|
williamr@4
|
422 |
class const_mem_fun_t : public unary_function<const _Tp*,_Ret> {
|
williamr@4
|
423 |
typedef _Ret (_Tp::*__fun_type)(void) const;
|
williamr@4
|
424 |
public:
|
williamr@4
|
425 |
explicit const_mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
426 |
_Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); }
|
williamr@4
|
427 |
private:
|
williamr@4
|
428 |
__fun_type _M_f;
|
williamr@4
|
429 |
};
|
williamr@4
|
430 |
|
williamr@4
|
431 |
|
williamr@4
|
432 |
template <class _Ret, class _Tp>
|
williamr@4
|
433 |
class mem_fun_ref_t : public unary_function<_Tp,_Ret> {
|
williamr@4
|
434 |
typedef _Ret (_Tp::*__fun_type)(void);
|
williamr@4
|
435 |
public:
|
williamr@4
|
436 |
explicit mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
437 |
_Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); }
|
williamr@4
|
438 |
private:
|
williamr@4
|
439 |
__fun_type _M_f;
|
williamr@4
|
440 |
};
|
williamr@4
|
441 |
|
williamr@4
|
442 |
template <class _Ret, class _Tp>
|
williamr@4
|
443 |
class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> {
|
williamr@4
|
444 |
typedef _Ret (_Tp::*__fun_type)(void) const;
|
williamr@4
|
445 |
public:
|
williamr@4
|
446 |
explicit const_mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
447 |
_Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
|
williamr@4
|
448 |
private:
|
williamr@4
|
449 |
__fun_type _M_f;
|
williamr@4
|
450 |
};
|
williamr@4
|
451 |
|
williamr@4
|
452 |
template <class _Ret, class _Tp, class _Arg>
|
williamr@4
|
453 |
class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> {
|
williamr@4
|
454 |
typedef _Ret (_Tp::*__fun_type)(_Arg);
|
williamr@4
|
455 |
public:
|
williamr@4
|
456 |
explicit mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
457 |
_Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
|
williamr@4
|
458 |
private:
|
williamr@4
|
459 |
__fun_type _M_f;
|
williamr@4
|
460 |
};
|
williamr@4
|
461 |
|
williamr@4
|
462 |
template <class _Ret, class _Tp, class _Arg>
|
williamr@4
|
463 |
class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> {
|
williamr@4
|
464 |
typedef _Ret (_Tp::*__fun_type)(_Arg) const;
|
williamr@4
|
465 |
public:
|
williamr@4
|
466 |
explicit const_mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
467 |
_Ret operator()(const _Tp* __p, _Arg __x) const
|
williamr@4
|
468 |
{ return (__p->*_M_f)(__x); }
|
williamr@4
|
469 |
private:
|
williamr@4
|
470 |
__fun_type _M_f;
|
williamr@4
|
471 |
};
|
williamr@4
|
472 |
|
williamr@4
|
473 |
template <class _Ret, class _Tp, class _Arg>
|
williamr@4
|
474 |
class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
|
williamr@4
|
475 |
typedef _Ret (_Tp::*__fun_type)(_Arg);
|
williamr@4
|
476 |
public:
|
williamr@4
|
477 |
explicit mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
478 |
_Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
|
williamr@4
|
479 |
private:
|
williamr@4
|
480 |
__fun_type _M_f;
|
williamr@4
|
481 |
};
|
williamr@4
|
482 |
|
williamr@4
|
483 |
template <class _Ret, class _Tp, class _Arg>
|
williamr@4
|
484 |
class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
|
williamr@4
|
485 |
typedef _Ret (_Tp::*__fun_type)(_Arg) const;
|
williamr@4
|
486 |
public:
|
williamr@4
|
487 |
explicit const_mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
488 |
_Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
|
williamr@4
|
489 |
private:
|
williamr@4
|
490 |
__fun_type _M_f;
|
williamr@4
|
491 |
};
|
williamr@4
|
492 |
|
williamr@4
|
493 |
template <class _Arg, class _Result>
|
williamr@4
|
494 |
class pointer_to_unary_function : public unary_function<_Arg, _Result> {
|
williamr@4
|
495 |
protected:
|
williamr@4
|
496 |
_Result (*_M_ptr)(_Arg);
|
williamr@4
|
497 |
public:
|
williamr@4
|
498 |
pointer_to_unary_function() {}
|
williamr@4
|
499 |
explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {}
|
williamr@4
|
500 |
_Result operator()(_Arg __x) const { return _M_ptr(__x); }
|
williamr@4
|
501 |
};
|
williamr@4
|
502 |
|
williamr@4
|
503 |
template <class _Arg1, class _Arg2, class _Result>
|
williamr@4
|
504 |
class pointer_to_binary_function :
|
williamr@4
|
505 |
public binary_function<_Arg1,_Arg2,_Result> {
|
williamr@4
|
506 |
protected:
|
williamr@4
|
507 |
_Result (*_M_ptr)(_Arg1, _Arg2);
|
williamr@4
|
508 |
public:
|
williamr@4
|
509 |
pointer_to_binary_function() {}
|
williamr@4
|
510 |
explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))
|
williamr@4
|
511 |
: _M_ptr(__x) {}
|
williamr@4
|
512 |
_Result operator()(_Arg1 __x, _Arg2 __y) const {
|
williamr@4
|
513 |
return _M_ptr(__x, __y);
|
williamr@4
|
514 |
}
|
williamr@4
|
515 |
};
|
williamr@4
|
516 |
|
williamr@4
|
517 |
|
williamr@4
|
518 |
#if defined(_STLP_DONT_RETURN_VOID) && !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION)
|
williamr@4
|
519 |
//Partial specialization for the void type
|
williamr@4
|
520 |
template <class _Tp>
|
williamr@4
|
521 |
class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {
|
williamr@4
|
522 |
typedef void (_Tp::*__fun_type)(void);
|
williamr@4
|
523 |
public:
|
williamr@4
|
524 |
explicit mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
525 |
void operator()(_Tp* __p) const { (__p->*_M_f)(); }
|
williamr@4
|
526 |
private:
|
williamr@4
|
527 |
__fun_type _M_f;
|
williamr@4
|
528 |
};
|
williamr@4
|
529 |
|
williamr@4
|
530 |
template <class _Tp>
|
williamr@4
|
531 |
class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> {
|
williamr@4
|
532 |
typedef void (_Tp::*__fun_type)(void) const;
|
williamr@4
|
533 |
public:
|
williamr@4
|
534 |
explicit const_mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
535 |
void operator()(const _Tp* __p) const { (__p->*_M_f)(); }
|
williamr@4
|
536 |
private:
|
williamr@4
|
537 |
__fun_type _M_f;
|
williamr@4
|
538 |
};
|
williamr@4
|
539 |
|
williamr@4
|
540 |
template <class _Tp>
|
williamr@4
|
541 |
class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
|
williamr@4
|
542 |
typedef void (_Tp::*__fun_type)(void);
|
williamr@4
|
543 |
public:
|
williamr@4
|
544 |
explicit mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
545 |
void operator()(_Tp& __r) const { (__r.*_M_f)(); }
|
williamr@4
|
546 |
private:
|
williamr@4
|
547 |
__fun_type _M_f;
|
williamr@4
|
548 |
};
|
williamr@4
|
549 |
|
williamr@4
|
550 |
template <class _Tp>
|
williamr@4
|
551 |
class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
|
williamr@4
|
552 |
typedef void (_Tp::*__fun_type)(void) const;
|
williamr@4
|
553 |
public:
|
williamr@4
|
554 |
explicit const_mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
555 |
void operator()(const _Tp& __r) const { (__r.*_M_f)(); }
|
williamr@4
|
556 |
private:
|
williamr@4
|
557 |
__fun_type _M_f;
|
williamr@4
|
558 |
};
|
williamr@4
|
559 |
|
williamr@4
|
560 |
template <class _Tp, class _Arg>
|
williamr@4
|
561 |
class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> {
|
williamr@4
|
562 |
typedef void (_Tp::*__fun_type)(_Arg);
|
williamr@4
|
563 |
public:
|
williamr@4
|
564 |
explicit mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
565 |
void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
|
williamr@4
|
566 |
private:
|
williamr@4
|
567 |
__fun_type _M_f;
|
williamr@4
|
568 |
};
|
williamr@4
|
569 |
|
williamr@4
|
570 |
template <class _Tp, class _Arg>
|
williamr@4
|
571 |
class const_mem_fun1_t<void, _Tp, _Arg>
|
williamr@4
|
572 |
: public binary_function<const _Tp*,_Arg,void> {
|
williamr@4
|
573 |
typedef void (_Tp::*__fun_type)(_Arg) const;
|
williamr@4
|
574 |
public:
|
williamr@4
|
575 |
explicit const_mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
576 |
void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
|
williamr@4
|
577 |
private:
|
williamr@4
|
578 |
__fun_type _M_f;
|
williamr@4
|
579 |
};
|
williamr@4
|
580 |
|
williamr@4
|
581 |
template <class _Tp, class _Arg>
|
williamr@4
|
582 |
class mem_fun1_ref_t<void, _Tp, _Arg>
|
williamr@4
|
583 |
: public binary_function<_Tp,_Arg,void> {
|
williamr@4
|
584 |
typedef void (_Tp::*__fun_type)(_Arg);
|
williamr@4
|
585 |
public:
|
williamr@4
|
586 |
explicit mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
587 |
void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
|
williamr@4
|
588 |
private:
|
williamr@4
|
589 |
__fun_type _M_f;
|
williamr@4
|
590 |
};
|
williamr@4
|
591 |
|
williamr@4
|
592 |
template <class _Tp, class _Arg>
|
williamr@4
|
593 |
class const_mem_fun1_ref_t<void, _Tp, _Arg>
|
williamr@4
|
594 |
: public binary_function<_Tp,_Arg,void> {
|
williamr@4
|
595 |
typedef void (_Tp::*__fun_type)(_Arg) const;
|
williamr@4
|
596 |
public:
|
williamr@4
|
597 |
explicit const_mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
|
williamr@4
|
598 |
void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
|
williamr@4
|
599 |
private:
|
williamr@4
|
600 |
__fun_type _M_f;
|
williamr@4
|
601 |
};
|
williamr@4
|
602 |
|
williamr@4
|
603 |
template <class _Arg>
|
williamr@4
|
604 |
class pointer_to_unary_function<_Arg, void> : public unary_function<_Arg, void> {
|
williamr@4
|
605 |
typedef void (*__fun_type)(_Arg);
|
williamr@4
|
606 |
__fun_type _M_ptr;
|
williamr@4
|
607 |
public:
|
williamr@4
|
608 |
pointer_to_unary_function() {}
|
williamr@4
|
609 |
explicit pointer_to_unary_function(__fun_type __x) : _M_ptr(__x) {}
|
williamr@4
|
610 |
void operator()(_Arg __x) const { _M_ptr(__x); }
|
williamr@4
|
611 |
};
|
williamr@4
|
612 |
|
williamr@4
|
613 |
template <class _Arg1, class _Arg2>
|
williamr@4
|
614 |
class pointer_to_binary_function<_Arg1, _Arg2, void> : public binary_function<_Arg1,_Arg2,void> {
|
williamr@4
|
615 |
typedef void (*__fun_type)(_Arg1, _Arg2);
|
williamr@4
|
616 |
__fun_type _M_ptr;
|
williamr@4
|
617 |
public:
|
williamr@4
|
618 |
pointer_to_binary_function() {}
|
williamr@4
|
619 |
explicit pointer_to_binary_function(__fun_type __x) : _M_ptr(__x) {}
|
williamr@4
|
620 |
void operator()(_Arg1 __x, _Arg2 __y) const { _M_ptr(__x, __y); }
|
williamr@4
|
621 |
};
|
williamr@4
|
622 |
|
williamr@4
|
623 |
#endif /*_STLP_DONT_RETURN_VOID && !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION*/
|
williamr@4
|
624 |
|
williamr@4
|
625 |
#else /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/
|
williamr@4
|
626 |
|
williamr@4
|
627 |
//mem_fun_t
|
williamr@4
|
628 |
template <class _Result, class _Tp>
|
williamr@4
|
629 |
class mem_fun_t :
|
williamr@4
|
630 |
public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr {
|
williamr@4
|
631 |
typedef typename
|
williamr@4
|
632 |
_Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr _Base;
|
williamr@4
|
633 |
public:
|
williamr@4
|
634 |
explicit mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
|
williamr@4
|
635 |
};
|
williamr@4
|
636 |
|
williamr@4
|
637 |
//const_mem_fun_t
|
williamr@4
|
638 |
template <class _Result, class _Tp>
|
williamr@4
|
639 |
class const_mem_fun_t :
|
williamr@4
|
640 |
public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const {
|
williamr@4
|
641 |
typedef typename
|
williamr@4
|
642 |
_Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const _Base;
|
williamr@4
|
643 |
public:
|
williamr@4
|
644 |
explicit const_mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
|
williamr@4
|
645 |
};
|
williamr@4
|
646 |
|
williamr@4
|
647 |
//mem_fun_ref_t
|
williamr@4
|
648 |
template <class _Result, class _Tp>
|
williamr@4
|
649 |
class mem_fun_ref_t :
|
williamr@4
|
650 |
public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref {
|
williamr@4
|
651 |
typedef typename
|
williamr@4
|
652 |
_Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref _Base;
|
williamr@4
|
653 |
public:
|
williamr@4
|
654 |
explicit mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
|
williamr@4
|
655 |
};
|
williamr@4
|
656 |
|
williamr@4
|
657 |
//const_mem_fun_ref_t
|
williamr@4
|
658 |
template <class _Result, class _Tp>
|
williamr@4
|
659 |
class const_mem_fun_ref_t :
|
williamr@4
|
660 |
public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const {
|
williamr@4
|
661 |
typedef typename
|
williamr@4
|
662 |
_Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const _Base;
|
williamr@4
|
663 |
public:
|
williamr@4
|
664 |
explicit const_mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
|
williamr@4
|
665 |
};
|
williamr@4
|
666 |
|
williamr@4
|
667 |
//mem_fun1_t
|
williamr@4
|
668 |
template <class _Result, class _Tp, class _Arg>
|
williamr@4
|
669 |
class mem_fun1_t :
|
williamr@4
|
670 |
public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr {
|
williamr@4
|
671 |
typedef typename
|
williamr@4
|
672 |
_Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr _Base;
|
williamr@4
|
673 |
public:
|
williamr@4
|
674 |
explicit mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
|
williamr@4
|
675 |
};
|
williamr@4
|
676 |
|
williamr@4
|
677 |
//const_mem_fun1_t
|
williamr@4
|
678 |
template <class _Result, class _Tp, class _Arg>
|
williamr@4
|
679 |
class const_mem_fun1_t :
|
williamr@4
|
680 |
public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const {
|
williamr@4
|
681 |
typedef typename
|
williamr@4
|
682 |
_Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const _Base;
|
williamr@4
|
683 |
public:
|
williamr@4
|
684 |
explicit const_mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
|
williamr@4
|
685 |
};
|
williamr@4
|
686 |
|
williamr@4
|
687 |
//mem_fun1_ref_t
|
williamr@4
|
688 |
template <class _Result, class _Tp, class _Arg>
|
williamr@4
|
689 |
class mem_fun1_ref_t :
|
williamr@4
|
690 |
public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref {
|
williamr@4
|
691 |
typedef typename
|
williamr@4
|
692 |
_Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref _Base;
|
williamr@4
|
693 |
public:
|
williamr@4
|
694 |
explicit mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
|
williamr@4
|
695 |
};
|
williamr@4
|
696 |
|
williamr@4
|
697 |
//const_mem_fun1_t
|
williamr@4
|
698 |
template <class _Result, class _Tp, class _Arg>
|
williamr@4
|
699 |
class const_mem_fun1_ref_t :
|
williamr@4
|
700 |
public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const {
|
williamr@4
|
701 |
typedef typename
|
williamr@4
|
702 |
_Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const _Base;
|
williamr@4
|
703 |
public:
|
williamr@4
|
704 |
explicit const_mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
|
williamr@4
|
705 |
};
|
williamr@4
|
706 |
|
williamr@4
|
707 |
|
williamr@4
|
708 |
template <class _Arg, class _Result>
|
williamr@4
|
709 |
class pointer_to_unary_function :
|
williamr@4
|
710 |
public _Ptr_fun1<_Result,_Arg> {
|
williamr@4
|
711 |
typedef typename
|
williamr@4
|
712 |
_Ptr_fun1<_Result,_Arg>::__fun_type __fun_type;
|
williamr@4
|
713 |
public:
|
williamr@4
|
714 |
explicit pointer_to_unary_function(__fun_type __f)
|
williamr@4
|
715 |
: _Ptr_fun1<_Result,_Arg>(__f) {}
|
williamr@4
|
716 |
};
|
williamr@4
|
717 |
|
williamr@4
|
718 |
template <class _Arg1, class _Arg2, class _Result>
|
williamr@4
|
719 |
class pointer_to_binary_function :
|
williamr@4
|
720 |
public _Ptr_fun2<_Result,_Arg1,_Arg2> {
|
williamr@4
|
721 |
typedef typename
|
williamr@4
|
722 |
_Ptr_fun2<_Result,_Arg1,_Arg2>::__fun_type __fun_type;
|
williamr@4
|
723 |
public:
|
williamr@4
|
724 |
explicit pointer_to_binary_function(__fun_type __f)
|
williamr@4
|
725 |
: _Ptr_fun2<_Result,_Arg1,_Arg2>(__f) {}
|
williamr@4
|
726 |
};
|
williamr@4
|
727 |
|
williamr@4
|
728 |
#endif /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/
|
williamr@4
|
729 |
|
williamr@4
|
730 |
|
williamr@4
|
731 |
# if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
|
williamr@4
|
732 |
// Mem_fun adaptor helper functions. There are only two:
|
williamr@4
|
733 |
// mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref
|
williamr@4
|
734 |
// are provided for backward compatibility, but they are no longer
|
williamr@4
|
735 |
// part of the C++ standard.)
|
williamr@4
|
736 |
|
williamr@4
|
737 |
template <class _Result, class _Tp>
|
williamr@4
|
738 |
inline mem_fun_t<_Result,_Tp>
|
williamr@4
|
739 |
mem_fun(_Result (_Tp::*__f)()) { return mem_fun_t<_Result,_Tp>(__f); }
|
williamr@4
|
740 |
|
williamr@4
|
741 |
template <class _Result, class _Tp>
|
williamr@4
|
742 |
inline const_mem_fun_t<_Result,_Tp>
|
williamr@4
|
743 |
mem_fun(_Result (_Tp::*__f)() const) { return const_mem_fun_t<_Result,_Tp>(__f); }
|
williamr@4
|
744 |
|
williamr@4
|
745 |
template <class _Result, class _Tp>
|
williamr@4
|
746 |
inline mem_fun_ref_t<_Result,_Tp>
|
williamr@4
|
747 |
mem_fun_ref(_Result (_Tp::*__f)()) { return mem_fun_ref_t<_Result,_Tp>(__f); }
|
williamr@4
|
748 |
|
williamr@4
|
749 |
template <class _Result, class _Tp>
|
williamr@4
|
750 |
inline const_mem_fun_ref_t<_Result,_Tp>
|
williamr@4
|
751 |
mem_fun_ref(_Result (_Tp::*__f)() const) { return const_mem_fun_ref_t<_Result,_Tp>(__f); }
|
williamr@4
|
752 |
|
williamr@4
|
753 |
template <class _Result, class _Tp, class _Arg>
|
williamr@4
|
754 |
inline mem_fun1_t<_Result,_Tp,_Arg>
|
williamr@4
|
755 |
mem_fun(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
|
williamr@4
|
756 |
|
williamr@4
|
757 |
template <class _Result, class _Tp, class _Arg>
|
williamr@4
|
758 |
inline const_mem_fun1_t<_Result,_Tp,_Arg>
|
williamr@4
|
759 |
mem_fun(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
|
williamr@4
|
760 |
|
williamr@4
|
761 |
template <class _Result, class _Tp, class _Arg>
|
williamr@4
|
762 |
inline mem_fun1_ref_t<_Result,_Tp,_Arg>
|
williamr@4
|
763 |
mem_fun_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
|
williamr@4
|
764 |
|
williamr@4
|
765 |
template <class _Result, class _Tp, class _Arg>
|
williamr@4
|
766 |
inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
|
williamr@4
|
767 |
mem_fun_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
|
williamr@4
|
768 |
|
williamr@4
|
769 |
# if !(defined (_STLP_NO_EXTENSIONS) || defined (_STLP_NO_ANACHRONISMS))
|
williamr@4
|
770 |
// mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,
|
williamr@4
|
771 |
// but they are provided for backward compatibility.
|
williamr@4
|
772 |
template <class _Result, class _Tp, class _Arg>
|
williamr@4
|
773 |
inline mem_fun1_t<_Result,_Tp,_Arg>
|
williamr@4
|
774 |
mem_fun1(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
|
williamr@4
|
775 |
|
williamr@4
|
776 |
template <class _Result, class _Tp, class _Arg>
|
williamr@4
|
777 |
inline const_mem_fun1_t<_Result,_Tp,_Arg>
|
williamr@4
|
778 |
mem_fun1(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
|
williamr@4
|
779 |
|
williamr@4
|
780 |
template <class _Result, class _Tp, class _Arg>
|
williamr@4
|
781 |
inline mem_fun1_ref_t<_Result,_Tp,_Arg>
|
williamr@4
|
782 |
mem_fun1_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
|
williamr@4
|
783 |
|
williamr@4
|
784 |
template <class _Result, class _Tp, class _Arg>
|
williamr@4
|
785 |
inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
|
williamr@4
|
786 |
mem_fun1_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
|
williamr@4
|
787 |
|
williamr@4
|
788 |
# endif /* _STLP_NO_EXTENSIONS */
|
williamr@4
|
789 |
|
williamr@4
|
790 |
# endif /* _STLP_MEMBER_POINTER_PARAM_BUG */
|
williamr@4
|
791 |
|
williamr@4
|
792 |
template <class _Arg, class _Result>
|
williamr@4
|
793 |
inline pointer_to_unary_function<_Arg, _Result>
|
williamr@4
|
794 |
ptr_fun(_Result (*__f)(_Arg))
|
williamr@4
|
795 |
{ return pointer_to_unary_function<_Arg, _Result>(__f); }
|
williamr@4
|
796 |
|
williamr@4
|
797 |
template <class _Arg1, class _Arg2, class _Result>
|
williamr@4
|
798 |
inline pointer_to_binary_function<_Arg1,_Arg2,_Result>
|
williamr@4
|
799 |
ptr_fun(_Result (*__f)(_Arg1, _Arg2))
|
williamr@4
|
800 |
{ return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f); }
|
williamr@4
|
801 |
|
williamr@4
|
802 |
_STLP_END_NAMESPACE
|