1 #ifndef TIL_TEXPR_CONCATENATION_H 2 #define TIL_TEXPR_CONCATENATION_H 8 #include "boost/type_traits.hpp" 60 template <
typename Expr,
typename UnaryFunctor >
65 typename UnaryFunctor::template TypeStruct<
68 typename Expr::template TypeStruct<Iterator1 TIL_COMMA Iterator2 TIL_COMMA Iterator3>::Type
78 EXPRFUNC_3ARG(
operator(),
return m_functor(m_e(i1, i2, i3)); );
83 UnaryFunctor m_functor;
88 template <
typename TExpr1,
typename TExpr2,
typename BinaryOperator >
94 typename BinaryOperator::template TypeStruct<
98 typename TExpr1::template TypeStruct<Iterator1 TIL_COMMA Iterator2 TIL_COMMA Iterator3>::Type
104 typename TExpr2::template TypeStruct<Iterator1 TIL_COMMA Iterator2 TIL_COMMA Iterator3>::Type
111 : m_e1(e1), m_e2(e2), m_functor(functor) {}
116 EXPRFUNC_1ARG(
operator(),
return m_functor(m_e1(i1), m_e2(i1)););
117 EXPRFUNC_2ARG(
operator(),
return m_functor(m_e1(i1, i2), m_e2(i1, i2)););
118 EXPRFUNC_3ARG(
operator(),
return m_functor(m_e1(i1, i2, i3), m_e2(i1, i2, i3)););
124 BinaryOperator m_functor;
128 template <
typename TExpr1,
typename TExpr2,
typename BinaryOperator >
134 typename BinaryOperator::template TypeStruct<
138 typename TExpr1::template TypeStruct<Iterator1 TIL_COMMA Iterator2 TIL_COMMA Iterator3>::Type
144 typename TExpr2::template TypeStruct<Iterator1 TIL_COMMA Iterator2 TIL_COMMA Iterator3>::Type
151 : m_e1(e1), m_e2(e2), m_functor(functor) {}
157 EXPRFUNC_2ARG(
operator(), m_functor(m_e1(i1, i2), m_e2(i1, i2)););
158 EXPRFUNC_3ARG(
operator(), m_functor(m_e1(i1, i2, i3), m_e2(i1, i2, i3)););
164 BinaryOperator m_functor;
201 template <
typename TExprIf,
typename TExprThen >
211 : m_eIf(eIf), m_eThen(eThen) {};
216 EXPRFUNC_2ARG(
operator(),
if (m_eIf(i1, i2)) m_eThen(i1, i2););
217 EXPRFUNC_3ARG(
operator(),
if (m_eIf(i1, i2, i3)) m_eThen(i1, i2, i3););
228 template <
typename TExprIf,
typename TExprThen,
typename TExprElse >
233 EXPR_RESULT_TYPE(
typename TExprThen::template TypeStruct<Iterator1 TIL_COMMA Iterator2 TIL_COMMA Iterator3>::Type );
238 : m_eIf(eIf), m_eThen(eThen), m_eElse(eElse) {};
242 EXPRFUNC_1ARG(
operator(),
if (m_eIf(i1))
return m_eThen(i1);
return m_eElse(i1); );
243 EXPRFUNC_2ARG(
operator(),
if (m_eIf(i1, i2))
return m_eThen(i1, i2);
return m_eElse(i1, i2); );
244 EXPRFUNC_3ARG(
operator(),
if (m_eIf(i1, i2, i3))
return m_eThen(i1, i2, i3);
return m_eElse(i1, i2, i3); );
301 template <
typename Expr1,
typename Expr2 >
307 TExprCouple(
const Expr1 &e1,
const Expr2 &e2) : m_e1(e1), m_e2(e2) {}
310 EXPRFUNC_3ARG(
operator(), ( m_e1(i1, i2, i3), m_e2(i1, i2, i3)); );
Apply a binary numerical functor to two template expressions.
If/then block using template expressions.
EXPRFUNC_1ARG(operator(), return m_functor(m_e(i1));)
TExprCouple(const Expr1 &e1, const Expr2 &e2)
TExprUnaryOperator(const Expr &e, const UnaryFunctor &functor)
TExprIfThenElse(const TExprIf &eIf, const TExprThen &eThen, const TExprElse &eElse)
Belongs to package Box Do not include directly, include til/Box.h instead.
EXPR_RESULT_TYPE(typename UnaryFunctor::template TypeStruct< typename naked_type< typename Expr::template TypeStruct< Iterator1 TIL_COMMA Iterator2 TIL_COMMA Iterator3 >::Type >::type >::Type)
If/then block using template expressions.
EXPRFUNC_2ARG(operator(), return m_functor(m_e(i1, i2));)
Some macros to ease the otherwise tedious and unreadable declaration of template expression classes...
Apply a unary numerical functor to a template expression.
TExprBinaryOperator(const TExpr1 &e1, const TExpr2 &e2, const BinaryOperator &functor)
TExprIfThen(const TExprIf &eIf, const TExprThen &eThen)
Evaluate one expression and then the other.
TExprBinaryOperator_NoRes(const TExpr1 &e1, const TExpr2 &e2, const BinaryOperator &functor)
EXPRFUNC_3ARG(operator(), return m_functor(m_e(i1, i2, i3));)