Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80681 - in trunk/boost/geometry: algorithms multi/algorithms
From: bruno.lalande_at_[hidden]
Date: 2012-09-23 17:30:58


Author: bruno.lalande
Date: 2012-09-23 17:30:58 EDT (Sun, 23 Sep 2012)
New Revision: 80681
URL: http://svn.boost.org/trac/boost/changeset/80681

Log:
Made dispatch::centroid able to retrieve the tag by itself.
Text files modified:
   trunk/boost/geometry/algorithms/centroid.hpp | 20 ++++++++------------
   trunk/boost/geometry/multi/algorithms/centroid.hpp | 6 +++---
   2 files changed, 11 insertions(+), 15 deletions(-)

Modified: trunk/boost/geometry/algorithms/centroid.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/centroid.hpp (original)
+++ trunk/boost/geometry/algorithms/centroid.hpp 2012-09-23 17:30:58 EDT (Sun, 23 Sep 2012)
@@ -265,33 +265,33 @@
 
 template
 <
- typename Tag,
- typename Geometry
+ typename Geometry,
+ typename Tag = typename tag<Geometry>::type
>
 struct centroid {};
 
 template <typename Geometry>
-struct centroid<point_tag, Geometry>
+struct centroid<Geometry, point_tag>
     : detail::centroid::centroid_point
 {};
 
 template <typename Box>
-struct centroid<box_tag, Box>
+struct centroid<Box, box_tag>
     : detail::centroid::centroid_box
 {};
 
 template <typename Ring>
-struct centroid<ring_tag, Ring>
+struct centroid<Ring, ring_tag>
     : detail::centroid::centroid_range<geometry::closure<Ring>::value>
 {};
 
 template <typename Linestring>
-struct centroid<linestring_tag, Linestring>
+struct centroid<Linestring, linestring_tag>
     : detail::centroid::centroid_range<closed>
  {};
 
 template <typename Polygon>
-struct centroid<polygon_tag, Polygon>
+struct centroid<Polygon, polygon_tag>
     : detail::centroid::centroid_polygon
  {};
 
@@ -328,11 +328,7 @@
 
     // Call dispatch apply method. That one returns true if centroid
     // should be taken from state.
- dispatch::centroid
- <
- typename tag<Geometry>::type,
- Geometry
- >::apply(geometry, c, strategy);
+ dispatch::centroid<Geometry>::apply(geometry, c, strategy);
 }
 
 

Modified: trunk/boost/geometry/multi/algorithms/centroid.hpp
==============================================================================
--- trunk/boost/geometry/multi/algorithms/centroid.hpp (original)
+++ trunk/boost/geometry/multi/algorithms/centroid.hpp 2012-09-23 17:30:58 EDT (Sun, 23 Sep 2012)
@@ -96,7 +96,7 @@
 {
 
 template <typename MultiLinestring>
-struct centroid<multi_linestring_tag, MultiLinestring>
+struct centroid<MultiLinestring, multi_linestring_tag>
     : detail::centroid::centroid_multi
         <
             detail::centroid::centroid_range_state<closed>
@@ -104,7 +104,7 @@
 {};
 
 template <typename MultiPolygon>
-struct centroid<multi_polygon_tag, MultiPolygon>
+struct centroid<MultiPolygon, multi_polygon_tag>
     : detail::centroid::centroid_multi
         <
             detail::centroid::centroid_polygon_state
@@ -113,7 +113,7 @@
 
 
 template <typename MultiPoint>
-struct centroid<multi_point_tag, MultiPoint>
+struct centroid<MultiPoint, multi_point_tag>
     : detail::centroid::centroid_multi
         <
             detail::centroid::centroid_multi_point_state


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