summaryrefslogtreecommitdiff
path: root/boost/geometry/iterators/closing_iterator.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/iterators/closing_iterator.hpp')
-rw-r--r--boost/geometry/iterators/closing_iterator.hpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/boost/geometry/iterators/closing_iterator.hpp b/boost/geometry/iterators/closing_iterator.hpp
index a9f67d4..e263f3a 100644
--- a/boost/geometry/iterators/closing_iterator.hpp
+++ b/boost/geometry/iterators/closing_iterator.hpp
@@ -42,12 +42,14 @@ struct closing_iterator
boost::random_access_traversal_tag
>
{
+ typedef typename boost::range_difference<Range>::type difference_type;
+
/// Constructor including the range it is based on
explicit inline closing_iterator(Range& range)
: m_range(&range)
, m_iterator(boost::begin(range))
, m_end(boost::end(range))
- , m_size(boost::size(range))
+ , m_size(static_cast<difference_type>(boost::size(range)))
, m_index(0)
{}
@@ -56,8 +58,8 @@ struct closing_iterator
: m_range(&range)
, m_iterator(boost::end(range))
, m_end(boost::end(range))
- , m_size(boost::size(range))
- , m_index(m_size + 1)
+ , m_size(static_cast<difference_type>(boost::size(range)))
+ , m_index((m_size == 0) ? 0 : m_size + 1)
{}
/// Default constructor
@@ -67,18 +69,6 @@ struct closing_iterator
, m_index(0)
{}
- inline closing_iterator<Range>& operator=(closing_iterator<Range> const& source)
- {
- m_range = source.m_range;
- m_iterator = source.m_iterator;
- m_end = source.m_end;
- m_size = source.m_size;
- m_index = source.m_index;
- return *this;
- }
-
- typedef std::ptrdiff_t difference_type;
-
private:
friend class boost::iterator_core_access;