57 #ifndef _EXT_FUNCTIONAL
58 #define _EXT_FUNCTIONAL 1
60 #pragma GCC system_header
64 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
66 _GLIBCXX_BEGIN_NAMESPACE_VERSION
125 template <
class _Operation1,
class _Operation2>
128 typename _Operation1::result_type>
135 unary_compose(
const _Operation1& __x,
const _Operation2& __y)
136 : _M_fn1(__x), _M_fn2(__y) {}
138 typename _Operation1::result_type
139 operator()(
const typename _Operation2::argument_type& __x)
const
140 {
return _M_fn1(_M_fn2(__x)); }
144 template <
class _Operation1,
class _Operation2>
146 compose1(
const _Operation1& __fn1,
const _Operation2& __fn2)
150 template <
class _Operation1,
class _Operation2,
class _Operation3>
153 typename _Operation1::result_type>
162 const _Operation3& __z)
163 : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
165 typename _Operation1::result_type
166 operator()(
const typename _Operation2::argument_type& __x)
const
167 {
return _M_fn1(_M_fn2(__x), _M_fn3(__x)); }
171 template <
class _Operation1,
class _Operation2,
class _Operation3>
173 compose2(
const _Operation1& __fn1,
const _Operation2& __fn2,
174 const _Operation3& __fn3)
176 (__fn1, __fn2, __fn3); }
186 struct identity :
public std::_Identity<_Tp> {};
199 template <
class _Pair>
203 template <
class _Pair>
208 template <
class _Arg1,
class _Arg2>
212 operator()(
const _Arg1& __x,
const _Arg2&)
const
216 template <
class _Arg1,
class _Arg2>
217 struct _Project2nd :
public binary_function<_Arg1, _Arg2, _Arg2>
220 operator()(
const _Arg1&,
const _Arg2& __y)
const
233 template <
class _Arg1,
class _Arg2>
237 template <
class _Arg1,
class _Arg2>
242 template <
class _Result>
243 struct _Constant_void_fun
245 typedef _Result result_type;
248 _Constant_void_fun(
const result_type& __v) : _M_val(__v) {}
255 template <
class _Result,
class _Argument>
256 struct _Constant_unary_fun
258 typedef _Argument argument_type;
259 typedef _Result result_type;
262 _Constant_unary_fun(
const result_type& __v) : _M_val(__v) {}
265 operator()(
const _Argument&)
const
269 template <
class _Result,
class _Arg1,
class _Arg2>
270 struct _Constant_binary_fun
272 typedef _Arg1 first_argument_type;
273 typedef _Arg2 second_argument_type;
274 typedef _Result result_type;
277 _Constant_binary_fun(
const _Result& __v) : _M_val(__v) {}
280 operator()(
const _Arg1&,
const _Arg2&)
const
299 template <
class _Result>
301 :
public _Constant_void_fun<_Result>
304 : _Constant_void_fun<_Result>(__v) {}
308 template <
class _Result,
class _Argument = _Result>
312 : _Constant_unary_fun<_Result, _Argument>(__v) {}
316 template <
class _Result,
class _Arg1 = _Result,
class _Arg2 = _Arg1>
318 :
public _Constant_binary_fun<_Result, _Arg1, _Arg2>
321 : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
325 template <
class _Result>
331 template <
class _Result>
332 inline constant_unary_fun<_Result, _Result>
337 template <
class _Result>
338 inline constant_binary_fun<_Result,_Result,_Result>
353 unsigned int _M_table[55];
362 _M_index1 = (_M_index1 + 1) % 55;
363 _M_index2 = (_M_index2 + 1) % 55;
364 _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
365 return _M_table[_M_index1] % __limit;
369 _M_initialize(
unsigned int __seed)
371 unsigned int __k = 1;
372 _M_table[54] = __seed;
374 for (__i = 0; __i < 54; __i++)
376 size_t __ii = (21 * (__i + 1) % 55) - 1;
377 _M_table[__ii] = __k;
379 __seed = _M_table[__ii];
381 for (
int __loop = 0; __loop < 4; __loop++)
383 for (__i = 0; __i < 55; __i++)
384 _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
392 { _M_initialize(__seed); }
396 { _M_initialize(161803398u); }
403 template <
class _Ret,
class _Tp,
class _Arg>
404 inline mem_fun1_t<_Ret, _Tp, _Arg>
405 mem_fun1(_Ret (_Tp::*__f)(_Arg))
406 {
return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
408 template <
class _Ret,
class _Tp,
class _Arg>
409 inline const_mem_fun1_t<_Ret, _Tp, _Arg>
410 mem_fun1(_Ret (_Tp::*__f)(_Arg)
const)
411 {
return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
413 template <
class _Ret,
class _Tp,
class _Arg>
414 inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
415 mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))
416 {
return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
418 template <
class _Ret,
class _Tp,
class _Arg>
419 inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
420 mem_fun1_ref(_Ret (_Tp::*__f)(_Arg)
const)
421 {
return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
423 _GLIBCXX_END_NAMESPACE_VERSION