From 9ad7ec98a80a5f2e68fda2fe495b52f341bf3e28 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 27 Feb 2014 02:17:08 +0100 Subject: [PATCH] detail::relate::less moved to separate file --- .../algorithms/detail/relate/less.hpp | 69 +++++++++++++++++++ .../algorithms/detail/relate/point_point.hpp | 45 +----------- 2 files changed, 70 insertions(+), 44 deletions(-) create mode 100644 include/boost/geometry/algorithms/detail/relate/less.hpp diff --git a/include/boost/geometry/algorithms/detail/relate/less.hpp b/include/boost/geometry/algorithms/detail/relate/less.hpp new file mode 100644 index 000000000..7755135c8 --- /dev/null +++ b/include/boost/geometry/algorithms/detail/relate/less.hpp @@ -0,0 +1,69 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2014, Oracle and/or its affiliates. + +// Use, modification and distribution is subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + +#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP + +namespace boost { namespace geometry +{ + +#ifndef DOXYGEN_NO_DETAIL +namespace detail { namespace relate { + +// TODO: should this be integrated with geometry::less? + +template ::value> +struct less_dispatch +{ + static inline bool apply(Point1 const& l, Point2 const& r) + { + typename geometry::coordinate_type::type + cl = geometry::get(l); + typename geometry::coordinate_type::type + cr = geometry::get(r); + + if ( geometry::math::equals(cl, cr) ) + { + return less_dispatch::apply(l, r); + } + else + { + return cl < cr; + } + } +}; + +template +struct less_dispatch +{ + static inline bool apply(Point1 const&, Point2 const&) + { + return false; + } +}; + +struct less +{ + template + inline bool operator()(Point1 const& point1, Point2 const& point2) + { + return less_dispatch::apply(point1, point2); + } +}; + +}} // namespace detail::relate +#endif // DOXYGEN_NO_DETAIL + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP diff --git a/include/boost/geometry/algorithms/detail/relate/point_point.hpp b/include/boost/geometry/algorithms/detail/relate/point_point.hpp index 671a4ae84..3dcff8578 100644 --- a/include/boost/geometry/algorithms/detail/relate/point_point.hpp +++ b/include/boost/geometry/algorithms/detail/relate/point_point.hpp @@ -16,6 +16,7 @@ #include #include +#include namespace boost { namespace geometry { @@ -123,50 +124,6 @@ struct multipoint_point } }; -// TODO: should this be integrated with geometry::less? - -template ::value> -struct less_dispatch -{ - static inline bool apply(Point1 const& l, Point2 const& r) - { - typename geometry::coordinate_type::type - cl = geometry::get(l); - typename geometry::coordinate_type::type - cr = geometry::get(r); - - if ( geometry::math::equals(cl, cr) ) - { - return less_dispatch::apply(l, r); - } - else - { - return cl < cr; - } - } -}; - -template -struct less_dispatch -{ - static inline bool apply(Point1 const&, Point2 const&) - { - return false; - } -}; - -struct less -{ - template - inline bool operator()(Point1 const& point1, Point2 const& point2) - { - return less_dispatch::apply(point1, point2); - } -}; - template struct multipoint_multipoint {