|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80915 - trunk/boost/geometry/algorithms
From: bruno.lalande_at_[hidden]
Date: 2012-10-09 18:07:31
Author: bruno.lalande
Date: 2012-10-09 18:07:30 EDT (Tue, 09 Oct 2012)
New Revision: 80915
URL: http://svn.boost.org/trac/boost/changeset/80915
Log:
Made dispatch::for_each able to find out the geometry constness by itself, and used boost::is_const instead of dedicated overloads.
Text files modified:
trunk/boost/geometry/algorithms/for_each.hpp | 70 ++++------------------------------------
1 files changed, 7 insertions(+), 63 deletions(-)
Modified: trunk/boost/geometry/algorithms/for_each.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/for_each.hpp (original)
+++ trunk/boost/geometry/algorithms/for_each.hpp 2012-10-09 18:07:30 EDT (Tue, 09 Oct 2012)
@@ -18,6 +18,7 @@
#include <algorithm>
#include <boost/range.hpp>
+#include <boost/type_traits/is_const.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
@@ -174,7 +175,7 @@
typename Tag,
typename Geometry,
typename Functor,
- bool IsConst
+ bool IsConst = is_const<Geometry>::value
>
struct for_each_point {};
@@ -208,7 +209,7 @@
typename Tag,
typename Geometry,
typename Functor,
- bool IsConst
+ bool IsConst = is_const<Geometry>::value
>
struct for_each_segment {};
@@ -245,35 +246,6 @@
\details \det_for_each{point}
\ingroup for_each
\param geometry \param_geometry
-\param f \par_for_each_f{const point}
-\tparam Geometry \tparam_geometry
-\tparam Functor \tparam_functor
-
-\qbk{distinguish,const version}
-\qbk{[include reference/algorithms/for_each_point.qbk]}
-\qbk{[heading Example]}
-\qbk{[for_each_point_const] [for_each_point_const_output]}
-*/
-template<typename Geometry, typename Functor>
-inline Functor for_each_point(Geometry const& geometry, Functor f)
-{
- concept::check<Geometry const>();
-
- return dispatch::for_each_point
- <
- typename tag_cast<typename tag<Geometry>::type, multi_tag>::type,
- Geometry,
- Functor,
- true
- >::apply(geometry, f);
-}
-
-
-/*!
-\brief \brf_for_each{point}
-\details \det_for_each{point}
-\ingroup for_each
-\param geometry \param_geometry
\param f \par_for_each_f{point}
\tparam Geometry \tparam_geometry
\tparam Functor \tparam_functor
@@ -281,6 +253,7 @@
\qbk{[include reference/algorithms/for_each_point.qbk]}
\qbk{[heading Example]}
\qbk{[for_each_point] [for_each_point_output]}
+\qbk{[for_each_point_const] [for_each_point_const_output]}
*/
template<typename Geometry, typename Functor>
inline Functor for_each_point(Geometry& geometry, Functor f)
@@ -291,8 +264,7 @@
<
typename tag_cast<typename tag<Geometry>::type, multi_tag>::type,
Geometry,
- Functor,
- false
+ Functor
>::apply(geometry, f);
}
@@ -302,42 +274,15 @@
\details \det_for_each{segment}
\ingroup for_each
\param geometry \param_geometry
-\param f \par_for_each_f{const segment}
+\param f \par_for_each_f{segment}
\tparam Geometry \tparam_geometry
\tparam Functor \tparam_functor
-\qbk{distinguish,const version}
\qbk{[include reference/algorithms/for_each_segment.qbk]}
\qbk{[heading Example]}
\qbk{[for_each_segment_const] [for_each_segment_const_output]}
*/
template<typename Geometry, typename Functor>
-inline Functor for_each_segment(Geometry const& geometry, Functor f)
-{
- concept::check<Geometry const>();
-
- return dispatch::for_each_segment
- <
- typename tag_cast<typename tag<Geometry>::type, multi_tag>::type,
- Geometry,
- Functor,
- true
- >::apply(geometry, f);
-}
-
-
-/*!
-\brief \brf_for_each{segment}
-\details \det_for_each{segment}
-\ingroup for_each
-\param geometry \param_geometry
-\param f \par_for_each_f{segment}
-\tparam Geometry \tparam_geometry
-\tparam Functor \tparam_functor
-
-\qbk{[include reference/algorithms/for_each_segment.qbk]}
-*/
-template<typename Geometry, typename Functor>
inline Functor for_each_segment(Geometry& geometry, Functor f)
{
concept::check<Geometry>();
@@ -346,8 +291,7 @@
<
typename tag_cast<typename tag<Geometry>::type, multi_tag>::type,
Geometry,
- Functor,
- false
+ Functor
>::apply(geometry, f);
}
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