Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78813 - in trunk/boost/geometry: algorithms multi/algorithms
From: bruno.lalande_at_[hidden]
Date: 2012-06-05 12:47:38


Author: bruno.lalande
Date: 2012-06-05 12:47:37 EDT (Tue, 05 Jun 2012)
New Revision: 78813
URL: http://svn.boost.org/trac/boost/changeset/78813

Log:
Moved template params from class to function level in dispatch::envelope for those we don't actually dispatch on.
Text files modified:
   trunk/boost/geometry/algorithms/envelope.hpp | 120 ++++++++-------------------------------
   trunk/boost/geometry/multi/algorithms/envelope.hpp | 34 +++-------
   2 files changed, 37 insertions(+), 117 deletions(-)

Modified: trunk/boost/geometry/algorithms/envelope.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/envelope.hpp (original)
+++ trunk/boost/geometry/algorithms/envelope.hpp 2012-06-05 12:47:37 EDT (Tue, 05 Jun 2012)
@@ -35,9 +35,9 @@
 
 
 /// Calculate envelope of an 2D or 3D segment
-template<typename Geometry, typename Box>
 struct envelope_expand_one
 {
+ template<typename Geometry, typename Box>
     static inline void apply(Geometry const& geometry, Box& mbr)
     {
         assign_inverse(mbr);
@@ -63,10 +63,10 @@
 
 
 /// Generic range dispatching struct
-template <typename Range, typename Box>
 struct envelope_range
 {
     /// Calculate envelope of range using a strategy
+ template <typename Range, typename Box>
     static inline void apply(Range const& range, Box& mbr)
     {
         assign_inverse(mbr);
@@ -88,9 +88,8 @@
 
 template
 <
- typename Tag1, typename Tag2,
- typename Geometry, typename Box,
- typename StrategyLess, typename StrategyGreater
+ typename Geometry,
+ typename Tag1 = typename tag<Geometry>::type
>
 struct envelope
 {
@@ -102,102 +101,45 @@
 };
 
 
-template
-<
- typename Point, typename Box,
- typename StrategyLess, typename StrategyGreater
->
-struct envelope
- <
- point_tag, box_tag,
- Point, Box,
- StrategyLess, StrategyGreater
- >
- : detail::envelope::envelope_expand_one<Point, Box>
+template <typename Point>
+struct envelope<Point, point_tag>
+ : detail::envelope::envelope_expand_one
 {};
 
 
-template
-<
- typename BoxIn, typename BoxOut,
- typename StrategyLess, typename StrategyGreater
->
-struct envelope
- <
- box_tag, box_tag,
- BoxIn, BoxOut,
- StrategyLess, StrategyGreater
- >
- : detail::envelope::envelope_expand_one<BoxIn, BoxOut>
+template <typename Box>
+struct envelope<Box, box_tag>
+ : detail::envelope::envelope_expand_one
 {};
 
 
-template
-<
- typename Segment, typename Box,
- typename StrategyLess, typename StrategyGreater
->
-struct envelope
- <
- segment_tag, box_tag,
- Segment, Box,
- StrategyLess, StrategyGreater
- >
- : detail::envelope::envelope_expand_one<Segment, Box>
+template <typename Segment>
+struct envelope<Segment, segment_tag>
+ : detail::envelope::envelope_expand_one
 {};
 
 
-template
-<
- typename Linestring, typename Box,
- typename StrategyLess, typename StrategyGreater
->
-struct envelope
- <
- linestring_tag, box_tag,
- Linestring, Box,
- StrategyLess, StrategyGreater
- >
- : detail::envelope::envelope_range<Linestring, Box>
+template <typename Linestring>
+struct envelope<Linestring, linestring_tag>
+ : detail::envelope::envelope_range
 {};
 
 
-template
-<
- typename Ring, typename Box,
- typename StrategyLess, typename StrategyGreater
->
-struct envelope
- <
- ring_tag, box_tag,
- Ring, Box,
- StrategyLess, StrategyGreater
- >
- : detail::envelope::envelope_range<Ring, Box>
+template <typename Ring>
+struct envelope<Ring, ring_tag>
+ : detail::envelope::envelope_range
 {};
 
 
-template
-<
- typename Polygon, typename Box,
- typename StrategyLess, typename StrategyGreater
->
-struct envelope
- <
- polygon_tag, box_tag,
- Polygon, Box,
- StrategyLess, StrategyGreater
- >
+template <typename Polygon>
+struct envelope<Polygon, polygon_tag>
+ : detail::envelope::envelope_range
 {
+ template <typename Box>
     static inline void apply(Polygon const& poly, Box& mbr)
     {
         // For polygon, inspecting outer ring is sufficient
-
- detail::envelope::envelope_range
- <
- typename ring_type<Polygon>::type,
- Box
- >::apply(exterior_ring(poly), mbr);
+ detail::envelope::envelope_range::apply(exterior_ring(poly), mbr);
     }
 
 };
@@ -228,12 +170,7 @@
     concept::check<Geometry const>();
     concept::check<Box>();
 
- dispatch::envelope
- <
- typename tag<Geometry>::type, typename tag<Box>::type,
- Geometry, Box,
- void, void
- >::apply(geometry, mbr);
+ dispatch::envelope<Geometry>::apply(geometry, mbr);
 }
 
 
@@ -259,12 +196,7 @@
     concept::check<Box>();
 
     Box mbr;
- dispatch::envelope
- <
- typename tag<Geometry>::type, typename tag<Box>::type,
- Geometry, Box,
- void, void
- >::apply(geometry, mbr);
+ dispatch::envelope<Geometry>::apply(geometry, mbr);
     return mbr;
 }
 

Modified: trunk/boost/geometry/multi/algorithms/envelope.hpp
==============================================================================
--- trunk/boost/geometry/multi/algorithms/envelope.hpp (original)
+++ trunk/boost/geometry/multi/algorithms/envelope.hpp 2012-06-05 12:47:37 EDT (Tue, 05 Jun 2012)
@@ -34,9 +34,9 @@
 {
 
 
-template<typename MultiLinestring, typename Box>
 struct envelope_multi_linestring
 {
+ template<typename MultiLinestring, typename Box>
     static inline void apply(MultiLinestring const& mp, Box& mbr)
     {
         assign_inverse(mbr);
@@ -52,9 +52,9 @@
 
 
 // version for multi_polygon: outer ring's of all polygons
-template<typename MultiPolygon, typename Box>
 struct envelope_multi_polygon
 {
+ template<typename MultiPolygon, typename Box>
     static inline void apply(MultiPolygon const& mp, Box& mbr)
     {
         assign_inverse(mbr);
@@ -78,32 +78,20 @@
 namespace dispatch
 {
 
-template
-<
- typename Multi, typename Box,
- typename StrategyLess, typename StrategyGreater
->
-struct envelope<multi_point_tag, box_tag, Multi, Box, StrategyLess, StrategyGreater>
- : detail::envelope::envelope_range<Multi, Box>
+template <typename Multi>
+struct envelope<Multi, multi_point_tag>
+ : detail::envelope::envelope_range
 {};
 
-template
-<
- typename Multi, typename Box,
- typename StrategyLess, typename StrategyGreater
->
-struct envelope<multi_linestring_tag, box_tag, Multi, Box, StrategyLess, StrategyGreater>
- : detail::envelope::envelope_multi_linestring<Multi, Box>
+template <typename Multi>
+struct envelope<Multi, multi_linestring_tag>
+ : detail::envelope::envelope_multi_linestring
 {};
 
 
-template
-<
- typename Multi, typename Box,
- typename StrategyLess, typename StrategyGreater
->
-struct envelope<multi_polygon_tag, box_tag, Multi, Box, StrategyLess, StrategyGreater>
- : detail::envelope::envelope_multi_polygon<Multi, Box>
+template <typename Multi>
+struct envelope<Multi, multi_polygon_tag>
+ : detail::envelope::envelope_multi_polygon
 {};
 
 


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