56 #ifndef _EXT_FUNCTIONAL 57 #define _EXT_FUNCTIONAL 1 59 #ifdef _GLIBCXX_SYSHDR 60 #pragma GCC system_header 67 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
69 _GLIBCXX_BEGIN_NAMESPACE_VERSION
71 #pragma GCC diagnostic push 72 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 123 template <
class _Operation1,
class _Operation2>
126 typename _Operation1::result_type>
133 unary_compose(
const _Operation1& __x,
const _Operation2& __y)
134 : _M_fn1(__x), _M_fn2(__y) {}
136 typename _Operation1::result_type
137 operator()(
const typename _Operation2::argument_type& __x)
const 138 {
return _M_fn1(_M_fn2(__x)); }
142 template <
class _Operation1,
class _Operation2>
144 compose1(
const _Operation1& __fn1,
const _Operation2& __fn2)
148 template <
class _Operation1,
class _Operation2,
class _Operation3>
151 typename _Operation1::result_type>
160 const _Operation3& __z)
161 : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
163 typename _Operation1::result_type
164 operator()(
const typename _Operation2::argument_type& __x)
const 165 {
return _M_fn1(_M_fn2(__x), _M_fn3(__x)); }
169 template <
class _Operation1,
class _Operation2,
class _Operation3>
171 compose2(
const _Operation1& __fn1,
const _Operation2& __fn2,
172 const _Operation3& __fn3)
174 (__fn1, __fn2, __fn3); }
185 :
public std::_Identity<_Tp> {};
198 template <
class _Pair>
200 :
public std::_Select1st<_Pair> {};
203 template <
class _Pair>
205 :
public std::_Select2nd<_Pair> {};
210 template <
class _Arg1,
class _Arg2>
214 operator()(
const _Arg1& __x,
const _Arg2&)
const 218 template <
class _Arg1,
class _Arg2>
222 operator()(
const _Arg1&,
const _Arg2& __y)
const 235 template <
class _Arg1,
class _Arg2>
239 template <
class _Arg1,
class _Arg2>
244 template <
class _Result>
245 struct _Constant_void_fun
250 _Constant_void_fun(
const result_type& __v) : _M_val(__v) {}
257 template <
class _Result,
class _Argument>
258 struct _Constant_unary_fun
264 _Constant_unary_fun(
const result_type& __v) : _M_val(__v) {}
267 operator()(
const _Argument&)
const 271 template <
class _Result,
class _Arg1,
class _Arg2>
272 struct _Constant_binary_fun
279 _Constant_binary_fun(
const _Result& __v) : _M_val(__v) {}
282 operator()(
const _Arg1&,
const _Arg2&)
const 301 template <
class _Result>
303 :
public _Constant_void_fun<_Result>
306 : _Constant_void_fun<_Result>(__v) {}
310 template <
class _Result,
class _Argument = _Result>
314 : _Constant_unary_fun<_Result, _Argument>(__v) {}
318 template <
class _Result,
class _Arg1 = _Result,
class _Arg2 = _Arg1>
320 :
public _Constant_binary_fun<_Result, _Arg1, _Arg2>
323 : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
327 template <
class _Result>
333 template <
class _Result>
339 template <
class _Result>
355 unsigned int _M_table[55];
356 std::size_t _M_index1;
357 std::size_t _M_index2;
364 _M_index1 = (_M_index1 + 1) % 55;
365 _M_index2 = (_M_index2 + 1) % 55;
366 _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
367 return _M_table[_M_index1] % __limit;
371 _M_initialize(
unsigned int __seed)
373 unsigned int __k = 1;
374 _M_table[54] = __seed;
376 for (__i = 0; __i < 54; __i++)
378 std::size_t __ii = (21 * (__i + 1) % 55) - 1;
379 _M_table[__ii] = __k;
381 __seed = _M_table[__ii];
383 for (
int __loop = 0; __loop < 4; __loop++)
385 for (__i = 0; __i < 55; __i++)
386 _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
394 { _M_initialize(__seed); }
398 { _M_initialize(161803398u); }
405 template <
class _Ret,
class _Tp,
class _Arg>
407 mem_fun1(_Ret (_Tp::*__f)(_Arg))
410 template <
class _Ret,
class _Tp,
class _Arg>
412 mem_fun1(_Ret (_Tp::*__f)(_Arg)
const)
415 template <
class _Ret,
class _Tp,
class _Arg>
417 mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))
420 template <
class _Ret,
class _Tp,
class _Arg>
422 mem_fun1_ref(_Ret (_Tp::*__f)(_Arg)
const)
425 #pragma GCC diagnostic pop 427 _GLIBCXX_END_NAMESPACE_VERSION
unsigned int operator()(unsigned int __limit)
Returns a number less than the argument.
constant_unary_fun< _Result, _Result > constant1(const _Result &__val)
An SGI extension .
subtractive_rng(unsigned int __seed)
Ctor allowing you to initialize the seed.
constant_void_fun< _Result > constant0(const _Result &__val)
An SGI extension .
_Operation1::result_type result_type
result_type is the return type
One of the adaptors for member pointers.
_Arg2 second_argument_type
second_argument_type is the type of the second argument
subtractive_rng()
Default ctor; initializes its state with some number you don't see.
GNU extensions for public use.
One of the adaptors for member pointers.
unary_compose< _Operation1, _Operation2 > compose1(const _Operation1 &__fn1, const _Operation2 &__fn2)
An SGI extension .
One of the math functors.
One of the adaptors for member pointers.
One of the math functors.
One of the adaptors for member pointers.
binary_compose< _Operation1, _Operation2, _Operation3 > compose2(const _Operation1 &__fn1, const _Operation2 &__fn2, const _Operation3 &__fn3)
An SGI extension .
_Operation2::argument_type argument_type
argument_type is the type of the argument
constant_binary_fun< _Result, _Result, _Result > constant2(const _Result &__val)
An SGI extension .
_Arg1 first_argument_type
first_argument_type is the type of the first argument