123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314 |
- #ifndef BOOST_GEOMETRY_POLICIES_COMPARE_HPP
- #define BOOST_GEOMETRY_POLICIES_COMPARE_HPP
- #include <cstddef>
- #include <boost/geometry/strategies/compare.hpp>
- #include <boost/geometry/util/math.hpp>
- namespace boost { namespace geometry
- {
- template
- <
- typename Point = void,
- int Dimension = -1,
- typename CSTag = void
- >
- struct less
- {
- typedef Point first_argument_type;
- typedef Point second_argument_type;
- typedef bool result_type;
- inline bool operator()(Point const& left, Point const& right) const
- {
- typedef typename strategy::compare::services::default_strategy
- <
- strategy::compare::less,
- Point, Point,
- Dimension,
- CSTag, CSTag
- >::type strategy_type;
- return strategy_type::apply(left, right);
- }
- };
- template <int Dimension, typename CSTag>
- struct less<void, Dimension, CSTag>
- {
- typedef bool result_type;
- template <typename Point1, typename Point2>
- inline bool operator()(Point1 const& left, Point2 const& right) const
- {
- typedef typename strategy::compare::services::default_strategy
- <
- strategy::compare::less,
- Point1, Point2,
- Dimension,
- CSTag, CSTag
- >::type strategy_type;
- return strategy_type::apply(left, right);
- }
- };
- template <typename Point, int Dimension>
- struct less<Point, Dimension, void>
- {
- typedef Point first_argument_type;
- typedef Point second_argument_type;
- typedef bool result_type;
- inline bool operator()(Point const& left, Point const& right) const
- {
- typedef typename strategy::compare::services::default_strategy
- <
- strategy::compare::less,
- Point, Point,
- Dimension
- >::type strategy_type;
- return strategy_type::apply(left, right);
- }
- };
- template <int Dimension>
- struct less<void, Dimension, void>
- {
- typedef bool result_type;
- template <typename Point1, typename Point2>
- inline bool operator()(Point1 const& left, Point2 const& right) const
- {
- typedef typename strategy::compare::services::default_strategy
- <
- strategy::compare::less,
- Point1, Point2,
- Dimension
- >::type strategy_type;
- return strategy_type::apply(left, right);
- }
- };
- template
- <
- typename Point = void,
- int Dimension = -1,
- typename CSTag = void
- >
- struct greater
- {
- typedef Point first_argument_type;
- typedef Point second_argument_type;
- typedef bool result_type;
- bool operator()(Point const& left, Point const& right) const
- {
- typedef typename strategy::compare::services::default_strategy
- <
- strategy::compare::greater,
- Point, Point,
- Dimension,
- CSTag, CSTag
- >::type strategy_type;
- return strategy_type::apply(left, right);
- }
- };
- template <int Dimension, typename CSTag>
- struct greater<void, Dimension, CSTag>
- {
- typedef bool result_type;
- template <typename Point1, typename Point2>
- bool operator()(Point1 const& left, Point2 const& right) const
- {
- typedef typename strategy::compare::services::default_strategy
- <
- strategy::compare::greater,
- Point1, Point2,
- Dimension,
- CSTag, CSTag
- >::type strategy_type;
- return strategy_type::apply(left, right);
- }
- };
- template <typename Point, int Dimension>
- struct greater<Point, Dimension, void>
- {
- typedef Point first_argument_type;
- typedef Point second_argument_type;
- typedef bool result_type;
- bool operator()(Point const& left, Point const& right) const
- {
- typedef typename strategy::compare::services::default_strategy
- <
- strategy::compare::greater,
- Point, Point,
- Dimension
- >::type strategy_type;
- return strategy_type::apply(left, right);
- }
- };
- template <int Dimension>
- struct greater<void, Dimension, void>
- {
- typedef bool result_type;
- template <typename Point1, typename Point2>
- bool operator()(Point1 const& left, Point2 const& right) const
- {
- typedef typename strategy::compare::services::default_strategy
- <
- strategy::compare::greater,
- Point1, Point2,
- Dimension
- >::type strategy_type;
- return strategy_type::apply(left, right);
- }
- };
- template
- <
- typename Point,
- int Dimension = -1,
- typename CSTag = void
- >
- struct equal_to
- {
- typedef Point first_argument_type;
- typedef Point second_argument_type;
- typedef bool result_type;
- bool operator()(Point const& left, Point const& right) const
- {
- typedef typename strategy::compare::services::default_strategy
- <
- strategy::compare::equal_to,
- Point, Point,
- Dimension,
- CSTag, CSTag
- >::type strategy_type;
- return strategy_type::apply(left, right);
- }
- };
- template <int Dimension, typename CSTag>
- struct equal_to<void, Dimension, CSTag>
- {
- typedef bool result_type;
- template <typename Point1, typename Point2>
- bool operator()(Point1 const& left, Point2 const& right) const
- {
- typedef typename strategy::compare::services::default_strategy
- <
- strategy::compare::equal_to,
- Point1, Point2,
- Dimension,
- CSTag, CSTag
- >::type strategy_type;
- return strategy_type::apply(left, right);
- }
- };
- template <typename Point, int Dimension>
- struct equal_to<Point, Dimension, void>
- {
- typedef Point first_argument_type;
- typedef Point second_argument_type;
- typedef bool result_type;
- bool operator()(Point const& left, Point const& right) const
- {
- typedef typename strategy::compare::services::default_strategy
- <
- strategy::compare::equal_to,
- Point, Point,
- Dimension
- >::type strategy_type;
- return strategy_type::apply(left, right);
- }
- };
- template <int Dimension>
- struct equal_to<void, Dimension, void>
- {
- typedef bool result_type;
- template <typename Point1, typename Point2>
- bool operator()(Point1 const& left, Point2 const& right) const
- {
- typedef typename strategy::compare::services::default_strategy
- <
- strategy::compare::equal_to,
- Point1, Point2,
- Dimension
- >::type strategy_type;
- return strategy_type::apply(left, right);
- }
- };
- }}
- #endif
|