From a307bec0906be5eb42b97fb186b5da82aec25e93 Mon Sep 17 00:00:00 2001 From: Menelaos Karavelas Date: Mon, 7 Apr 2014 11:31:42 +0300 Subject: [PATCH] [point iterator][concatenate iterator] replace enable_if mechanism by static assert; add templated assignment operator; make dereference and increment inline; templatize equal for comparison against other concatenate iterator (needed for interoperability between const/non-const versions); --- .../iterators/concatenate_iterator.hpp | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/include/boost/geometry/iterators/concatenate_iterator.hpp b/include/boost/geometry/iterators/concatenate_iterator.hpp index 3cad9b15a..c0c4f5e08 100644 --- a/include/boost/geometry/iterators/concatenate_iterator.hpp +++ b/include/boost/geometry/iterators/concatenate_iterator.hpp @@ -11,7 +11,6 @@ #define BOOST_GEOMETRY_ITERATORS_CONCATENATE_ITERATOR_HPP #include -#include #include #include #include @@ -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 concatenate_iterator - (concatenate_iterator const& other, - typename boost::enable_if_c - < - boost::is_convertible::value - && boost::is_convertible::value, - enabler - >::type = enabler()) + (concatenate_iterator const& other) : m_it1(other.m_it1), m_end1(other.m_end1), m_it2(other.m_it2) - {} + { + BOOST_STATIC_ASSERT + ( boost::is_convertible::value + && boost::is_convertible::value ); + } + template + concatenate_iterator + operator=(concatenate_iterator const& other) + { + BOOST_STATIC_ASSERT + ( boost::is_convertible::value + && boost::is_convertible::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 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 + 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 ) {