Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76400 - in trunk/boost/geometry: algorithms strategies strategies/agnostic
From: bruno.lalande_at_[hidden]
Date: 2012-01-10 18:16:00


Author: bruno.lalande
Date: 2012-01-10 18:15:59 EST (Tue, 10 Jan 2012)
New Revision: 76400
URL: http://svn.boost.org/trac/boost/changeset/76400

Log:
Made dispatch::convex_hull more self-contained.
Text files modified:
   trunk/boost/geometry/algorithms/convex_hull.hpp | 41 ++++++++++++++++++---------------------
   trunk/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp | 2
   trunk/boost/geometry/strategies/convex_hull.hpp | 7 +++++
   3 files changed, 26 insertions(+), 24 deletions(-)

Modified: trunk/boost/geometry/algorithms/convex_hull.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/convex_hull.hpp (original)
+++ trunk/boost/geometry/algorithms/convex_hull.hpp 2012-01-10 18:15:59 EST (Tue, 10 Jan 2012)
@@ -87,6 +87,17 @@
 };
 
 
+// Helper metafunction for default strategy retrieval
+template <typename Geometry>
+struct default_strategy
+ : strategy_convex_hull
+ <
+ Geometry,
+ typename point_type<Geometry>::type
+ >
+{};
+
+
 }} // namespace detail::convex_hull
 #endif // DOXYGEN_NO_DETAIL
 
@@ -100,7 +111,7 @@
 <
     typename Geometry,
     typename Output,
- typename Strategy
+ typename Strategy = typename detail::convex_hull::default_strategy<Geometry>::type
>
 struct convex_hull
     : detail::convex_hull::hull_to_geometry<Geometry, Output, Strategy>
@@ -154,24 +165,17 @@
 
 \qbk{[include reference/algorithms/convex_hull.qbk]}
  */
-template<typename Geometry1, typename Geometry2>
-inline void convex_hull(Geometry1 const& geometry,
- Geometry2& hull)
+template<typename Geometry, typename OutputGeometry>
+inline void convex_hull(Geometry const& geometry,
+ OutputGeometry& hull)
 {
     concept::check_concepts_and_equal_dimensions
         <
- const Geometry1,
- Geometry2
+ const Geometry,
+ OutputGeometry
>();
 
- typedef typename point_type<Geometry2>::type point_type;
-
- typedef typename strategy_convex_hull
- <
- typename cs_tag<point_type>::type,
- Geometry1,
- point_type
- >::type strategy_type;
+ typedef typename detail::convex_hull::default_strategy<Geometry>::type strategy_type;
 
     convex_hull(geometry, hull, strategy_type());
 }
@@ -220,14 +224,7 @@
     concept::check<Geometry const>();
     concept::check<typename point_type<Geometry>::type>();
 
- typedef typename point_type<Geometry>::type point_type;
-
- typedef typename strategy_convex_hull
- <
- typename cs_tag<point_type>::type,
- Geometry,
- point_type
- >::type strategy_type;
+ typedef typename detail::convex_hull::default_strategy<Geometry>::type strategy_type;
 
     return convex_hull_insert(geometry, out, strategy_type());
 }

Modified: trunk/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp
==============================================================================
--- trunk/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp (original)
+++ trunk/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp 2012-01-10 18:15:59 EST (Tue, 10 Jan 2012)
@@ -414,7 +414,7 @@
 
 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
 template <typename InputGeometry, typename OutputPoint>
-struct strategy_convex_hull<cartesian_tag, InputGeometry, OutputPoint>
+struct strategy_convex_hull<InputGeometry, OutputPoint, cartesian_tag>
 {
     typedef strategy::convex_hull::graham_andrew<InputGeometry, OutputPoint> type;
 };

Modified: trunk/boost/geometry/strategies/convex_hull.hpp
==============================================================================
--- trunk/boost/geometry/strategies/convex_hull.hpp (original)
+++ trunk/boost/geometry/strategies/convex_hull.hpp 2012-01-10 18:15:59 EST (Tue, 10 Jan 2012)
@@ -30,7 +30,12 @@
     \tparam Geometry the geometry type (hull operates internally per hull over geometry)
     \tparam Point point-type of output points
 */
-template <typename Tag, typename Geometry, typename Point>
+template
+<
+ typename Geometry1,
+ typename Point,
+ typename CsTag = typename cs_tag<Point>::type
+>
 struct strategy_convex_hull
 {
     typedef strategy::not_implemented type;


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