$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r82466 - trunk/boost/geometry/algorithms
From: bruno.lalande_at_[hidden]
Date: 2013-01-12 15:46:13
Author: bruno.lalande
Date: 2013-01-12 15:46:13 EST (Sat, 12 Jan 2013)
New Revision: 82466
URL: http://svn.boost.org/trac/boost/changeset/82466
Log:
Reimplemented variant handling in area algorithm.
Text files modified: 
   trunk/boost/geometry/algorithms/area.hpp |    65 ++++++++++++++++++++++----------------- 
   1 files changed, 37 insertions(+), 28 deletions(-)
Modified: trunk/boost/geometry/algorithms/area.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/area.hpp	(original)
+++ trunk/boost/geometry/algorithms/area.hpp	2013-01-12 15:46:13 EST (Sat, 12 Jan 2013)
@@ -28,7 +28,6 @@
 #include <boost/geometry/core/ring_type.hpp>
 
 #include <boost/geometry/geometries/concepts/check.hpp>
-#include <boost/geometry/geometries/variant.hpp>
 
 #include <boost/geometry/algorithms/detail/calculate_null.hpp>
 #include <boost/geometry/algorithms/detail/calculate_sum.hpp>
@@ -143,32 +142,6 @@
 };
 
 
-template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename Unused>
-struct area<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Unused>
-{
-    template <typename Strategy>
-    struct visitor: boost::static_visitor<typename Strategy::return_type>
-    {
-        Strategy const& m_strategy;
-
-        visitor(Strategy const& strategy): m_strategy(strategy) {}
-
-        template <typename Geometry>
-        typename Strategy::return_type operator()(Geometry const& geometry) const
-        {
-            return dispatch::area<Geometry>::apply(geometry, m_strategy);
-        }
-    };
-
-    template <typename Variant, typename Strategy>
-    static inline typename Strategy::return_type
-    apply(Variant const& variant_geometry, Strategy const& strategy)
-    {
-        return boost::apply_visitor(visitor<Strategy>(strategy), variant_geometry);
-    }
-};
-
-
 template <typename Geometry>
 struct area<Geometry, box_tag> : detail::area::box_area
 {};
@@ -202,6 +175,42 @@
 };
 
 
+template <typename Geometry>
+struct devarianted_area
+{
+    template <typename Strategy>
+    static inline typename Strategy::return_type apply(Geometry const& geometry, Strategy const& strategy)
+    {
+        return area<Geometry>::apply(geometry, strategy);
+    }
+};
+
+template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
+struct devarianted_area<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+{
+    template <typename Strategy>
+    struct visitor: boost::static_visitor<typename Strategy::return_type>
+    {
+        Strategy const& m_strategy;
+
+        visitor(Strategy const& strategy): m_strategy(strategy) {}
+
+        template <typename Geometry>
+        typename Strategy::return_type operator()(Geometry const& geometry) const
+        {
+            return devarianted_area<Geometry>::apply(geometry, m_strategy);
+        }
+    };
+
+    template <typename Geometry, typename Strategy>
+    static inline typename Strategy::return_type
+    apply(Geometry const& geometry, Strategy const& strategy)
+    {
+        return boost::apply_visitor(visitor<Strategy>(strategy), geometry);
+    }
+};
+
+
 } // namespace dispatch
 #endif // DOXYGEN_NO_DISPATCH
 
@@ -277,7 +286,7 @@
 
     // detail::throw_on_empty_input(geometry);
     
-    return dispatch::area<Geometry>::apply(geometry, strategy);
+    return dispatch::devarianted_area<Geometry>::apply(geometry, strategy);
 }