an efficient C++ finite element environment
|
|
Go to the documentation of this file. 1 #ifndef _RHEOLEF_EXPR_UTILITIES_H
2 #define _RHEOLEF_EXPR_UTILITIES_H
31 namespace rheolef {
namespace details {
37 #define _RHEOLEF_generic_unary_syntax_functor(OP,NAME) \
38 template <typename T = void> \
41 template <typename T> \
42 struct 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) \
56 template <typename T = void> \
59 template<typename T> \
60 struct 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
82 template<
class BinaryFunction,
class A1>
87 auto operator() (A2&& x2)
const
89 noexcept (noexcept (
BinaryFunction() (A1(), std::forward<A2>(x2))))
91 {
return _f (
_x1, std::forward<A2>(x2)); }
97 template<
class BinaryFunction,
class A2>
104 noexcept (noexcept (
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>
135 template<
class ForwardIterator,
class InputIterator,
class OpAssign>
137 assign_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);
158 #endif // _RHEOLEF_EXPR_UTILITIES_H
rheolef::std BinaryFunction
void assign_with_operator(ForwardIterator first, ForwardIterator last, InputIterator iter_rhs, OpAssign op_assign)
iterator_on_constant< T > & operator++()
void operator()(T &t, const U &u) const
void operator()(T &t, const U &u) const
iterator_on_constant(const T &c)
void operator()(T &t, const U &u) const
void operator()(T &t, const U &u) const
generic_negate _RHEOLEF_generic_binary_syntax_functor(+, generic_plus) _RHEOLEF_generic_binary_syntax_functor(-
auto operator()(A1 &&x1) const noexcept(noexcept(BinaryFunction()(std::forward< A1 >(x1), A2()))) -> decltype(BinaryFunction()(std::forward< A1 >(x1), A2()))
This file is part of Rheolef.
void operator()(T &t, const U &u) const
generic_binder2nd(const BinaryFunction &f, const A2 &x2)
value_type operator*() const
_RHEOLEF_generic_unary_syntax_functor(+, generic_unary_plus) _RHEOLEF_generic_unary_syntax_functor(-