Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
functional_sgi_ext.h
Go to the documentation of this file.
1#ifndef _RHEOLEF_FUNCTIONAL_SGI_EXT_H
2#define _RHEOLEF_FUNCTIONAL_SGI_EXT_H
23namespace rheolef {
24 template <class _Operation1, class _Operation2>
26 : public std::unary_function<typename _Operation2::argument_type,
27 typename _Operation1::result_type>
28 {
29 protected:
30 _Operation1 _M_fn1;
31 _Operation2 _M_fn2;
32
33 public:
34 unary_compose(const _Operation1& __x, const _Operation2& __y)
35 : _M_fn1(__x), _M_fn2(__y) {}
36
37 typename _Operation1::result_type
38 operator()(const typename _Operation2::argument_type& __x) const
39 { return _M_fn1(_M_fn2(__x)); }
40 };
41
42 template <class _Operation1, class _Operation2>
43 inline unary_compose<_Operation1, _Operation2>
44 compose1(const _Operation1& __fn1, const _Operation2& __fn2)
45 { return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); }
46
47 template <class _Operation1, class _Operation2, class _Operation3>
49 : public std::unary_function<typename _Operation2::argument_type,
50 typename _Operation1::result_type>
51 {
52 protected:
53 _Operation1 _M_fn1;
54 _Operation2 _M_fn2;
55 _Operation3 _M_fn3;
56
57 public:
58 binary_compose(const _Operation1& __x, const _Operation2& __y,
59 const _Operation3& __z)
60 : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
61
62 typename _Operation1::result_type
63 operator()(const typename _Operation2::argument_type& __x) const
64 { return _M_fn1(_M_fn2(__x), _M_fn3(__x)); }
65 };
66
67 template <class _Operation1, class _Operation2, class _Operation3>
68 inline binary_compose<_Operation1, _Operation2, _Operation3>
69 compose2(const _Operation1& __fn1, const _Operation2& __fn2,
70 const _Operation3& __fn3)
72 (__fn1, __fn2, __fn3); }
73
74} // namespace rheolef
75#endif // _RHEOLEF_FUNCTIONAL_SGI_EXT_H
_Operation1::result_type operator()(const typename _Operation2::argument_type &__x) const
binary_compose(const _Operation1 &__x, const _Operation2 &__y, const _Operation3 &__z)
_Operation1::result_type operator()(const typename _Operation2::argument_type &__x) const
unary_compose(const _Operation1 &__x, const _Operation2 &__y)
This file is part of Rheolef.
unary_compose< _Operation1, _Operation2 > compose1(const _Operation1 &__fn1, const _Operation2 &__fn2)
binary_compose< _Operation1, _Operation2, _Operation3 > compose2(const _Operation1 &__fn1, const _Operation2 &__fn2, const _Operation3 &__fn3)