56#ifndef _EXT_FUNCTIONAL
57#define _EXT_FUNCTIONAL 1
59#pragma GCC system_header
63namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
65_GLIBCXX_BEGIN_NAMESPACE_VERSION
67#pragma GCC diagnostic push
68#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
119 template <
class _Operation1,
class _Operation2>
122 typename _Operation1::result_type>
129 unary_compose(
const _Operation1& __x,
const _Operation2& __y)
130 : _M_fn1(__x), _M_fn2(__y) {}
132 typename _Operation1::result_type
133 operator()(
const typename _Operation2::argument_type& __x)
const
134 {
return _M_fn1(_M_fn2(__x)); }
138 template <
class _Operation1,
class _Operation2>
140 compose1(
const _Operation1& __fn1,
const _Operation2& __fn2)
144 template <
class _Operation1,
class _Operation2,
class _Operation3>
147 typename _Operation1::result_type>
155 binary_compose(
const _Operation1& __x,
const _Operation2& __y,
156 const _Operation3& __z)
157 : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
159 typename _Operation1::result_type
160 operator()(
const typename _Operation2::argument_type& __x)
const
161 {
return _M_fn1(_M_fn2(__x), _M_fn3(__x)); }
165 template <
class _Operation1,
class _Operation2,
class _Operation3>
167 compose2(
const _Operation1& __fn1,
const _Operation2& __fn2,
168 const _Operation3& __fn3)
170 (__fn1, __fn2, __fn3); }
181 :
public std::_Identity<_Tp> {};
194 template <
class _Pair>
196 :
public std::_Select1st<_Pair> {};
199 template <
class _Pair>
201 :
public std::_Select2nd<_Pair> {};
206 template <
class _Arg1,
class _Arg2>
210 operator()(
const _Arg1& __x,
const _Arg2&)
const
214 template <
class _Arg1,
class _Arg2>
215 struct _Project2nd :
public std::binary_function<_Arg1, _Arg2, _Arg2>
218 operator()(
const _Arg1&,
const _Arg2& __y)
const
231 template <
class _Arg1,
class _Arg2>
235 template <
class _Arg1,
class _Arg2>
240 template <
class _Result>
241 struct _Constant_void_fun
243 typedef _Result result_type;
246 _Constant_void_fun(
const result_type& __v) : _M_val(__v) {}
253 template <
class _Result,
class _Argument>
254 struct _Constant_unary_fun
256 typedef _Argument argument_type;
257 typedef _Result result_type;
260 _Constant_unary_fun(
const result_type& __v) : _M_val(__v) {}
263 operator()(
const _Argument&)
const
267 template <
class _Result,
class _Arg1,
class _Arg2>
268 struct _Constant_binary_fun
270 typedef _Arg1 first_argument_type;
271 typedef _Arg2 second_argument_type;
272 typedef _Result result_type;
275 _Constant_binary_fun(
const _Result& __v) : _M_val(__v) {}
278 operator()(
const _Arg1&,
const _Arg2&)
const
297 template <
class _Result>
298 struct constant_void_fun
299 :
public _Constant_void_fun<_Result>
301 constant_void_fun(
const _Result& __v)
302 : _Constant_void_fun<_Result>(__v) {}
306 template <
class _Result,
class _Argument = _Result>
307 struct constant_unary_fun :
public _Constant_unary_fun<_Result, _Argument>
309 constant_unary_fun(
const _Result& __v)
310 : _Constant_unary_fun<_Result, _Argument>(__v) {}
314 template <
class _Result,
class _Arg1 = _Result,
class _Arg2 = _Arg1>
315 struct constant_binary_fun
316 :
public _Constant_binary_fun<_Result, _Arg1, _Arg2>
318 constant_binary_fun(
const _Result& __v)
319 : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
323 template <
class _Result>
329 template <
class _Result>
330 inline constant_unary_fun<_Result, _Result>
335 template <
class _Result>
336 inline constant_binary_fun<_Result,_Result,_Result>
351 unsigned int _M_table[55];
352 std::size_t _M_index1;
353 std::size_t _M_index2;
360 _M_index1 = (_M_index1 + 1) % 55;
361 _M_index2 = (_M_index2 + 1) % 55;
362 _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
363 return _M_table[_M_index1] % __limit;
367 _M_initialize(
unsigned int __seed)
369 unsigned int __k = 1;
370 _M_table[54] = __seed;
372 for (__i = 0; __i < 54; __i++)
374 std::size_t __ii = (21 * (__i + 1) % 55) - 1;
375 _M_table[__ii] = __k;
377 __seed = _M_table[__ii];
379 for (
int __loop = 0; __loop < 4; __loop++)
381 for (__i = 0; __i < 55; __i++)
382 _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
390 { _M_initialize(__seed); }
394 { _M_initialize(161803398u); }
401 template <
class _Ret,
class _Tp,
class _Arg>
403 mem_fun1(_Ret (_Tp::*__f)(_Arg))
406 template <
class _Ret,
class _Tp,
class _Arg>
407 inline std::const_mem_fun1_t<_Ret, _Tp, _Arg>
408 mem_fun1(_Ret (_Tp::*__f)(_Arg)
const)
409 {
return std::const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
411 template <
class _Ret,
class _Tp,
class _Arg>
412 inline std::mem_fun1_ref_t<_Ret, _Tp, _Arg>
413 mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))
414 {
return std::mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
416 template <
class _Ret,
class _Tp,
class _Arg>
417 inline std::const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
418 mem_fun1_ref(_Ret (_Tp::*__f)(_Arg)
const)
419 {
return std::const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
421#pragma GCC diagnostic pop
423_GLIBCXX_END_NAMESPACE_VERSION
constant_binary_fun< _Result, _Result, _Result > constant2(const _Result &__val)
An SGI extension .
unary_compose< _Operation1, _Operation2 > compose1(const _Operation1 &__fn1, const _Operation2 &__fn2)
An SGI extension .
binary_compose< _Operation1, _Operation2, _Operation3 > compose2(const _Operation1 &__fn1, const _Operation2 &__fn2, const _Operation3 &__fn3)
An SGI extension .
constant_unary_fun< _Result, _Result > constant1(const _Result &__val)
An SGI extension .
constant_void_fun< _Result > constant0(const _Result &__val)
An SGI extension .
GNU extensions for public use.
One of the math functors.
One of the math functors.
One of the adaptors for member pointers.
unsigned int operator()(unsigned int __limit)
Returns a number less than the argument.
subtractive_rng(unsigned int __seed)
Ctor allowing you to initialize the seed.
subtractive_rng()
Default ctor; initializes its state with some number you don't see.