49 template <
typename T >
63 template <
class Iterator1 >
64 typename TypeStruct<Iterator1>::Type
68 template <
class Iterator1,
class Iterator2>
69 typename TypeStruct<Iterator1, Iterator2>::Type
73 template <
class Iterator1,
class Iterator2,
class Iterator3 >
74 typename TypeStruct<Iterator1, Iterator2, Iterator3>::Type
98 #define TIL_DEFINE_TEXPR_ARITHMETIC_OPERATOR(name, functor) \ 99 TIL_DEFINE_TEXPR_ARITHMETIC_OPERATOR_EXPR(name, functor) \ 100 TIL_DEFINE_TEXPR_ARITHMETIC_OPERATOR_VALUE(name, functor) \ 103 #define TIL_DEFINE_TEXPR_ARITHMETIC_OPERATOR_EXPR(name, functor) \ 104 template < typename Expr2 > \ 105 TExpr<TExprBinaryOperator_NoRes<Expr, Expr2, functor> > \ 106 name (const TExpr<Expr2> &e) const \ 108 typedef TExprBinaryOperator_NoRes< Expr, Expr2, functor > TExprRet; \ 109 return TExpr<TExprRet>(TExprRet(this->getExpr(), e.getExpr(), functor ())); \ 113 #define TIL_DEFINE_TEXPR_ARITHMETIC_OPERATOR_VALUE(name, functor) \ 114 template < typename T > \ 115 TExpr<TExprBinaryOperator_NoRes<Expr, TExprConstant<T>, functor> > \ 116 name (const T & value) const \ 118 typedef TExprBinaryOperator_NoRes< Expr, TExprConstant<T>, functor > TExprRet; \ 119 return TExpr<TExprRet>(TExprRet(this->getExpr(), TExprConstant<T>(value), functor ())); \ 127 template <
class Expr >
134 EXPR_RESULT_TYPE(
typename Expr::template TypeStruct<Iterator1 TIL_COMMA Iterator2 TIL_COMMA Iterator3>::Type);
153 template <
typename Expr2 >
163 template <
typename T >
171 template <
typename Expr2 >
190 #undef TIL_DEFINE_TEXPR_ARITHMETIC_OPERATOR 191 #undef TIL_DEFINE_TEXPR_ARITHMETIC_OPERATOR_EXPR 192 #undef TIL_DEFINE_TEXPR_ARITHMETIC_OPERATOR_VALUE 222 template <
int N,
typename T >
228 template <
typename Iterator1,
typename Iterator2 = Iterator1,
typename Iterator3 = Iterator1 >
255 template <
typename T >
318 template <
typename TFunctor >
325 template <
typename Expr1 >
333 template <
typename Expr1,
typename Expr2 >
354 template <
typename Functor,
typename TIterator >
355 void floop(Functor & functor, TIterator iIm)
356 {
for (; !iIm.isAtEnd(); ++iIm) functor(iIm); }
358 template <
typename Functor,
typename TIterator >
359 void floop(Functor functor, TIterator iIm)
360 {
for (; !iIm.isAtEnd(); ++iIm) functor(iIm); }
362 template <
typename Functor,
typename TIterator >
364 {
for (; !iIm.isAtEnd(); ++iIm) Functor::compute(*iIm); }
366 template <
typename Expr,
typename TIterator1 >
371 for (; !iIm1.isAtEnd(); ++iIm1)
377 template <
typename Expr,
typename TIterator1 >
382 for (; !iIm1.isAtEnd(); ++iIm1)
390 template <
typename Expr,
typename TIterator >
394 for (; start != end; ++start)
400 template <
typename Expr,
typename TContainer >
404 loop_c(expr, c.begin(), c.end());
408 template <
typename Expr,
typename TIterator1,
typename TIterator2,
typename TIterator3 >
412 for (; start1 != end1; ++start1, ++start2, ++start3)
414 expr(start1, start2, start3);
418 template <
typename Expr,
typename TContainer1,
typename TContainer2,
typename TContainer3 >
422 loop_xxx(expr, c1.begin(), c1.end(), c2.begin(), c3.begin());
425 template <
typename Expr,
typename TIterator1,
typename TIterator2 >
429 for (; start1 != end1; ++start1, ++start2)
431 expr(start1, start2);
435 template <
typename Expr,
typename TContainer1,
typename TContainer2 >
439 loop_xx(expr, c1.begin(), c1.end(), c2.begin());
443 template <
int N,
typename Expr,
typename TIterator1,
typename TIterator2 >
453 for (; begin1 != end1; ++begin1, ++begin2)
455 depth_loop<N-1>(begin1->begin(), begin1->end(), begin2->begin());
460 template <
int N,
typename Expr,
typename TContainer1,
typename TContainer2 >
464 depth_loop<N>(expr, c1.begin(), c1.end(), c2.begin());
467 template <
typename Functor,
typename TIterator >
471 for (; !iIm.isAtEnd(); ++iIm) { functor(iIm); }
477 template <
typename Expr,
typename TIterator1 >
488 template <
typename Expr,
typename TIterator1 >
509 template <
typename Expr,
typename TIterator1,
typename TIterator2 >
511 is_ImageIterator<TIterator1>::value &&
512 is_ImageIterator<TIterator2>::value,
517 for (; !iIm1.isAtEnd(); ++iIm1, ++iIm2) expr(iIm1, iIm2);
521 template <
typename TFunctor,
typename TRange >
540 template <
typename Expr,
typename TIterator1,
typename TIterator2,
typename TIterator3 >
542 is_ImageIterator<TIterator1>::value &&
543 is_ImageIterator<TIterator2>::value &&
544 is_ImageIterator<TIterator3>::value,
549 for (; !iIm1.isAtEnd(); ++iIm1, ++iIm2, ++iIm3) expr(iIm1, iIm2, iIm3);
TypeStruct< Iterator1, Iterator2, Iterator3 >::Type operator()(Iterator1 &, Iterator2 &, Iterator3 &)
Apply a binary numerical functor to two template expressions.
DetemplateOperator2< til::functor::Call > Call
const TExpr< expr::ThirdArgument > _3
Placeholder for the third argument.
TExpr< TExprBinaryOperator< Expr1, Expr2, TFunctor > > operator()(TExpr< Expr1 > e1, TExpr< Expr2 > e2)
DetemplateAssignOperator1< til::functor::Assign > Assign
TypeStruct< Iterator1 >::Type operator()(Iterator1 &)
A template expression class for constant values.
TExpr< TExprBinaryOperator_NoRes< Expr, TExprConstant< T >, functor::Assign > > operator=(const T &value) const
Assignement to a constant.
#define EXPRFUNC_2ARG(name, body)
#define EXPRFUNC_3ARG_ARG(name, body, arg1, arg2, arg3)
Belongs to package Box Do not include directly, include til/Box.h instead.
void loop_x(expr::TExpr< Expr > expr, TContainer &c)
void loop_r(TFunctor f, TRange r)
Represent a constant in template expression.
#define EXPRFUNC_2ARG_ARG(name, body, arg1, arg2)
#define EXPRFUNC_1ARG_ARG(name, body, arg1)
A wrapper class of a template expression.
General macros, definitions and functions.
void floop(Functor &functor, TIterator iIm)
TypeStruct< Iterator1, Iterator2 >::Type operator()(Iterator1 &, Iterator2 &)
void depth_loop(expr::TExpr< Expr > expr, TIterator1 begin1, TIterator1 end1, TIterator2 begin2)
Detemplation of assignment functors taking one template parameter.
TExpr< TExprBinaryOperator< Expr, Expr2, functor::Call > > operator()(const TExpr< Expr2 > &e2) const
A template expression class for left-values.
void loop_xx(expr::TExpr< Expr > expr, TIterator1 start1, const TIterator1 end1, TIterator2 start2)
const TExpr< expr::SecondArgument > _2
Placeholder for the second argument.
void floop2(TIterator iIm)
const TExpr< expr::FirstArgument > _1
Placeholder for the first argument.
void loopboost(Functor &functor, TIterator iIm)
void loop_xxx(expr::TExpr< Expr > expr, TContainer1 &c1, TContainer2 &c2, TContainer3 &c3)
TExpr< TExprUnaryOperator< Expr1, TFunctor > > operator()(TExpr< Expr1 > e)
void loop2(expr::TExpr< Expr > &expr, TIterator1 iIm1)
void loop_xx(expr::TExpr< Expr > expr, TContainer1 &c1, TContainer2 &c2)
TExpr< TExprBinaryOperator_NoRes< Expr, Expr2, functor::Assign > > operator=(const TExpr< Expr2 > &e2) const
Assignement to one expression.
Some macros to ease the otherwise tedious and unreadable declaration of template expression classes...
boost::enable_if_c< is_container< TContainer >::value &&!is_container< T >::value >::type loop(TContainer &c, T v, TBinaryFunctor f)
Apply a binary functor to a collection and a constant.
Apply a unary numerical functor to a template expression.
A class to "detemplate" a pure functor with two template arguments.
EXPR_RESULT_TYPE(const T)
void loop_c(expr::TExpr< Expr > expr, TIterator start, const TIterator &end)
#define EXPRFUNC_3ARG(name, body)
#define EXPRFUNC_1ARG(name, body)
#define TIL_DEFINE_TEXPR_ARITHMETIC_OPERATOR(name, functor)
Template tool to enable a template specialization under some condition.
TExprFunctorHelper(TFunctor f)
const Expr & getExpr() const