Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75948 - in trunk: boost/geometry/algorithms boost/geometry/multi/algorithms libs/geometry/doc/src/docutils/tools/support_status
From: bruno.lalande_at_[hidden]
Date: 2011-12-14 18:29:40


Author: bruno.lalande
Date: 2011-12-14 18:29:35 EST (Wed, 14 Dec 2011)
New Revision: 75948
URL: http://svn.boost.org/trac/boost/changeset/75948

Log:
Reduced dispatch::convert required parameters to their bare minimum.
Text files modified:
   trunk/boost/geometry/algorithms/assign.hpp | 8 ------
   trunk/boost/geometry/algorithms/convert.hpp | 45 +++++++++++++++++----------------------
   trunk/boost/geometry/multi/algorithms/convert.hpp | 14 ++++++------
   trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp | 12 ++--------
   4 files changed, 31 insertions(+), 48 deletions(-)

Modified: trunk/boost/geometry/algorithms/assign.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/assign.hpp (original)
+++ trunk/boost/geometry/algorithms/assign.hpp 2011-12-14 18:29:35 EST (Wed, 14 Dec 2011)
@@ -163,13 +163,7 @@
             , (types<Geometry1, Geometry2>)
         );
 
- dispatch::convert
- <
- typename tag<Geometry2>::type,
- typename tag<Geometry1>::type,
- Geometry2,
- Geometry1
- >::apply(geometry2, geometry1);
+ dispatch::convert<Geometry2, Geometry1>::apply(geometry2, geometry1);
 }
 
 

Modified: trunk/boost/geometry/algorithms/convert.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/convert.hpp (original)
+++ trunk/boost/geometry/algorithms/convert.hpp 2011-12-14 18:29:35 EST (Wed, 14 Dec 2011)
@@ -214,8 +214,9 @@
 
 template
 <
- typename Tag1, typename Tag2,
     typename Geometry1, typename Geometry2,
+ typename Tag1 = typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type,
+ typename Tag2 = typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type,
     std::size_t DimensionCount = dimension<Geometry1>::type::value,
     bool UseAssignment = boost::is_same<Geometry1, Geometry2>::value
                          && !boost::is_array<Geometry1>::value
@@ -228,11 +229,11 @@
 
 template
 <
- typename Tag,
     typename Geometry1, typename Geometry2,
+ typename Tag,
     std::size_t DimensionCount
