4 * Hewlett-Packard Company
6 * Permission to use, copy, modify, distribute and sell this software
7 * and its documentation for any purpose is hereby granted without fee,
8 * provided that the above copyright notice appear in all copies and
9 * that both that copyright notice and this permission notice appear
10 * in supporting documentation. Hewlett-Packard Company makes no
11 * representations about the suitability of this software for any
12 * purpose. It is provided "as is" without express or implied warranty.
15 * Copyright (c) 1996-1998
16 * Silicon Graphics Computer Systems, Inc.
18 * Permission to use, copy, modify, distribute and sell this software
19 * and its documentation for any purpose is hereby granted without fee,
20 * provided that the above copyright notice appear in all copies and
21 * that both that copyright notice and this permission notice appear
22 * in supporting documentation. Silicon Graphics makes no
23 * representations about the suitability of this software for any
24 * purpose. It is provided "as is" without express or implied warranty.
27 /* NOTE: This is an internal header file, included by other STL headers.
28 * You should not attempt to use it directly.
31 #ifndef __SGI_STL_INTERNAL_FUNCTION_H
32 #define __SGI_STL_INTERNAL_FUNCTION_H
37 template <class _Arg
, class _Result
>
38 struct unary_function
{
39 typedef _Arg argument_type
;
40 typedef _Result result_type
;
43 template <class _Arg1
, class _Arg2
, class _Result
>
44 struct binary_function
{
45 typedef _Arg1 first_argument_type
;
46 typedef _Arg2 second_argument_type
;
47 typedef _Result result_type
;
51 struct plus
: public binary_function
<_Tp
,_Tp
,_Tp
> {
52 _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
+ __y
; }
56 struct minus
: public binary_function
<_Tp
,_Tp
,_Tp
> {
57 _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
- __y
; }
61 struct multiplies
: public binary_function
<_Tp
,_Tp
,_Tp
> {
62 _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
* __y
; }
66 struct divides
: public binary_function
<_Tp
,_Tp
,_Tp
> {
67 _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
/ __y
; }
70 // identity_element (not part of the C++ standard).
72 template <class _Tp
> inline _Tp
identity_element(plus
<_Tp
>) {
75 template <class _Tp
> inline _Tp
identity_element(multiplies
<_Tp
>) {
80 struct modulus
: public binary_function
<_Tp
,_Tp
,_Tp
>
82 _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
% __y
; }
86 struct negate
: public unary_function
<_Tp
,_Tp
>
88 _Tp
operator()(const _Tp
& __x
) const { return -__x
; }
92 struct equal_to
: public binary_function
<_Tp
,_Tp
,bool>
94 bool operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
== __y
; }
98 struct not_equal_to
: public binary_function
<_Tp
,_Tp
,bool>
100 bool operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
!= __y
; }
104 struct greater
: public binary_function
<_Tp
,_Tp
,bool>
106 bool operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
> __y
; }
110 struct less
: public binary_function
<_Tp
,_Tp
,bool>
112 bool operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
< __y
; }
116 struct greater_equal
: public binary_function
<_Tp
,_Tp
,bool>
118 bool operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
>= __y
; }
122 struct less_equal
: public binary_function
<_Tp
,_Tp
,bool>
124 bool operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
<= __y
; }
128 struct logical_and
: public binary_function
<_Tp
,_Tp
,bool>
130 bool operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
&& __y
; }
134 struct logical_or
: public binary_function
<_Tp
,_Tp
,bool>
136 bool operator()(const _Tp
& __x
, const _Tp
& __y
) const { return __x
|| __y
; }
140 struct logical_not
: public unary_function
<_Tp
,bool>
142 bool operator()(const _Tp
& __x
) const { return !__x
; }
145 template <class _Predicate
>
147 : public unary_function
<typename
_Predicate::argument_type
, bool> {
151 explicit unary_negate(const _Predicate
& __x
) : _M_pred(__x
) {}
152 bool operator()(const typename
_Predicate::argument_type
& __x
) const {
153 return !_M_pred(__x
);
157 template <class _Predicate
>
158 inline unary_negate
<_Predicate
>
159 not1(const _Predicate
& __pred
)
161 return unary_negate
<_Predicate
>(__pred
);
164 template <class _Predicate
>
166 : public binary_function
<typename
_Predicate::first_argument_type
,
167 typename
_Predicate::second_argument_type
,
172 explicit binary_negate(const _Predicate
& __x
) : _M_pred(__x
) {}
173 bool operator()(const typename
_Predicate::first_argument_type
& __x
,
174 const typename
_Predicate::second_argument_type
& __y
) const
176 return !_M_pred(__x
, __y
);
180 template <class _Predicate
>
181 inline binary_negate
<_Predicate
>
182 not2(const _Predicate
& __pred
)
184 return binary_negate
<_Predicate
>(__pred
);
187 template <class _Operation
>
189 : public unary_function
<typename
_Operation::second_argument_type
,
190 typename
_Operation::result_type
> {
193 typename
_Operation::first_argument_type value
;
195 binder1st(const _Operation
& __x
,
196 const typename
_Operation::first_argument_type
& __y
)
197 : op(__x
), value(__y
) {}
198 typename
_Operation::result_type
199 operator()(const typename
_Operation::second_argument_type
& __x
) const {
200 return op(value
, __x
);
202 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
203 // 109. Missing binders for non-const sequence elements
204 typename
_Operation::result_type
205 operator()(typename
_Operation::second_argument_type
& __x
) const {
206 return op(value
, __x
);
211 template <class _Operation
, class _Tp
>
212 inline binder1st
<_Operation
>
213 bind1st(const _Operation
& __fn
, const _Tp
& __x
)
215 typedef typename
_Operation::first_argument_type _Arg1_type
;
216 return binder1st
<_Operation
>(__fn
, _Arg1_type(__x
));
219 template <class _Operation
>
221 : public unary_function
<typename
_Operation::first_argument_type
,
222 typename
_Operation::result_type
> {
225 typename
_Operation::second_argument_type value
;
227 binder2nd(const _Operation
& __x
,
228 const typename
_Operation::second_argument_type
& __y
)
229 : op(__x
), value(__y
) {}
230 typename
_Operation::result_type
231 operator()(const typename
_Operation::first_argument_type
& __x
) const {
232 return op(__x
, value
);
234 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
235 // 109. Missing binders for non-const sequence elements
236 typename
_Operation::result_type
237 operator()(typename
_Operation::first_argument_type
& __x
) const {
238 return op(__x
, value
);
243 template <class _Operation
, class _Tp
>
244 inline binder2nd
<_Operation
>
245 bind2nd(const _Operation
& __fn
, const _Tp
& __x
)
247 typedef typename
_Operation::second_argument_type _Arg2_type
;
248 return binder2nd
<_Operation
>(__fn
, _Arg2_type(__x
));
251 // unary_compose and binary_compose (extensions, not part of the standard).
253 template <class _Operation1
, class _Operation2
>
255 : public unary_function
<typename
_Operation2::argument_type
,
256 typename
_Operation1::result_type
>
262 unary_compose(const _Operation1
& __x
, const _Operation2
& __y
)
263 : _M_fn1(__x
), _M_fn2(__y
) {}
264 typename
_Operation1::result_type
265 operator()(const typename
_Operation2::argument_type
& __x
) const {
266 return _M_fn1(_M_fn2(__x
));
270 template <class _Operation1
, class _Operation2
>
271 inline unary_compose
<_Operation1
,_Operation2
>
272 compose1(const _Operation1
& __fn1
, const _Operation2
& __fn2
)
274 return unary_compose
<_Operation1
,_Operation2
>(__fn1
, __fn2
);
277 template <class _Operation1
, class _Operation2
, class _Operation3
>
279 : public unary_function
<typename
_Operation2::argument_type
,
280 typename
_Operation1::result_type
> {
286 binary_compose(const _Operation1
& __x
, const _Operation2
& __y
,
287 const _Operation3
& __z
)
288 : _M_fn1(__x
), _M_fn2(__y
), _M_fn3(__z
) { }
289 typename
_Operation1::result_type
290 operator()(const typename
_Operation2::argument_type
& __x
) const {
291 return _M_fn1(_M_fn2(__x
), _M_fn3(__x
));
295 template <class _Operation1
, class _Operation2
, class _Operation3
>
296 inline binary_compose
<_Operation1
, _Operation2
, _Operation3
>
297 compose2(const _Operation1
& __fn1
, const _Operation2
& __fn2
,
298 const _Operation3
& __fn3
)
300 return binary_compose
<_Operation1
,_Operation2
,_Operation3
>
301 (__fn1
, __fn2
, __fn3
);
304 template <class _Arg
, class _Result
>
305 class pointer_to_unary_function
: public unary_function
<_Arg
, _Result
> {
307 _Result (*_M_ptr
)(_Arg
);
309 pointer_to_unary_function() {}
310 explicit pointer_to_unary_function(_Result (*__x
)(_Arg
)) : _M_ptr(__x
) {}
311 _Result
operator()(_Arg __x
) const { return _M_ptr(__x
); }
314 template <class _Arg
, class _Result
>
315 inline pointer_to_unary_function
<_Arg
, _Result
> ptr_fun(_Result (*__x
)(_Arg
))
317 return pointer_to_unary_function
<_Arg
, _Result
>(__x
);
320 template <class _Arg1
, class _Arg2
, class _Result
>
321 class pointer_to_binary_function
:
322 public binary_function
<_Arg1
,_Arg2
,_Result
> {
324 _Result (*_M_ptr
)(_Arg1
, _Arg2
);
326 pointer_to_binary_function() {}
327 explicit pointer_to_binary_function(_Result (*__x
)(_Arg1
, _Arg2
))
329 _Result
operator()(_Arg1 __x
, _Arg2 __y
) const {
330 return _M_ptr(__x
, __y
);
334 template <class _Arg1
, class _Arg2
, class _Result
>
335 inline pointer_to_binary_function
<_Arg1
,_Arg2
,_Result
>
336 ptr_fun(_Result (*__x
)(_Arg1
, _Arg2
)) {
337 return pointer_to_binary_function
<_Arg1
,_Arg2
,_Result
>(__x
);
340 // identity is an extensions: it is not part of the standard.
342 struct _Identity
: public unary_function
<_Tp
,_Tp
> {
343 _Tp
& operator()(_Tp
& __x
) const { return __x
; }
344 const _Tp
& operator()(const _Tp
& __x
) const { return __x
; }
347 template <class _Tp
> struct identity
: public _Identity
<_Tp
> {};
349 // select1st and select2nd are extensions: they are not part of the standard.
350 template <class _Pair
>
351 struct _Select1st
: public unary_function
<_Pair
, typename
_Pair::first_type
> {
352 typename
_Pair::first_type
& operator()(_Pair
& __x
) const {
355 const typename
_Pair::first_type
& operator()(const _Pair
& __x
) const {
360 template <class _Pair
>
361 struct _Select2nd
: public unary_function
<_Pair
, typename
_Pair::second_type
>
363 typename
_Pair::second_type
& operator()(_Pair
& __x
) const {
366 const typename
_Pair::second_type
& operator()(const _Pair
& __x
) const {
371 template <class _Pair
> struct select1st
: public _Select1st
<_Pair
> {};
372 template <class _Pair
> struct select2nd
: public _Select2nd
<_Pair
> {};
374 // project1st and project2nd are extensions: they are not part of the standard
375 template <class _Arg1
, class _Arg2
>
376 struct _Project1st
: public binary_function
<_Arg1
, _Arg2
, _Arg1
> {
377 _Arg1
operator()(const _Arg1
& __x
, const _Arg2
&) const { return __x
; }
380 template <class _Arg1
, class _Arg2
>
381 struct _Project2nd
: public binary_function
<_Arg1
, _Arg2
, _Arg2
> {
382 _Arg2
operator()(const _Arg1
&, const _Arg2
& __y
) const { return __y
; }
385 template <class _Arg1
, class _Arg2
>
386 struct project1st
: public _Project1st
<_Arg1
, _Arg2
> {};
388 template <class _Arg1
, class _Arg2
>
389 struct project2nd
: public _Project2nd
<_Arg1
, _Arg2
> {};
391 // constant_void_fun, constant_unary_fun, and constant_binary_fun are
392 // extensions: they are not part of the standard. (The same, of course,
393 // is true of the helper functions constant0, constant1, and constant2.)
395 template <class _Result
>
396 struct _Constant_void_fun
{
397 typedef _Result result_type
;
400 _Constant_void_fun(const result_type
& __v
) : _M_val(__v
) {}
401 const result_type
& operator()() const { return _M_val
; }
404 template <class _Result
, class _Argument
>
405 struct _Constant_unary_fun
{
406 typedef _Argument argument_type
;
407 typedef _Result result_type
;
410 _Constant_unary_fun(const result_type
& __v
) : _M_val(__v
) {}
411 const result_type
& operator()(const _Argument
&) const { return _M_val
; }
414 template <class _Result
, class _Arg1
, class _Arg2
>
415 struct _Constant_binary_fun
{
416 typedef _Arg1 first_argument_type
;
417 typedef _Arg2 second_argument_type
;
418 typedef _Result result_type
;
421 _Constant_binary_fun(const _Result
& __v
) : _M_val(__v
) {}
422 const result_type
& operator()(const _Arg1
&, const _Arg2
&) const {
427 template <class _Result
>
428 struct constant_void_fun
: public _Constant_void_fun
<_Result
> {
429 constant_void_fun(const _Result
& __v
) : _Constant_void_fun
<_Result
>(__v
) {}
433 template <class _Result
,
434 class _Argument
= _Result
>
435 struct constant_unary_fun
: public _Constant_unary_fun
<_Result
, _Argument
>
437 constant_unary_fun(const _Result
& __v
)
438 : _Constant_unary_fun
<_Result
, _Argument
>(__v
) {}
442 template <class _Result
,
443 class _Arg1
= _Result
,
445 struct constant_binary_fun
446 : public _Constant_binary_fun
<_Result
, _Arg1
, _Arg2
>
448 constant_binary_fun(const _Result
& __v
)
449 : _Constant_binary_fun
<_Result
, _Arg1
, _Arg2
>(__v
) {}
452 template <class _Result
>
453 inline constant_void_fun
<_Result
> constant0(const _Result
& __val
)
455 return constant_void_fun
<_Result
>(__val
);
458 template <class _Result
>
459 inline constant_unary_fun
<_Result
,_Result
> constant1(const _Result
& __val
)
461 return constant_unary_fun
<_Result
,_Result
>(__val
);
464 template <class _Result
>
465 inline constant_binary_fun
<_Result
,_Result
,_Result
>
466 constant2(const _Result
& __val
)
468 return constant_binary_fun
<_Result
,_Result
,_Result
>(__val
);
471 // subtractive_rng is an extension: it is not part of the standard.
472 // Note: this code assumes that int is 32 bits.
473 class subtractive_rng
: public unary_function
<unsigned int, unsigned int> {
475 unsigned int _M_table
[55];
479 unsigned int operator()(unsigned int __limit
) {
480 _M_index1
= (_M_index1
+ 1) % 55;
481 _M_index2
= (_M_index2
+ 1) % 55;
482 _M_table
[_M_index1
] = _M_table
[_M_index1
] - _M_table
[_M_index2
];
483 return _M_table
[_M_index1
] % __limit
;
486 void _M_initialize(unsigned int __seed
)
488 unsigned int __k
= 1;
489 _M_table
[54] = __seed
;
491 for (__i
= 0; __i
< 54; __i
++) {
492 size_t __ii
= (21 * (__i
+ 1) % 55) - 1;
493 _M_table
[__ii
] = __k
;
495 __seed
= _M_table
[__ii
];
497 for (int __loop
= 0; __loop
< 4; __loop
++) {
498 for (__i
= 0; __i
< 55; __i
++)
499 _M_table
[__i
] = _M_table
[__i
] - _M_table
[(1 + __i
+ 30) % 55];
505 subtractive_rng(unsigned int __seed
) { _M_initialize(__seed
); }
506 subtractive_rng() { _M_initialize(161803398u); }
510 // Adaptor function objects: pointers to member functions.
512 // There are a total of 16 = 2^4 function objects in this family.
513 // (1) Member functions taking no arguments vs member functions taking
515 // (2) Call through pointer vs call through reference.
516 // (3) Member function with void return type vs member function with
517 // non-void return type.
518 // (4) Const vs non-const member function.
520 // Note that choice (3) is nothing more than a workaround: according
521 // to the draft, compilers should handle void and non-void the same way.
522 // This feature is not yet widely implemented, though. You can only use
523 // member functions returning void if your compiler supports partial
526 // All of this complexity is in the function objects themselves. You can
527 // ignore it by using the helper function mem_fun and mem_fun_ref,
528 // which create whichever type of adaptor is appropriate.
529 // (mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,
530 // but they are provided for backward compatibility.)
533 template <class _Ret
, class _Tp
>
534 class mem_fun_t
: public unary_function
<_Tp
*,_Ret
> {
536 explicit mem_fun_t(_Ret (_Tp::*__pf
)()) : _M_f(__pf
) {}
537 _Ret
operator()(_Tp
* __p
) const { return (__p
->*_M_f
)(); }
542 template <class _Ret
, class _Tp
>
543 class const_mem_fun_t
: public unary_function
<const _Tp
*,_Ret
> {
545 explicit const_mem_fun_t(_Ret (_Tp::*__pf
)() const) : _M_f(__pf
) {}
546 _Ret
operator()(const _Tp
* __p
) const { return (__p
->*_M_f
)(); }
548 _Ret (_Tp::*_M_f
)() const;
552 template <class _Ret
, class _Tp
>
553 class mem_fun_ref_t
: public unary_function
<_Tp
,_Ret
> {
555 explicit mem_fun_ref_t(_Ret (_Tp::*__pf
)()) : _M_f(__pf
) {}
556 _Ret
operator()(_Tp
& __r
) const { return (__r
.*_M_f
)(); }
561 template <class _Ret
, class _Tp
>
562 class const_mem_fun_ref_t
: public unary_function
<_Tp
,_Ret
> {
564 explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf
)() const) : _M_f(__pf
) {}
565 _Ret
operator()(const _Tp
& __r
) const { return (__r
.*_M_f
)(); }
567 _Ret (_Tp::*_M_f
)() const;
570 template <class _Ret
, class _Tp
, class _Arg
>
571 class mem_fun1_t
: public binary_function
<_Tp
*,_Arg
,_Ret
> {
573 explicit mem_fun1_t(_Ret (_Tp::*__pf
)(_Arg
)) : _M_f(__pf
) {}
574 _Ret
operator()(_Tp
* __p
, _Arg __x
) const { return (__p
->*_M_f
)(__x
); }
576 _Ret (_Tp::*_M_f
)(_Arg
);
579 template <class _Ret
, class _Tp
, class _Arg
>
580 class const_mem_fun1_t
: public binary_function
<const _Tp
*,_Arg
,_Ret
> {
582 explicit const_mem_fun1_t(_Ret (_Tp::*__pf
)(_Arg
) const) : _M_f(__pf
) {}
583 _Ret
operator()(const _Tp
* __p
, _Arg __x
) const
584 { return (__p
->*_M_f
)(__x
); }
586 _Ret (_Tp::*_M_f
)(_Arg
) const;
589 template <class _Ret
, class _Tp
, class _Arg
>
590 class mem_fun1_ref_t
: public binary_function
<_Tp
,_Arg
,_Ret
> {
592 explicit mem_fun1_ref_t(_Ret (_Tp::*__pf
)(_Arg
)) : _M_f(__pf
) {}
593 _Ret
operator()(_Tp
& __r
, _Arg __x
) const { return (__r
.*_M_f
)(__x
); }
595 _Ret (_Tp::*_M_f
)(_Arg
);
598 template <class _Ret
, class _Tp
, class _Arg
>
599 class const_mem_fun1_ref_t
: public binary_function
<_Tp
,_Arg
,_Ret
> {
601 explicit const_mem_fun1_ref_t(_Ret (_Tp::*__pf
)(_Arg
) const) : _M_f(__pf
) {}
602 _Ret
operator()(const _Tp
& __r
, _Arg __x
) const { return (__r
.*_M_f
)(__x
); }
604 _Ret (_Tp::*_M_f
)(_Arg
) const;
608 class mem_fun_t
<void, _Tp
> : public unary_function
<_Tp
*,void> {
610 explicit mem_fun_t(void (_Tp::*__pf
)()) : _M_f(__pf
) {}
611 void operator()(_Tp
* __p
) const { (__p
->*_M_f
)(); }
617 class const_mem_fun_t
<void, _Tp
> : public unary_function
<const _Tp
*,void> {
619 explicit const_mem_fun_t(void (_Tp::*__pf
)() const) : _M_f(__pf
) {}
620 void operator()(const _Tp
* __p
) const { (__p
->*_M_f
)(); }
622 void (_Tp::*_M_f
)() const;
626 class mem_fun_ref_t
<void, _Tp
> : public unary_function
<_Tp
,void> {
628 explicit mem_fun_ref_t(void (_Tp::*__pf
)()) : _M_f(__pf
) {}
629 void operator()(_Tp
& __r
) const { (__r
.*_M_f
)(); }
635 class const_mem_fun_ref_t
<void, _Tp
> : public unary_function
<_Tp
,void> {
637 explicit const_mem_fun_ref_t(void (_Tp::*__pf
)() const) : _M_f(__pf
) {}
638 void operator()(const _Tp
& __r
) const { (__r
.*_M_f
)(); }
640 void (_Tp::*_M_f
)() const;
643 template <class _Tp
, class _Arg
>
644 class mem_fun1_t
<void, _Tp
, _Arg
> : public binary_function
<_Tp
*,_Arg
,void> {
646 explicit mem_fun1_t(void (_Tp::*__pf
)(_Arg
)) : _M_f(__pf
) {}
647 void operator()(_Tp
* __p
, _Arg __x
) const { (__p
->*_M_f
)(__x
); }
649 void (_Tp::*_M_f
)(_Arg
);
652 template <class _Tp
, class _Arg
>
653 class const_mem_fun1_t
<void, _Tp
, _Arg
>
654 : public binary_function
<const _Tp
*,_Arg
,void> {
656 explicit const_mem_fun1_t(void (_Tp::*__pf
)(_Arg
) const) : _M_f(__pf
) {}
657 void operator()(const _Tp
* __p
, _Arg __x
) const { (__p
->*_M_f
)(__x
); }
659 void (_Tp::*_M_f
)(_Arg
) const;
662 template <class _Tp
, class _Arg
>
663 class mem_fun1_ref_t
<void, _Tp
, _Arg
>
664 : public binary_function
<_Tp
,_Arg
,void> {
666 explicit mem_fun1_ref_t(void (_Tp::*__pf
)(_Arg
)) : _M_f(__pf
) {}
667 void operator()(_Tp
& __r
, _Arg __x
) const { (__r
.*_M_f
)(__x
); }
669 void (_Tp::*_M_f
)(_Arg
);
672 template <class _Tp
, class _Arg
>
673 class const_mem_fun1_ref_t
<void, _Tp
, _Arg
>
674 : public binary_function
<_Tp
,_Arg
,void> {
676 explicit const_mem_fun1_ref_t(void (_Tp::*__pf
)(_Arg
) const) : _M_f(__pf
) {}
677 void operator()(const _Tp
& __r
, _Arg __x
) const { (__r
.*_M_f
)(__x
); }
679 void (_Tp::*_M_f
)(_Arg
) const;
683 // Mem_fun adaptor helper functions. There are only two:
684 // mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref
685 // are provided for backward compatibility, but they are no longer
686 // part of the C++ standard.)
688 template <class _Ret
, class _Tp
>
689 inline mem_fun_t
<_Ret
,_Tp
> mem_fun(_Ret (_Tp::*__f
)())
690 { return mem_fun_t
<_Ret
,_Tp
>(__f
); }
692 template <class _Ret
, class _Tp
>
693 inline const_mem_fun_t
<_Ret
,_Tp
> mem_fun(_Ret (_Tp::*__f
)() const)
694 { return const_mem_fun_t
<_Ret
,_Tp
>(__f
); }
696 template <class _Ret
, class _Tp
>
697 inline mem_fun_ref_t
<_Ret
,_Tp
> mem_fun_ref(_Ret (_Tp::*__f
)())
698 { return mem_fun_ref_t
<_Ret
,_Tp
>(__f
); }
700 template <class _Ret
, class _Tp
>
701 inline const_mem_fun_ref_t
<_Ret
,_Tp
> mem_fun_ref(_Ret (_Tp::*__f
)() const)
702 { return const_mem_fun_ref_t
<_Ret
,_Tp
>(__f
); }
704 template <class _Ret
, class _Tp
, class _Arg
>
705 inline mem_fun1_t
<_Ret
,_Tp
,_Arg
> mem_fun(_Ret (_Tp::*__f
)(_Arg
))
706 { return mem_fun1_t
<_Ret
,_Tp
,_Arg
>(__f
); }
708 template <class _Ret
, class _Tp
, class _Arg
>
709 inline const_mem_fun1_t
<_Ret
,_Tp
,_Arg
> mem_fun(_Ret (_Tp::*__f
)(_Arg
) const)
710 { return const_mem_fun1_t
<_Ret
,_Tp
,_Arg
>(__f
); }
712 template <class _Ret
, class _Tp
, class _Arg
>
713 inline mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
> mem_fun_ref(_Ret (_Tp::*__f
)(_Arg
))
714 { return mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
>(__f
); }
716 template <class _Ret
, class _Tp
, class _Arg
>
717 inline const_mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
>
718 mem_fun_ref(_Ret (_Tp::*__f
)(_Arg
) const)
719 { return const_mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
>(__f
); }
721 template <class _Ret
, class _Tp
, class _Arg
>
722 inline mem_fun1_t
<_Ret
,_Tp
,_Arg
> mem_fun1(_Ret (_Tp::*__f
)(_Arg
))
723 { return mem_fun1_t
<_Ret
,_Tp
,_Arg
>(__f
); }
725 template <class _Ret
, class _Tp
, class _Arg
>
726 inline const_mem_fun1_t
<_Ret
,_Tp
,_Arg
> mem_fun1(_Ret (_Tp::*__f
)(_Arg
) const)
727 { return const_mem_fun1_t
<_Ret
,_Tp
,_Arg
>(__f
); }
729 template <class _Ret
, class _Tp
, class _Arg
>
730 inline mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
> mem_fun1_ref(_Ret (_Tp::*__f
)(_Arg
))
731 { return mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
>(__f
); }
733 template <class _Ret
, class _Tp
, class _Arg
>
734 inline const_mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
>
735 mem_fun1_ref(_Ret (_Tp::*__f
)(_Arg
) const)
736 { return const_mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
>(__f
); }
740 #endif /* __SGI_STL_INTERNAL_FUNCTION_H */