13 #ifndef SPATIAL_FUNCTION_HPP
14 #define SPATIAL_FUNCTION_HPP
17 #include "spatial.hpp"
28 template <
typename Accessor,
typename Tp,
typename Unit>
36 template <
typename AnyUnit>
43 {
return Accessor::operator()(n, x) - Accessor::operator()(n, y); }
45 Accessor
accessor()
const {
return *
static_cast<const Accessor*
>(
this); }
55 template <
typename Tp,
typename Unit>
60 template <
typename AnyUnit>
65 {
return x[n] - y[n]; }
75 template <
typename Tp,
typename Unit>
80 template <
typename AnyUnit>
85 {
return x(n) - y(n); }
95 template <
typename Tp,
typename Unit>
100 template <
typename AnyUnit>
106 typename Tp::const_iterator ix = x.begin();
107 typename Tp::const_iterator iy = y.begin();
110 typedef typename std::iterator_traits<typename Tp::const_iterator>
111 ::difference_type diff_t;
112 advance(ix, static_cast<diff_t>(n));
113 advance(iy, static_cast<diff_t>(n));
132 template<
typename Accessor,
typename Tp>
143 return (Accessor::operator()(n, x) < Accessor::operator()(n, y));
149 return (Accessor::operator()(a, x) < Accessor::operator()(b, y));
153 {
return *
static_cast<const Accessor*
>(
this); }
162 template <
typename Tp>
168 return (x[n] < y[n]);
174 return (x[a] < y[b]);
184 template <
typename Tp>
190 return (x(n) < y(n));
196 return (x(a) < y(b));
206 template <
typename Tp>
212 typename Tp::const_iterator ix = x.begin();
213 typename Tp::const_iterator iy = y.begin();
216 typedef typename std::iterator_traits<typename Tp::const_iterator>
217 ::difference_type diff_t;
218 advance(ix, static_cast<diff_t>(n));
219 advance(iy, static_cast<diff_t>(n));
227 typename Tp::const_iterator ix = x.begin();
228 typename Tp::const_iterator iy = y.begin();
231 typedef typename std::iterator_traits<typename Tp::const_iterator>
232 ::difference_type diff_t;
233 advance(ix, static_cast<diff_t>(a));
234 advance(iy, static_cast<diff_t>(b));
242 #endif // SPATIAL_FUNCTION_HPP
iterator_minus(const iterator_minus< Tp, AnyUnit > &)
Unit operator()(dimension_type n, const Tp &x, const Tp &y) const
Unit operator()(dimension_type n, const Tp &x, const Tp &y) const
This functor uses the minus operator to calculate the difference between 2 elements of Tp along the d...
This functor uses the minus operator to calculate the difference between 2 elements of Tp along the d...
bracket_minus(const bracket_minus< Tp, AnyUnit > &)
This functor uses the minus operator to calculate the difference between 2 elements of Tp along the d...
std::size_t dimension_type
Defines the type for the dimension as being a size.
const Accessor & accessor() const
accessor_minus(const accessor_minus< Accessor, Tp, AnyUnit > &other)
Accessor accessor() const
accessor_less(Accessor access=Accessor())
The main namespace used in the library.
This functor uses the minus operator to calculate the difference between 2 elements of Tp along the d...
paren_minus(const paren_minus< Tp, AnyUnit > &)
Unit operator()(dimension_type n, const Tp &x, const Tp &y) const
accessor_minus(Accessor accessor_=Accessor())
Unit operator()(dimension_type n, const Tp &x, const Tp &y) const