Removed (the need for) range_iterator_const_if_c using BOOST_AUTO

[SVN r67168]
This commit is contained in:
Barend Gehrels
2010-12-11 14:24:31 +00:00
parent 573610796d
commit 1038035c43
4 changed files with 6 additions and 67 deletions

View File

@@ -24,7 +24,6 @@
#include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/util/add_const_if_c.hpp>
#include <boost/geometry/util/range_iterator_const_if_c.hpp>
namespace boost { namespace geometry
@@ -77,20 +76,14 @@ struct fe_range_per_segment
typename add_const_if_c<IsConst, Range>::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<Range>::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<point_type> s(*previous, *it);

View File

@@ -10,6 +10,7 @@
#include <boost/range.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/core/is_multi.hpp>
@@ -43,15 +44,7 @@ struct for_each_multi
typename add_const_if_c<IsConst, MultiGeometry>::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);
}

View File

@@ -11,9 +11,9 @@
#include <boost/range.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/geometry/util/for_each_range.hpp>
#include <boost/geometry/util/range_iterator_const_if_c.hpp>
#include <boost/geometry/multi/core/tags.hpp>
@@ -34,10 +34,7 @@ struct fe_range_multi
typename add_const_if_c<IsConst, Multi>::type& multi,
Actor& actor)
{
for (typename range_iterator_const_if_c<IsConst, Multi>::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);
}

View File

@@ -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 <boost/mpl/if.hpp>
#include <boost/range.hpp>
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 <bool IsConst, typename Range>
struct range_iterator_const_if_c
{
typedef typename boost::mpl::if_c
<
IsConst,
typename boost::range_iterator<Range const>::type,
typename boost::range_iterator<Range>::type
>::type type;
};
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_UTIL_RANGE_ITERATOR_CONST_IF_C_HPP