diff --git a/include/boost/geometry/algorithms/for_each.hpp b/include/boost/geometry/algorithms/for_each.hpp index 8ecc1d092..7ebee52ea 100644 --- a/include/boost/geometry/algorithms/for_each.hpp +++ b/include/boost/geometry/algorithms/for_each.hpp @@ -24,7 +24,6 @@ #include #include -#include namespace boost { namespace geometry @@ -77,20 +76,14 @@ struct fe_range_per_segment typename add_const_if_c::type& range, Functor f) { - typedef typename range_iterator_const_if_c - < - IsConst, - Range - >::type iterator_type; - typedef typename add_const_if_c < IsConst, typename point_type::type >::type point_type; - iterator_type it = boost::begin(range); - iterator_type previous = it++; + BOOST_AUTO(it, boost::begin(range)); + BOOST_AUTO(previous, it++); while(it != boost::end(range)) { model::referring_segment s(*previous, *it); diff --git a/include/boost/geometry/multi/algorithms/for_each.hpp b/include/boost/geometry/multi/algorithms/for_each.hpp index 969b629e6..f0a291a10 100644 --- a/include/boost/geometry/multi/algorithms/for_each.hpp +++ b/include/boost/geometry/multi/algorithms/for_each.hpp @@ -10,6 +10,7 @@ #include +#include #include #include @@ -43,15 +44,7 @@ struct for_each_multi typename add_const_if_c::type& multi, Functor f) { - typedef typename range_iterator_const_if_c - < - IsConst, - MultiGeometry - >::type iterator_type; - - for(iterator_type it = boost::begin(multi); - it != boost::end(multi); - ++it) + for(BOOST_AUTO(it, boost::begin(multi)); it != boost::end(multi); ++it) { f = Policy::apply(*it, f); } diff --git a/include/boost/geometry/multi/util/for_each_range.hpp b/include/boost/geometry/multi/util/for_each_range.hpp index 10c2f3d96..060f157e3 100644 --- a/include/boost/geometry/multi/util/for_each_range.hpp +++ b/include/boost/geometry/multi/util/for_each_range.hpp @@ -11,9 +11,9 @@ #include +#include #include -#include #include @@ -34,10 +34,7 @@ struct fe_range_multi typename add_const_if_c::type& multi, Actor& actor) { - for (typename range_iterator_const_if_c::type - it = boost::begin(multi); - it != boost::end(multi); - ++it) + for(BOOST_AUTO(it, boost::begin(multi)); it != boost::end(multi); ++it) { geometry::for_each_range(*it, actor); } diff --git a/include/boost/geometry/util/range_iterator_const_if_c.hpp b/include/boost/geometry/util/range_iterator_const_if_c.hpp deleted file mode 100644 index d6368038f..000000000 --- a/include/boost/geometry/util/range_iterator_const_if_c.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// Boost.Geometry (aka GGL, Generic Geometry Library) -// -// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands. -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_GEOMETRY_UTIL_RANGE_ITERATOR_CONST_IF_C_HPP -#define BOOST_GEOMETRY_UTIL_RANGE_ITERATOR_CONST_IF_C_HPP - - -#include -#include - - -namespace boost { namespace geometry -{ - - -/*! - \brief Meta-function to define a const or non const boost range iterator - \ingroup utility - \details Is used to have one implementation for both const and non const - range iterators - \note This traits class is completely independant from Boost.Geometry and - might be a separate addition to Boost - \note Used in for_each -*/ -template -struct range_iterator_const_if_c -{ - typedef typename boost::mpl::if_c - < - IsConst, - typename boost::range_iterator::type, - typename boost::range_iterator::type - >::type type; -}; - - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_UTIL_RANGE_ITERATOR_CONST_IF_C_HPP