summaryrefslogtreecommitdiff
path: root/boost/geometry/iterators/segment_iterator.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/iterators/segment_iterator.hpp')
-rw-r--r--boost/geometry/iterators/segment_iterator.hpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/boost/geometry/iterators/segment_iterator.hpp b/boost/geometry/iterators/segment_iterator.hpp
index 206d7fc503..71aff39c43 100644
--- a/boost/geometry/iterators/segment_iterator.hpp
+++ b/boost/geometry/iterators/segment_iterator.hpp
@@ -272,6 +272,16 @@ private:
inline segment_iterator(base const& base_it) : base(base_it) {}
public:
+ // The following typedef is needed for this iterator to be
+ // bidirectional.
+ // Normally we would not have to define this. However, due to the
+ // fact that the value type of the iterator is not a reference,
+ // the iterator_facade framework (used to define the base class of
+ // this iterator) degrades automatically the iterator's category
+ // to input iterator. With the following typedef we recover the
+ // correct iterator category.
+ typedef std::bidirectional_iterator_tag iterator_category;
+
inline segment_iterator() {}
template <typename OtherGeometry>
@@ -291,6 +301,32 @@ public:
NOT_CONVERTIBLE,
(segment_iterator<OtherGeometry>));
}
+
+ inline segment_iterator& operator++() // prefix
+ {
+ base::operator++();
+ return *this;
+ }
+
+ inline segment_iterator& operator--() // prefix
+ {
+ base::operator--();
+ return *this;
+ }
+
+ inline segment_iterator operator++(int) // postfix
+ {
+ segment_iterator copy(*this);
+ base::operator++();
+ return copy;
+ }
+
+ inline segment_iterator operator--(int) // postfix
+ {
+ segment_iterator copy(*this);
+ base::operator--();
+ return copy;
+ }
};