Boost logo

Boost-Commit :

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


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

Log:
Made dispatch::perimeter able to retrieve the tag by itself.
Text files modified:
   trunk/boost/geometry/algorithms/perimeter.hpp | 18 +++++-------------
   trunk/boost/geometry/multi/algorithms/perimeter.hpp | 8 ++------
   2 files changed, 7 insertions(+), 19 deletions(-)

Modified: trunk/boost/geometry/algorithms/perimeter.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/perimeter.hpp (original)
+++ trunk/boost/geometry/algorithms/perimeter.hpp 2012-09-23 08:30:51 EDT (Sun, 23 Sep 2012)
@@ -33,7 +33,7 @@
 {
 
 // Default perimeter is 0.0, specializations implement calculated values
-template <typename Tag, typename Geometry>
+template <typename Geometry, typename Tag = typename tag<Geometry>::type>
 struct perimeter : detail::calculate_null
 {
     typedef typename default_length_result<Geometry>::type return_type;
@@ -46,7 +46,7 @@
 };
 
 template <typename Geometry>
-struct perimeter<ring_tag, Geometry>
+struct perimeter<Geometry, ring_tag>
     : detail::length::range_length
         <
             Geometry,
@@ -55,7 +55,7 @@
 {};
 
 template <typename Polygon>
-struct perimeter<polygon_tag, Polygon> : detail::calculate_polygon_sum
+struct perimeter<Polygon, polygon_tag> : detail::calculate_polygon_sum
 {
     typedef typename default_length_result<Polygon>::type return_type;
     typedef detail::length::range_length
@@ -103,11 +103,7 @@
 
     // detail::throw_on_empty_input(geometry);
         
- return dispatch::perimeter
- <
- typename tag<Geometry>::type,
- Geometry
- >::apply(geometry, strategy_type());
+ return dispatch::perimeter<Geometry>::apply(geometry, strategy_type());
 }
 
 /*!
@@ -132,11 +128,7 @@
 
     // detail::throw_on_empty_input(geometry);
     
- return dispatch::perimeter
- <
- typename tag<Geometry>::type,
- Geometry
- >::apply(geometry, strategy);
+ return dispatch::perimeter<Geometry>::apply(geometry, strategy);
 }
 
 }} // namespace boost::geometry

Modified: trunk/boost/geometry/multi/algorithms/perimeter.hpp
==============================================================================
--- trunk/boost/geometry/multi/algorithms/perimeter.hpp (original)
+++ trunk/boost/geometry/multi/algorithms/perimeter.hpp 2012-09-23 08:30:51 EDT (Sun, 23 Sep 2012)
@@ -31,7 +31,7 @@
 namespace dispatch
 {
 template <typename MultiPolygon>
-struct perimeter<multi_polygon_tag, MultiPolygon> : detail::multi_sum
+struct perimeter<MultiPolygon, multi_polygon_tag> : detail::multi_sum
 {
     template <typename Strategy>
     static inline typename default_length_result<MultiPolygon>::type
@@ -40,11 +40,7 @@
         return multi_sum::apply
                <
                    typename default_length_result<MultiPolygon>::type,
- perimeter
- <
- polygon_tag,
- typename boost::range_value<MultiPolygon>::type
- >
+ perimeter<typename boost::range_value<MultiPolygon>::type>
>(multi, strategy);
     }
 };


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