Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78817 - trunk/boost/geometry/algorithms
From: bruno.lalande_at_[hidden]
Date: 2012-06-05 14:41:43


Author: bruno.lalande
Date: 2012-06-05 14:41:43 EDT (Tue, 05 Jun 2012)
New Revision: 78817
URL: http://svn.boost.org/trac/boost/changeset/78817

Log:
Made dispatch::equals more self-contained.
Text files modified:
   trunk/boost/geometry/algorithms/equals.hpp | 89 +++++++++++++--------------------------
   1 files changed, 31 insertions(+), 58 deletions(-)

Modified: trunk/boost/geometry/algorithms/equals.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/equals.hpp (original)
+++ trunk/boost/geometry/algorithms/equals.hpp 2012-06-05 14:41:43 EDT (Tue, 05 Jun 2012)
@@ -51,13 +51,12 @@
 
 template
 <
- typename Box1,
- typename Box2,
     std::size_t Dimension,
     std::size_t DimensionCount
>
 struct box_box
 {
+ template <typename Box1, typename Box2>
     static inline bool apply(Box1 const& box1, Box2 const& box2)
     {
         if (!geometry::math::equals(get<min_corner, Dimension>(box1), get<min_corner, Dimension>(box2))
@@ -65,13 +64,14 @@
         {
             return false;
         }
- return box_box<Box1, Box2, Dimension + 1, DimensionCount>::apply(box1, box2);
+ return box_box<Dimension + 1, DimensionCount>::apply(box1, box2);
     }
 };
 
-template <typename Box1, typename Box2, std::size_t DimensionCount>
-struct box_box<Box1, Box2, DimensionCount, DimensionCount>
+template <std::size_t DimensionCount>
+struct box_box<DimensionCount, DimensionCount>
 {
+ template <typename Box1, typename Box2>
     static inline bool apply(Box1 const& , Box2 const& )
     {
         return true;
@@ -103,9 +103,10 @@
 };
 
 
-template <typename Geometry1, typename Geometry2, typename TrivialCheck>
+template <typename TrivialCheck>
 struct equals_by_collection
 {
+ template <typename Geometry1, typename Geometry2>
     static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2)
     {
         if (! TrivialCheck::apply(geometry1, geometry2))
@@ -152,17 +153,18 @@
 
 template
 <
- typename Tag1, typename Tag2,
     typename Geometry1,
     typename Geometry2,
- std::size_t DimensionCount
+ typename Tag1 = typename tag<Geometry1>::type,
+ typename Tag2 = typename tag<Geometry2>::type,
+ std::size_t DimensionCount = dimension<Geometry1>::type::value
>
 struct equals
 {};
 
 
 template <typename P1, typename P2, std::size_t DimensionCount>
-struct equals<point_tag, point_tag, P1, P2, DimensionCount>
+struct equals<P1, P2, point_tag, point_tag, DimensionCount>
     : geometry::detail::not_
         <
             P1,
@@ -173,77 +175,54 @@
 
 
 template <typename Box1, typename Box2, std::size_t DimensionCount>
-struct equals<box_tag, box_tag, Box1, Box2, DimensionCount>
- : detail::equals::box_box<Box1, Box2, 0, DimensionCount>
+struct equals<Box1, Box2, box_tag, box_tag, DimensionCount>
+ : detail::equals::box_box<0, DimensionCount>
 {};
 
 
 template <typename Ring1, typename Ring2>
-struct equals<ring_tag, ring_tag, Ring1, Ring2, 2>
- : detail::equals::equals_by_collection
- <
- Ring1, Ring2,
- detail::equals::area_check
- >
+struct equals<Ring1, Ring2, ring_tag, ring_tag, 2>
+ : detail::equals::equals_by_collection<detail::equals::area_check>
 {};
 
 
 template <typename Polygon1, typename Polygon2>
-struct equals<polygon_tag, polygon_tag, Polygon1, Polygon2, 2>
- : detail::equals::equals_by_collection
- <
- Polygon1, Polygon2,
- detail::equals::area_check
- >
+struct equals<Polygon1, Polygon2, polygon_tag, polygon_tag, 2>
+ : detail::equals::equals_by_collection<detail::equals::area_check>
 {};
 
 
 template <typename LineString1, typename LineString2>
-struct equals<linestring_tag, linestring_tag, LineString1, LineString2, 2>
- : detail::equals::equals_by_collection
- <
- LineString1, LineString2,
- detail::equals::length_check
- >
+struct equals<LineString1, LineString2, linestring_tag, linestring_tag, 2>
+ : detail::equals::equals_by_collection<detail::equals::length_check>
 {};
 
 
 template <typename Polygon, typename Ring>
-struct equals<polygon_tag, ring_tag, Polygon, Ring, 2>
- : detail::equals::equals_by_collection
- <
- Polygon, Ring,
- detail::equals::area_check
- >
+struct equals<Polygon, Ring, polygon_tag, ring_tag, 2>
+ : detail::equals::equals_by_collection<detail::equals::area_check>
 {};
 
 
 template <typename Ring, typename Box>
-struct equals<ring_tag, box_tag, Ring, Box, 2>
- : detail::equals::equals_by_collection
- <
- Ring, Box,
- detail::equals::area_check
- >
+struct equals<Ring, Box, ring_tag, box_tag, 2>
+ : detail::equals::equals_by_collection<detail::equals::area_check>
 {};
 
 
 template <typename Polygon, typename Box>
-struct equals<polygon_tag, box_tag, Polygon, Box, 2>
- : detail::equals::equals_by_collection
- <
- Polygon, Box,
- detail::equals::area_check
- >
+struct equals<Polygon, Box, polygon_tag, box_tag, 2>
+ : detail::equals::equals_by_collection<detail::equals::area_check>
 {};
 
 
 template
 <
- typename Tag1, typename Tag2,
     typename Geometry1,
     typename Geometry2,
- std::size_t DimensionCount
+ typename Tag1 = typename tag<Geometry1>::type,
+ typename Tag2 = typename tag<Geometry2>::type,
+ std::size_t DimensionCount = dimension<Geometry1>::type::value
>
 struct equals_reversed
 {
@@ -251,8 +230,8 @@
     {
         return equals
             <
- Tag2, Tag1,
                 Geometry2, Geometry1,
+ Tag2, Tag1,
                 DimensionCount
>::apply(g2, g1);
     }
@@ -294,19 +273,13 @@
             reverse_dispatch<Geometry1, Geometry2>::type::value,
             dispatch::equals_reversed
             <
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
                 Geometry1,
- Geometry2,
- dimension<Geometry1>::type::value
+ Geometry2
>,
             dispatch::equals
             <
- typename tag<Geometry1>::type,
- typename tag<Geometry2>::type,
                 Geometry1,
- Geometry2,
- dimension<Geometry1>::type::value
+ Geometry2
>
>::type::apply(geometry1, geometry2);
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk