Merge branch 'develop' of https://github.com/boostorg/geometry into feature/is_simple

This commit is contained in:
Menelaos Karavelas
2014-04-07 12:25:44 +03:00
6 changed files with 117 additions and 77 deletions

View File

@@ -11,7 +11,6 @@
#define BOOST_GEOMETRY_ITERATORS_CONCATENATE_ITERATOR_HPP
#include <boost/type_traits.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/iterator.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/iterator_categories.hpp>
@@ -23,7 +22,7 @@ namespace boost { namespace geometry
template <typename Iterator1, typename Iterator2, typename Value>
struct concatenate_iterator
class concatenate_iterator
: public boost::iterator_facade
<
concatenate_iterator<Iterator1, Iterator2, Value>,
@@ -35,8 +34,6 @@ private:
Iterator1 m_it1, m_end1;
Iterator2 m_it2;
struct enabler {};
public:
typedef Iterator1 first_iterator_type;
typedef Iterator2 second_iterator_type;
@@ -57,17 +54,27 @@ public:
template <typename OtherIt1, typename OtherIt2, typename OtherValue>
concatenate_iterator
(concatenate_iterator<OtherIt1, OtherIt2, OtherValue> const& other,
typename boost::enable_if_c
<
boost::is_convertible<OtherIt1, Iterator1>::value
&& boost::is_convertible<OtherIt2, Iterator2>::value,
enabler
>::type = enabler())
(concatenate_iterator<OtherIt1, OtherIt2, OtherValue> const& other)
: m_it1(other.m_it1), m_end1(other.m_end1), m_it2(other.m_it2)
{}
{
BOOST_STATIC_ASSERT
( boost::is_convertible<OtherIt1, Iterator1>::value
&& boost::is_convertible<OtherIt2, Iterator2>::value );
}
template <typename OtherIt1, typename OtherIt2, typename OtherValue>
concatenate_iterator
operator=(concatenate_iterator<OtherIt1, OtherIt2, OtherValue> const& other)
{
BOOST_STATIC_ASSERT
( boost::is_convertible<OtherIt1, Iterator1>::value
&& boost::is_convertible<OtherIt2, Iterator2>::value );
m_it1 = other.m_it1;
m_end1 = other.m_end1;
m_it2 = other.m_it2;
return *this;
}
private:
friend class boost::iterator_core_access;
@@ -75,7 +82,7 @@ private:
template <typename It1, typename It2, typename V>
friend class concatenate_iterator;
Value& dereference() const
inline Value& dereference() const
{
if ( m_it1 == m_end1 )
{
@@ -84,12 +91,18 @@ private:
return *m_it1;
}
bool equal(concatenate_iterator const& other) const
template <typename OtherIt1, typename OtherIt2, typename OtherValue>
inline bool equal(concatenate_iterator
<
OtherIt1,
OtherIt2,
OtherValue
> const& other) const
{
return m_it1 == other.m_it1 && m_it2 == other.m_it2;
}
void increment()
inline void increment()
{
if ( m_it1 == m_end1 )
{

View File

@@ -11,7 +11,6 @@
#define BOOST_GEOMETRY_ITERATORS_FLATTEN_ITERATOR_HPP
#include <boost/type_traits.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/iterator.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/iterator_categories.hpp>
@@ -30,7 +29,7 @@ template
typename AccessInnerBegin,
typename AccessInnerEnd
>
struct flatten_iterator
class flatten_iterator
: public boost::iterator_facade
<
flatten_iterator
@@ -48,8 +47,6 @@ private:
OuterIterator m_outer_it, m_outer_end;
InnerIterator m_inner_it;
struct enabler {};
public:
typedef OuterIterator outer_iterator_type;
typedef InnerIterator inner_iterator_type;
@@ -82,16 +79,21 @@ public:
OtherValue,
OtherAccessInnerBegin,
OtherAccessInnerEnd
> const& other,
typename boost::enable_if
<
boost::is_convertible<OtherValue*, Value*>,
enabler
>::type = enabler())
> const& other)
: m_outer_it(other.m_outer_it),
m_outer_end(other.m_outer_end),
m_inner_it(other.m_inner_it)
{}
{
BOOST_STATIC_ASSERT( boost::is_convertible
<
OtherOuterIterator, OuterIterator
>::value
&& boost::is_convertible
<
OtherInnerIterator, InnerIterator
>::value );
}
template
<
@@ -110,6 +112,15 @@ public:
OtherAccessInnerEnd
> const& other)
{
BOOST_STATIC_ASSERT( boost::is_convertible
<
OtherOuterIterator, OuterIterator
>::value
&& boost::is_convertible
<
OtherInnerIterator, InnerIterator
>::value );
m_outer_it = other.m_outer_it;
m_outer_end = other.m_outer_end;
m_inner_it = other.m_inner_it;
@@ -148,7 +159,7 @@ private:
}
}
Value& dereference() const
inline Value& dereference() const
{
BOOST_ASSERT( m_outer_it != m_outer_end );
BOOST_ASSERT( m_inner_it != AccessInnerEnd::apply(*m_outer_it) );

View File

@@ -10,7 +10,6 @@
#ifndef BOOST_GEOMETRY_ITERATORS_POINT_ITERATOR_HPP
#define BOOST_GEOMETRY_ITERATORS_POINT_ITERATOR_HPP
#include <boost/utility/enable_if.hpp>
#include <boost/geometry/iterators/dispatch/point_iterator.hpp>
#include <boost/geometry/iterators/point_iterator_type.hpp>
@@ -222,17 +221,6 @@ private:
return this;
}
template <typename G1, typename G2>
struct is_convertible
: boost::is_convertible
<
typename dispatch::point_iterator_type<G1>::type,
typename dispatch::point_iterator_type<G2>::type
>
{};
struct enabler {};
template <typename OtherGeometry> friend class point_iterator;
template <typename G> friend inline point_iterator<G> points_begin(G&);
template <typename G> friend inline point_iterator<G> points_end(G&);
@@ -243,15 +231,16 @@ public:
point_iterator() {}
template <typename OtherGeometry>
point_iterator(point_iterator<OtherGeometry> const& other,
typename boost::enable_if
<
is_convertible<OtherGeometry, Geometry>,
enabler
>::type = enabler())
point_iterator(point_iterator<OtherGeometry> const& other)
: base(*other.base_ptr())
{}
{
BOOST_STATIC_ASSERT
( boost::is_convertible
<
typename dispatch::point_iterator_type<OtherGeometry>::type,
typename dispatch::point_iterator_type<Geometry>::type
>::value );
}
};