1 #ifndef TIL_POINT_OPERATORS_H_ 2 #define TIL_POINT_OPERATORS_H_ 9 template <
typename X,
typename T, std::
size_t D,
typename TStorage >
10 struct CastTo<
Point<T,D,TStorage>,X> : std::binary_function<Point<T,D,TStorage> &, const X &, void>
12 typedef std::binary_function<Point<T,D,TStorage> &,
const X &,
void>
Base;
15 void operator()(first_argument_type p, second_argument_type x)
23 #define TIL_BOUNCE_BOOL_OP_TO_DATA(op) \ 24 template < typename T1, typename T2, std::size_t D, typename TStorage1, typename TStorage2 > \ 25 inline bool operator op (const Point<T1,D,TStorage1> & x, const Point<T2,D,TStorage2> & y) \ 26 { return x.data() op y.data(); } \ 31 #undef TIL_BOUNCE_BOOL_OP_TO_DATA 33 #define TIL_BOUNCE_VEC_OP_TO_DATA(op, arg1, arg2, res, functor) \ 34 template < typename T, std::size_t D, typename TStorage > \ 35 inline res <T,D,TStorage> operator op (const arg1 <T,D,TStorage> & x, const arg2 <T,D,TStorage> & y) \ 36 { return functor<TStorage,TStorage,res <T,D,TStorage> >()(x.data(), y.data()); } 43 #undef TIL_BOUNCE_VEC_OP_TO_DATA 46 #define TIL_BOUNCE_SCALAR_OP_TO_DATA(op, functor) \ 47 template < typename T, std::size_t D, typename TStorage > \ 48 inline Point<T,D,TStorage> operator op (const Point<T,D,TStorage> & x, T y) \ 49 { return functor <TStorage,T,Point<T,D,TStorage> >()(x.data(), y); } \ 50 template < typename T, std::size_t D, typename TStorage > \ 51 inline Point<T,D,TStorage> operator op (T y, const Point<T,D,TStorage> & x) \ 52 { return functor <T,TStorage,Point<T,D,TStorage> >()(y, x.data()); } \ 58 #undef TIL_BOUNCE_SCALAR_OP_TO_DATA 61 template <
typename T, std::
size_t D,
typename TStorage >
62 std::ostream & operator<<(std::ostream & os, const Point<T,D,TStorage> & p)
64 return os << p.data();
std::binary_function< Point< T, D, TStorage > &, const X &, void > Base
void operator()(first_argument_type p, second_argument_type x)
TIL_BOUNCE_VEC_OP_TO_DATA(+, Point, Vector, Point, functor::Add)
Belongs to package Box Do not include directly, include til/Box.h instead.
#define TIL_BOUNCE_BOOL_OP_TO_DATA(op)
Base::second_argument_type second_argument_type
#define TIL_BOUNCE_SCALAR_OP_TO_DATA(op, functor)
Base::first_argument_type first_argument_type