functional_sgi_ext.h
Go to the documentation of this file.
#ifndef _RHEOLEF_FUNCTIONAL_SGI_EXT_H
#define _RHEOLEF_FUNCTIONAL_SGI_EXT_H
namespace rheolef {
template <class _Operation1, class _Operation2>
class unary_compose
: public std::unary_function<typename _Operation2::argument_type,
typename _Operation1::result_type>
{
protected:
_Operation1 _M_fn1;
_Operation2 _M_fn2;
public:
unary_compose(const _Operation1& __x, const _Operation2& __y)
: _M_fn1(__x), _M_fn2(__y) {}
typename _Operation1::result_type
operator()(const typename _Operation2::argument_type& __x) const
{ return _M_fn1(_M_fn2(__x)); }
};
template <class _Operation1, class _Operation2>
inline unary_compose<_Operation1, _Operation2>
compose1(const _Operation1& __fn1, const _Operation2& __fn2)
{ return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); }
template <class _Operation1, class _Operation2, class _Operation3>
class binary_compose
: public std::unary_function<typename _Operation2::argument_type,
typename _Operation1::result_type>
{
protected:
_Operation1 _M_fn1;
_Operation2 _M_fn2;
_Operation3 _M_fn3;
public:
binary_compose(const _Operation1& __x, const _Operation2& __y,
const _Operation3& __z)
: _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
typename _Operation1::result_type
operator()(const typename _Operation2::argument_type& __x) const
{ return _M_fn1(_M_fn2(__x), _M_fn3(__x)); }
};
template <class _Operation1, class _Operation2, class _Operation3>
inline binary_compose<_Operation1, _Operation2, _Operation3>
compose2(const _Operation1& __fn1, const _Operation2& __fn2,
const _Operation3& __fn3)
{ return binary_compose<_Operation1, _Operation2, _Operation3>
(__fn1, __fn2, __fn3); }
} // namespace rheolef
#endif // _RHEOLEF_FUNCTIONAL_SGI_EXT_H
rheolef::binary_compose
Definition: functional_sgi_ext.h:51
rheolef::binary_compose::_M_fn2
_Operation2 _M_fn2
Definition: functional_sgi_ext.h:54
rheolef::binary_compose::operator()
_Operation1::result_type operator()(const typename _Operation2::argument_type &__x) const
Definition: functional_sgi_ext.h:63
rheolef::binary_compose::_M_fn3
_Operation3 _M_fn3
Definition: functional_sgi_ext.h:55
rheolef::binary_compose::binary_compose
binary_compose(const _Operation1 &__x, const _Operation2 &__y, const _Operation3 &__z)
Definition: functional_sgi_ext.h:58
rheolef::binary_compose::_M_fn1
_Operation1 _M_fn1
Definition: functional_sgi_ext.h:53
rheolef::unary_compose
Definition: functional_sgi_ext.h:28
rheolef::unary_compose::_M_fn2
_Operation2 _M_fn2
Definition: functional_sgi_ext.h:31
rheolef::unary_compose::operator()
_Operation1::result_type operator()(const typename _Operation2::argument_type &__x) const
Definition: functional_sgi_ext.h:38
rheolef::unary_compose::unary_compose
unary_compose(const _Operation1 &__x, const _Operation2 &__y)
Definition: functional_sgi_ext.h:34
rheolef::unary_compose::_M_fn1
_Operation1 _M_fn1
Definition: functional_sgi_ext.h:30
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::compose2
binary_compose< _Operation1, _Operation2, _Operation3 > compose2(const _Operation1 &__fn1, const _Operation2 &__fn2, const _Operation3 &__fn3)
Definition: functional_sgi_ext.h:69
rheolef::compose1
unary_compose< _Operation1, _Operation2 > compose1(const _Operation1 &__fn1, const _Operation2 &__fn2)
Definition: functional_sgi_ext.h:44