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
);
204 template <class _Operation
, class _Tp
>
205 inline binder1st
<_Operation
>
206 bind1st(const _Operation
& __fn
, const _Tp
& __x
)
208 typedef typename
_Operation::first_argument_type _Arg1_type
;
209 return binder1st
<_Operation
>(__fn
, _Arg1_type(__x
));
212 template <class _Operation
>
214 : public unary_function
<typename
_Operation::first_argument_type
,
215 typename
_Operation::result_type
> {
218 typename
_Operation::second_argument_type value
;
220 binder2nd(const _Operation
& __x
,
221 const typename
_Operation::second_argument_type
& __y
)
222 : op(__x
), value(__y
) {}
223 typename
_Operation::result_type
224 operator()(const typename
_Operation::first_argument_type
& __x
) const {
225 return op(__x
, value
);
229 template <class _Operation
, class _Tp
>
230 inline binder2nd
<_Operation
>
231 bind2nd(const _Operation
& __fn
, const _Tp
& __x
)
233 typedef typename
_Operation::second_argument_type _Arg2_type
;
234 return binder2nd
<_Operation
>(__fn
, _Arg2_type(__x
));
237 // unary_compose and binary_compose (extensions, not part of the standard).
239 template <class _Operation1
, class _Operation2
>
241 : public unary_function
<typename
_Operation2::argument_type
,
242 typename
_Operation1::result_type
>
248 unary_compose(const _Operation1
& __x
, const _Operation2
& __y
)
249 : _M_fn1(__x
), _M_fn2(__y
) {}
250 typename
_Operation1::result_type
251 operator()(const typename
_Operation2::argument_type
& __x
) const {
252 return _M_fn1(_M_fn2(__x
));
256 template <class _Operation1
, class _Operation2
>
257 inline unary_compose
<_Operation1
,_Operation2
>
258 compose1(const _Operation1
& __fn1
, const _Operation2
& __fn2
)
260 return unary_compose
<_Operation1
,_Operation2
>(__fn1
, __fn2
);
263 template <class _Operation1
, class _Operation2
, class _Operation3
>
265 : public unary_function
<typename
_Operation2::argument_type
,
266 typename
_Operation1::result_type
> {
272 binary_compose(const _Operation1
& __x
, const _Operation2
& __y
,
273 const _Operation3
& __z
)
274 : _M_fn1(__x
), _M_fn2(__y
), _M_fn3(__z
) { }
275 typename
_Operation1::result_type
276 operator()(const typename
_Operation2::argument_type
& __x
) const {
277 return _M_fn1(_M_fn2(__x
), _M_fn3(__x
));
281 template <class _Operation1
, class _Operation2
, class _Operation3
>
282 inline binary_compose
<_Operation1
, _Operation2
, _Operation3
>
283 compose2(const _Operation1
& __fn1
, const _Operation2
& __fn2
,
284 const _Operation3
& __fn3
)
286 return binary_compose
<_Operation1
,_Operation2
,_Operation3
>
287 (__fn1
, __fn2
, __fn3
);
290 template <class _Arg
, class _Result
>
291 class pointer_to_unary_function
: public unary_function
<_Arg
, _Result
> {
293 _Result (*_M_ptr
)(_Arg
);
295 pointer_to_unary_function() {}
296 explicit pointer_to_unary_function(_Result (*__x
)(_Arg
)) : _M_ptr(__x
) {}
297 _Result
operator()(_Arg __x
) const { return _M_ptr(__x
); }
300 template <class _Arg
, class _Result
>
301 inline pointer_to_unary_function
<_Arg
, _Result
> ptr_fun(_Result (*__x
)(_Arg
))
303 return pointer_to_unary_function
<_Arg
, _Result
>(__x
);
306 template <class _Arg1
, class _Arg2
, class _Result
>
307 class pointer_to_binary_function
:
308 public binary_function
<_Arg1
,_Arg2
,_Result
> {
310 _Result (*_M_ptr
)(_Arg1
, _Arg2
);
312 pointer_to_binary_function() {}
313 explicit pointer_to_binary_function(_Result (*__x
)(_Arg1
, _Arg2
))
315 _Result
operator()(_Arg1 __x
, _Arg2 __y
) const {
316 return _M_ptr(__x
, __y
);
320 template <class _Arg1
, class _Arg2
, class _Result
>
321 inline pointer_to_binary_function
<_Arg1
,_Arg2
,_Result
>
322 ptr_fun(_Result (*__x
)(_Arg1
, _Arg2
)) {
323 return pointer_to_binary_function
<_Arg1
,_Arg2
,_Result
>(__x
);
326 // identity is an extensions: it is not part of the standard.
328 struct _Identity
: public unary_function
<_Tp
,_Tp
> {
329 _Tp
& operator()(_Tp
& __x
) const { return __x
; }
330 const _Tp
& operator()(const _Tp
& __x
) const { return __x
; }
333 template <class _Tp
> struct identity
: public _Identity
<_Tp
> {};
335 // select1st and select2nd are extensions: they are not part of the standard.
336 template <class _Pair
>
337 struct _Select1st
: public unary_function
<_Pair
, typename
_Pair::first_type
> {
338 typename
_Pair::first_type
& operator()(_Pair
& __x
) const {
341 const typename
_Pair::first_type
& operator()(const _Pair
& __x
) const {
346 template <class _Pair
>
347 struct _Select2nd
: public unary_function
<_Pair
, typename
_Pair::second_type
>
349 typename
_Pair::second_type
& operator()(_Pair
& __x
) const {
352 const typename
_Pair::second_type
& operator()(const _Pair
& __x
) const {
357 template <class _Pair
> struct select1st
: public _Select1st
<_Pair
> {};
358 template <class _Pair
> struct select2nd
: public _Select2nd
<_Pair
> {};
360 // project1st and project2nd are extensions: they are not part of the standard
361 template <class _Arg1
, class _Arg2
>
362 struct _Project1st
: public binary_function
<_Arg1
, _Arg2
, _Arg1
> {
363 _Arg1
operator()(const _Arg1
& __x
, const _Arg2
&) const { return __x
; }
366 template <class _Arg1
, class _Arg2
>
367 struct _Project2nd
: public binary_function
<_Arg1
, _Arg2
, _Arg2
> {
368 _Arg2
operator()(const _Arg1
&, const _Arg2
& __y
) const { return __y
; }
371 template <class _Arg1
, class _Arg2
>
372 struct project1st
: public _Project1st
<_Arg1
, _Arg2
> {};
374 template <class _Arg1
, class _Arg2
>
375 struct project2nd
: public _Project2nd
<_Arg1
, _Arg2
> {};
377 // constant_void_fun, constant_unary_fun, and constant_binary_fun are
378 // extensions: they are not part of the standard. (The same, of course,
379 // is true of the helper functions constant0, constant1, and constant2.)
381 template <class _Result
>
382 struct _Constant_void_fun
{
383 typedef _Result result_type
;
386 _Constant_void_fun(const result_type
& __v
) : _M_val(__v
) {}
387 const result_type
& operator()() const { return _M_val
; }
390 template <class _Result
, class _Argument
>
391 struct _Constant_unary_fun
{
392 typedef _Argument argument_type
;
393 typedef _Result result_type
;
396 _Constant_unary_fun(const result_type
& __v
) : _M_val(__v
) {}
397 const result_type
& operator()(const _Argument
&) const { return _M_val
; }
400 template <class _Result
, class _Arg1
, class _Arg2
>
401 struct _Constant_binary_fun
{
402 typedef _Arg1 first_argument_type
;
403 typedef _Arg2 second_argument_type
;
404 typedef _Result result_type
;
407 _Constant_binary_fun(const _Result
& __v
) : _M_val(__v
) {}
408 const result_type
& operator()(const _Arg1
&, const _Arg2
&) const {
413 template <class _Result
>
414 struct constant_void_fun
: public _Constant_void_fun
<_Result
> {
415 constant_void_fun(const _Result
& __v
) : _Constant_void_fun
<_Result
>(__v
) {}
419 template <class _Result
,
420 class _Argument
= _Result
>
421 struct constant_unary_fun
: public _Constant_unary_fun
<_Result
, _Argument
>
423 constant_unary_fun(const _Result
& __v
)
424 : _Constant_unary_fun
<_Result
, _Argument
>(__v
) {}
428 template <class _Result
,
429 class _Arg1
= _Result
,
431 struct constant_binary_fun
432 : public _Constant_binary_fun
<_Result
, _Arg1
, _Arg2
>
434 constant_binary_fun(const _Result
& __v
)
435 : _Constant_binary_fun
<_Result
, _Arg1
, _Arg2
>(__v
) {}
438 template <class _Result
>
439 inline constant_void_fun
<_Result
> constant0(const _Result
& __val
)
441 return constant_void_fun
<_Result
>(__val
);
444 template <class _Result
>
445 inline constant_unary_fun
<_Result
,_Result
> constant1(const _Result
& __val
)
447 return constant_unary_fun
<_Result
,_Result
>(__val
);
450 template <class _Result
>
451 inline constant_binary_fun
<_Result
,_Result
,_Result
>
452 constant2(const _Result
& __val
)
454 return constant_binary_fun
<_Result
,_Result
,_Result
>(__val
);
457 // subtractive_rng is an extension: it is not part of the standard.
458 // Note: this code assumes that int is 32 bits.
459 class subtractive_rng
: public unary_function
<unsigned int, unsigned int> {
461 unsigned int _M_table
[55];
465 unsigned int operator()(unsigned int __limit
) {
466 _M_index1
= (_M_index1
+ 1) % 55;
467 _M_index2
= (_M_index2
+ 1) % 55;
468 _M_table
[_M_index1
] = _M_table
[_M_index1
] - _M_table
[_M_index2
];
469 return _M_table
[_M_index1
] % __limit
;
472 void _M_initialize(unsigned int __seed
)
474 unsigned int __k
= 1;
475 _M_table
[54] = __seed
;
477 for (__i
= 0; __i
< 54; __i
++) {
478 size_t __ii
= (21 * (__i
+ 1) % 55) - 1;
479 _M_table
[__ii
] = __k
;
481 __seed
= _M_table
[__ii
];
483 for (int __loop
= 0; __loop
< 4; __loop
++) {
484 for (__i
= 0; __i
< 55; __i
++)
485 _M_table
[__i
] = _M_table
[__i
] - _M_table
[(1 + __i
+ 30) % 55];
491 subtractive_rng(unsigned int __seed
) { _M_initialize(__seed
); }
492 subtractive_rng() { _M_initialize(161803398u); }
496 // Adaptor function objects: pointers to member functions.
498 // There are a total of 16 = 2^4 function objects in this family.
499 // (1) Member functions taking no arguments vs member functions taking
501 // (2) Call through pointer vs call through reference.
502 // (3) Member function with void return type vs member function with
503 // non-void return type.
504 // (4) Const vs non-const member function.
506 // Note that choice (3) is nothing more than a workaround: according
507 // to the draft, compilers should handle void and non-void the same way.
508 // This feature is not yet widely implemented, though. You can only use
509 // member functions returning void if your compiler supports partial
512 // All of this complexity is in the function objects themselves. You can
513 // ignore it by using the helper function mem_fun and mem_fun_ref,
514 // which create whichever type of adaptor is appropriate.
515 // (mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,
516 // but they are provided for backward compatibility.)
519 template <class _Ret
, class _Tp
>
520 class mem_fun_t
: public unary_function
<_Tp
*,_Ret
> {
522 explicit mem_fun_t(_Ret (_Tp::*__pf
)()) : _M_f(__pf
) {}
523 _Ret
operator()(_Tp
* __p
) const { return (__p
->*_M_f
)(); }
528 template <class _Ret
, class _Tp
>
529 class const_mem_fun_t
: public unary_function
<const _Tp
*,_Ret
> {
531 explicit const_mem_fun_t(_Ret (_Tp::*__pf
)() const) : _M_f(__pf
) {}
532 _Ret
operator()(const _Tp
* __p
) const { return (__p
->*_M_f
)(); }
534 _Ret (_Tp::*_M_f
)() const;
538 template <class _Ret
, class _Tp
>
539 class mem_fun_ref_t
: public unary_function
<_Tp
,_Ret
> {
541 explicit mem_fun_ref_t(_Ret (_Tp::*__pf
)()) : _M_f(__pf
) {}
542 _Ret
operator()(_Tp
& __r
) const { return (__r
.*_M_f
)(); }
547 template <class _Ret
, class _Tp
>
548 class const_mem_fun_ref_t
: public unary_function
<_Tp
,_Ret
> {
550 explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf
)() const) : _M_f(__pf
) {}
551 _Ret
operator()(const _Tp
& __r
) const { return (__r
.*_M_f
)(); }
553 _Ret (_Tp::*_M_f
)() const;
556 template <class _Ret
, class _Tp
, class _Arg
>
557 class mem_fun1_t
: public binary_function
<_Tp
*,_Arg
,_Ret
> {
559 explicit mem_fun1_t(_Ret (_Tp::*__pf
)(_Arg
)) : _M_f(__pf
) {}
560 _Ret
operator()(_Tp
* __p
, _Arg __x
) const { return (__p
->*_M_f
)(__x
); }
562 _Ret (_Tp::*_M_f
)(_Arg
);
565 template <class _Ret
, class _Tp
, class _Arg
>
566 class const_mem_fun1_t
: public binary_function
<const _Tp
*,_Arg
,_Ret
> {
568 explicit const_mem_fun1_t(_Ret (_Tp::*__pf
)(_Arg
) const) : _M_f(__pf
) {}
569 _Ret
operator()(const _Tp
* __p
, _Arg __x
) const
570 { return (__p
->*_M_f
)(__x
); }
572 _Ret (_Tp::*_M_f
)(_Arg
) const;
575 template <class _Ret
, class _Tp
, class _Arg
>
576 class mem_fun1_ref_t
: public binary_function
<_Tp
,_Arg
,_Ret
> {
578 explicit mem_fun1_ref_t(_Ret (_Tp::*__pf
)(_Arg
)) : _M_f(__pf
) {}
579 _Ret
operator()(_Tp
& __r
, _Arg __x
) const { return (__r
.*_M_f
)(__x
); }
581 _Ret (_Tp::*_M_f
)(_Arg
);
584 template <class _Ret
, class _Tp
, class _Arg
>
585 class const_mem_fun1_ref_t
: public binary_function
<_Tp
,_Arg
,_Ret
> {
587 explicit const_mem_fun1_ref_t(_Ret (_Tp::*__pf
)(_Arg
) const) : _M_f(__pf
) {}
588 _Ret
operator()(const _Tp
& __r
, _Arg __x
) const { return (__r
.*_M_f
)(__x
); }
590 _Ret (_Tp::*_M_f
)(_Arg
) const;
594 class mem_fun_t
<void, _Tp
> : public unary_function
<_Tp
*,void> {
596 explicit mem_fun_t(void (_Tp::*__pf
)()) : _M_f(__pf
) {}
597 void operator()(_Tp
* __p
) const { (__p
->*_M_f
)(); }
603 class const_mem_fun_t
<void, _Tp
> : public unary_function
<const _Tp
*,void> {
605 explicit const_mem_fun_t(void (_Tp::*__pf
)() const) : _M_f(__pf
) {}
606 void operator()(const _Tp
* __p
) const { (__p
->*_M_f
)(); }
608 void (_Tp::*_M_f
)() const;
612 class mem_fun_ref_t
<void, _Tp
> : public unary_function
<_Tp
,void> {
614 explicit mem_fun_ref_t(void (_Tp::*__pf
)()) : _M_f(__pf
) {}
615 void operator()(_Tp
& __r
) const { (__r
.*_M_f
)(); }
621 class const_mem_fun_ref_t
<void, _Tp
> : public unary_function
<_Tp
,void> {
623 explicit const_mem_fun_ref_t(void (_Tp::*__pf
)() const) : _M_f(__pf
) {}
624 void operator()(const _Tp
& __r
) const { (__r
.*_M_f
)(); }
626 void (_Tp::*_M_f
)() const;
629 template <class _Tp
, class _Arg
>
630 class mem_fun1_t
<void, _Tp
, _Arg
> : public binary_function
<_Tp
*,_Arg
,void> {
632 explicit mem_fun1_t(void (_Tp::*__pf
)(_Arg
)) : _M_f(__pf
) {}
633 void operator()(_Tp
* __p
, _Arg __x
) const { (__p
->*_M_f
)(__x
); }
635 void (_Tp::*_M_f
)(_Arg
);
638 template <class _Tp
, class _Arg
>
639 class const_mem_fun1_t
<void, _Tp
, _Arg
>
640 : public binary_function
<const _Tp
*,_Arg
,void> {
642 explicit const_mem_fun1_t(void (_Tp::*__pf
)(_Arg
) const) : _M_f(__pf
) {}
643 void operator()(const _Tp
* __p
, _Arg __x
) const { (__p
->*_M_f
)(__x
); }
645 void (_Tp::*_M_f
)(_Arg
) const;
648 template <class _Tp
, class _Arg
>
649 class mem_fun1_ref_t
<void, _Tp
, _Arg
>
650 : public binary_function
<_Tp
,_Arg
,void> {
652 explicit mem_fun1_ref_t(void (_Tp::*__pf
)(_Arg
)) : _M_f(__pf
) {}
653 void operator()(_Tp
& __r
, _Arg __x
) const { (__r
.*_M_f
)(__x
); }
655 void (_Tp::*_M_f
)(_Arg
);
658 template <class _Tp
, class _Arg
>
659 class const_mem_fun1_ref_t
<void, _Tp
, _Arg
>
660 : public binary_function
<_Tp
,_Arg
,void> {
662 explicit const_mem_fun1_ref_t(void (_Tp::*__pf
)(_Arg
) const) : _M_f(__pf
) {}
663 void operator()(const _Tp
& __r
, _Arg __x
) const { (__r
.*_M_f
)(__x
); }
665 void (_Tp::*_M_f
)(_Arg
) const;
669 // Mem_fun adaptor helper functions. There are only two:
670 // mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref
671 // are provided for backward compatibility, but they are no longer
672 // part of the C++ standard.)
674 template <class _Ret
, class _Tp
>
675 inline mem_fun_t
<_Ret
,_Tp
> mem_fun(_Ret (_Tp::*__f
)())
676 { return mem_fun_t
<_Ret
,_Tp
>(__f
); }
678 template <class _Ret
, class _Tp
>
679 inline const_mem_fun_t
<_Ret
,_Tp
> mem_fun(_Ret (_Tp::*__f
)() const)
680 { return const_mem_fun_t
<_Ret
,_Tp
>(__f
); }
682 template <class _Ret
, class _Tp
>
683 inline mem_fun_ref_t
<_Ret
,_Tp
> mem_fun_ref(_Ret (_Tp::*__f
)())
684 { return mem_fun_ref_t
<_Ret
,_Tp
>(__f
); }
686 template <class _Ret
, class _Tp
>
687 inline const_mem_fun_ref_t
<_Ret
,_Tp
> mem_fun_ref(_Ret (_Tp::*__f
)() const)
688 { return const_mem_fun_ref_t
<_Ret
,_Tp
>(__f
); }
690 template <class _Ret
, class _Tp
, class _Arg
>
691 inline mem_fun1_t
<_Ret
,_Tp
,_Arg
> mem_fun(_Ret (_Tp::*__f
)(_Arg
))
692 { return mem_fun1_t
<_Ret
,_Tp
,_Arg
>(__f
); }
694 template <class _Ret
, class _Tp
, class _Arg
>
695 inline const_mem_fun1_t
<_Ret
,_Tp
,_Arg
> mem_fun(_Ret (_Tp::*__f
)(_Arg
) const)
696 { return const_mem_fun1_t
<_Ret
,_Tp
,_Arg
>(__f
); }
698 template <class _Ret
, class _Tp
, class _Arg
>
699 inline mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
> mem_fun_ref(_Ret (_Tp::*__f
)(_Arg
))
700 { return mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
>(__f
); }
702 template <class _Ret
, class _Tp
, class _Arg
>
703 inline const_mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
>
704 mem_fun_ref(_Ret (_Tp::*__f
)(_Arg
) const)
705 { return const_mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
>(__f
); }
707 template <class _Ret
, class _Tp
, class _Arg
>
708 inline mem_fun1_t
<_Ret
,_Tp
,_Arg
> mem_fun1(_Ret (_Tp::*__f
)(_Arg
))
709 { return mem_fun1_t
<_Ret
,_Tp
,_Arg
>(__f
); }
711 template <class _Ret
, class _Tp
, class _Arg
>
712 inline const_mem_fun1_t
<_Ret
,_Tp
,_Arg
> mem_fun1(_Ret (_Tp::*__f
)(_Arg
) const)
713 { return const_mem_fun1_t
<_Ret
,_Tp
,_Arg
>(__f
); }
715 template <class _Ret
, class _Tp
, class _Arg
>
716 inline mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
> mem_fun1_ref(_Ret (_Tp::*__f
)(_Arg
))
717 { return mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
>(__f
); }
719 template <class _Ret
, class _Tp
, class _Arg
>
720 inline const_mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
>
721 mem_fun1_ref(_Ret (_Tp::*__f
)(_Arg
) const)
722 { return const_mem_fun1_ref_t
<_Ret
,_Tp
,_Arg
>(__f
); }
726 #endif /* __SGI_STL_INTERNAL_FUNCTION_H */