1#ifndef _RHEOLEF_EXPR_UTILITIES_H
2#define _RHEOLEF_EXPR_UTILITIES_H
31namespace rheolef {
namespace details {
37#define _RHEOLEF_generic_unary_syntax_functor(OP,NAME) \
38template <typename T = void> \
41template <typename T> \
42struct NAME: public std::unary_function<T, T> { \
43 T operator() (const T& x) const { return OP x; } \
48 template <typename T> \
49 auto operator() (T&& x) const \
50 noexcept (noexcept (OP std::forward<T>(x))) \
51 -> decltype(OP std::forward<T>(x)) \
52 { return OP std::forward<T>(x); } \
55#define _RHEOLEF_generic_binary_syntax_functor(OP,NAME) \
56template <typename T = void> \
60struct NAME: public std::binary_function<T, T, T> { \
61 T operator() (const T& x, const T& y) const { return x OP y; } \
66 template <typename T, typename U> \
67 auto operator() (T&& t, U&& y) const \
68 noexcept (noexcept (std::forward<T>(t) OP std::forward<U>(y))) \
69 -> decltype(std::forward<T>(t) OP std::forward<U>(y)) \
70 { return std::forward<T>(t) OP std::forward<U>(y); } \
79#undef _RHEOLEF_generic_unary_syntax_functor
80#undef _RHEOLEF_generic_binary_syntax_functor
82template<
class BinaryFunction,
class A1>
87 auto operator() (A2&& x2)
const
89 noexcept (
noexcept (BinaryFunction() (A1(), std::forward<A2>(x2))))
90 ->
decltype(BinaryFunction() (A1(), std::forward<A2>(x2)))
91 {
return _f (
_x1, std::forward<A2>(x2)); }
97template<
class BinaryFunction,
class A2>
104 noexcept (
noexcept (BinaryFunction() (std::forward<A1>(x1), A2())))
105 ->
decltype(BinaryFunction() (std::forward<A1>(x1), A2()))
106 {
return _f (std::forward<A1>(x1),
_x2); }
116 template<
class T,
class U>
120 template<
class T,
class U>
124 template<
class T,
class U>
128 template<
class T,
class U>
132 template<
class T,
class U>
135template<
class ForwardIterator,
class InputIterator,
class OpAssign>
137assign_with_operator (ForwardIterator first, ForwardIterator last, InputIterator iter_rhs, OpAssign op_assign) {
138 for (; first != last; ++first, ++iter_rhs) {
139 op_assign (*first, *iter_rhs);
#define _RHEOLEF_generic_binary_syntax_functor(OP, NAME)
#define _RHEOLEF_generic_unary_syntax_functor(OP, NAME)
void assign_with_operator(ForwardIterator first, ForwardIterator last, InputIterator iter_rhs, OpAssign op_assign)
This file is part of Rheolef.
void operator()(T &t, const U &u) const
void operator()(T &t, const U &u) const
generic_binder2nd(const BinaryFunction &f, const A2 &x2)
auto operator()(A1 &&x1) const noexcept(noexcept(BinaryFunction()(std::forward< A1 >(x1), A2()))) -> decltype(BinaryFunction()(std::forward< A1 >(x1), A2()))
value_type operator*() const
iterator_on_constant< T > & operator++()
iterator_on_constant(const T &c)
void operator()(T &t, const U &u) const
void operator()(T &t, const U &u) const
void operator()(T &t, const U &u) const