>
-struct convert<Tag, Tag, Geometry1, Geometry2, DimensionCount, true>
+struct convert<Geometry1, Geometry2, Tag, Tag, DimensionCount, true>
 {
     // Same geometry type -> copy whole geometry
     static inline void apply(Geometry1 const& source, Geometry2& destination)
@@ -247,7 +248,7 @@
     typename Geometry1, typename Geometry2,
     std::size_t DimensionCount
>
-struct convert<point_tag, point_tag, Geometry1, Geometry2, DimensionCount, false>
+struct convert<Geometry1, Geometry2, point_tag, point_tag, DimensionCount, false>
     : detail::conversion::point_to_point<Geometry1, Geometry2, 0, DimensionCount>
 {};
 
@@ -257,7 +258,7 @@
     typename Box1, typename Box2,
     std::size_t DimensionCount
>
-struct convert<box_tag, box_tag, Box1, Box2, DimensionCount, false>
+struct convert<Box1, Box2, box_tag, box_tag, DimensionCount, false>
     : detail::conversion::indexed_to_indexed<Box1, Box2, 0, DimensionCount>
 {};
 
@@ -267,19 +268,19 @@
     typename Segment1, typename Segment2,
     std::size_t DimensionCount
>
-struct convert<segment_tag, segment_tag, Segment1, Segment2, DimensionCount, false>
+struct convert<Segment1, Segment2, segment_tag, segment_tag, DimensionCount, false>
     : detail::conversion::indexed_to_indexed<Segment1, Segment2, 0, DimensionCount>
 {};
 
 
 template <typename Segment, typename LineString, std::size_t DimensionCount>
-struct convert<segment_tag, linestring_tag, Segment, LineString, DimensionCount, false>
+struct convert<Segment, LineString, segment_tag, linestring_tag, DimensionCount, false>
     : detail::conversion::segment_to_range<Segment, LineString>
 {};
 
 
 template <typename Ring1, typename Ring2, std::size_t DimensionCount>
-struct convert<ring_tag, ring_tag, Ring1, Ring2, DimensionCount, false>
+struct convert<Ring1, Ring2, ring_tag, ring_tag, DimensionCount, false>
     : detail::conversion::range_to_range
         <
             Ring1,
@@ -290,17 +291,17 @@
 {};
 
 template <typename LineString1, typename LineString2, std::size_t DimensionCount>
-struct convert<linestring_tag, linestring_tag, LineString1, LineString2, DimensionCount, false>
+struct convert<LineString1, LineString2, linestring_tag, linestring_tag, DimensionCount, false>
     : detail::conversion::range_to_range<LineString1, LineString2>
 {};
 
 template <typename Polygon1, typename Polygon2, std::size_t DimensionCount>
-struct convert<polygon_tag, polygon_tag, Polygon1, Polygon2, DimensionCount, false>
+struct convert<Polygon1, Polygon2, polygon_tag, polygon_tag, DimensionCount, false>
     : detail::conversion::polygon_to_polygon<Polygon1, Polygon2>
 {};
 
 template <typename Box, typename Ring>
-struct convert<box_tag, ring_tag, Box, Ring, 2, false>
+struct convert<Box, Ring, box_tag, ring_tag, 2, false>
     : detail::conversion::box_to_range
         <
             Box,
@@ -312,7 +313,7 @@
 
 
 template <typename Box, typename Polygon>
-struct convert<box_tag, polygon_tag, Box, Polygon, 2, false>
+struct convert<Box, Polygon, box_tag, polygon_tag, 2, false>
 {
     static inline void apply(Box const& box, Polygon& polygon)
     {
@@ -320,8 +321,8 @@
 
         convert
             <
- box_tag, ring_tag,
                 Box, ring_type,
+ box_tag, ring_tag,
                 2, false
>::apply(box, exterior_ring(polygon));
     }
@@ -329,7 +330,7 @@
 
 
 template <typename Point, typename Box, std::size_t DimensionCount>
-struct convert<point_tag, box_tag, Point, Box, DimensionCount, false>
+struct convert<Point, Box, point_tag, box_tag, DimensionCount, false>
 {
     static inline void apply(Point const& point, Box& box)
     {
@@ -346,15 +347,15 @@
 
 
 template <typename Ring, typename Polygon, std::size_t DimensionCount>
-struct convert<ring_tag, polygon_tag, Ring, Polygon, DimensionCount, false>
+struct convert<Ring, Polygon, ring_tag, polygon_tag, DimensionCount, false>
 {
     static inline void apply(Ring const& ring, Polygon& polygon)
     {
         typedef typename ring_type<Polygon>::type ring_type;
         convert
             <
- ring_tag, ring_tag,
                 Ring, ring_type,
+ ring_tag, ring_tag,
                 DimensionCount, false
>::apply(ring, exterior_ring(polygon));
     }
@@ -362,7 +363,7 @@
 
 
 template <typename Polygon, typename Ring, std::size_t DimensionCount>
-struct convert<polygon_tag, ring_tag, Polygon, Ring, DimensionCount, false>
+struct convert<Polygon, Ring, polygon_tag, ring_tag, DimensionCount, false>
 {
     static inline void apply(Polygon const& polygon, Ring& ring)
     {
@@ -370,8 +371,8 @@
 
         convert
             <
- ring_tag, ring_tag,
                 ring_type, Ring,
+ ring_tag, ring_tag,
                 DimensionCount, false
>::apply(exterior_ring(polygon), ring);
     }
@@ -402,13 +403,7 @@
 {
     concept::check_concepts_and_equal_dimensions<Geometry1 const, Geometry2>();
 
- dispatch::convert
- <
- typename tag_cast<typename tag<Geometry1>::type, multi_tag>::type,
- typename tag_cast<typename tag<Geometry2>::type, multi_tag>::type,
- Geometry1,
- Geometry2
- >::apply(geometry1, geometry2);
+ dispatch::convert<Geometry1, Geometry2>::apply(geometry1, geometry2);
 }
 
 

Modified: trunk/boost/geometry/multi/algorithms/convert.hpp
==============================================================================
--- trunk/boost/geometry/multi/algorithms/convert.hpp (original)
+++ trunk/boost/geometry/multi/algorithms/convert.hpp 2011-12-14 18:29:35 EST (Wed, 14 Dec 2011)
@@ -74,13 +74,15 @@
 // version types might be the same and therefore we call boost::is_same again
 
 template <typename Multi1, typename Multi2, std::size_t DimensionCount>
-struct convert<multi_tag, multi_tag, Multi1, Multi2, DimensionCount, false>
+struct convert<Multi1, Multi2, multi_tag, multi_tag, DimensionCount, false>
     : detail::conversion::multi_to_multi
         <
             Multi1,
             Multi2,
             convert
                 <
+ typename boost::range_value<Multi1>::type,
+ typename boost::range_value<Multi2>::type,
                     typename single_tag_of
                                 <
                                     typename tag<Multi1>::type
@@ -89,28 +91,26 @@
                                 <
                                     typename tag<Multi2>::type
>::type,
- typename boost::range_value<Multi1>::type,
- typename boost::range_value<Multi2>::type,
                     DimensionCount
>
>
 {};
 
-template <typename SingleTag, typename Single, typename Multi, std::size_t DimensionCount>
-struct convert<SingleTag, multi_tag, Single, Multi, DimensionCount, false>
+template <typename Single, typename Multi, typename SingleTag, std::size_t DimensionCount>
+struct convert<Single, Multi, SingleTag, multi_tag, DimensionCount, false>
     : detail::conversion::single_to_multi
         <
             Single,
             Multi,
             convert
                 <
+ Single,
+ typename boost::range_value<Multi>::type,
                     typename tag<Single>::type,
                     typename single_tag_of
                                 <
                                     typename tag<Multi>::type
>::type,
- Single,
- typename boost::range_value<Multi>::type,
                     DimensionCount,
                     false
>

Modified: trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp (original)
+++ trunk/libs/geometry/doc/src/docutils/tools/support_status/support_status.cpp 2011-12-14 18:29:35 EST (Wed, 14 Dec 2011)
@@ -47,17 +47,11 @@
 {};
 
 template <typename G1, typename G2>
-struct check_convert
- : boost::geometry::dispatch::convert<
- typename boost::geometry::tag_cast<typename boost::geometry::tag<G1>::type, boost::geometry::multi_tag>::type,
- typename boost::geometry::tag_cast<typename boost::geometry::tag<G2>::type, boost::geometry::multi_tag>::type,
- G1,
- G2
- >
+struct check_convert: boost::geometry::dispatch::convert<G1, G2>
 {};
 
 
-template <class T1>
+template <typename T1>
 struct distance_tester
 {
     template <typename T2>
@@ -90,7 +84,7 @@
 };
 
 
-template <class T1>
+template <typename T1>
 struct convert_tester
 {
     template <typename T2>


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