24template<
typename SequenceType,
typename CoordinateType>
25class CoordinateSequenceIterator {
28 using iterator_category = std::random_access_iterator_tag;
29 using value_type = CoordinateType;
30 using reference = CoordinateType&;
31 using pointer = CoordinateType;
32 using difference_type = std::ptrdiff_t;
36 difference_type m_pos;
39 CoordinateSequenceIterator(SequenceType* seq) : m_seq(seq), m_pos(0) {}
41 CoordinateSequenceIterator(SequenceType* seq, std::size_t size) : m_seq(seq), m_pos(static_cast<difference_type>(size)) {}
43 reference operator*()
const {
44 return m_seq->template getAt<value_type>(
static_cast<std::size_t
>(m_pos));
47 pointer operator->()
const {
48 return &m_seq->template getAt<value_type>(
static_cast<std::size_t
>(m_pos));
51 CoordinateSequenceIterator& operator++() {
56 CoordinateSequenceIterator operator++(
int) {
57 CoordinateSequenceIterator ret = *
this;
62 CoordinateSequenceIterator& operator--() {
67 CoordinateSequenceIterator operator--(
int) {
68 CoordinateSequenceIterator ret = *
this;
73 difference_type operator-(
const CoordinateSequenceIterator& other)
const {
74 return this->m_pos - other.m_pos;
77 CoordinateSequenceIterator operator+(difference_type n)
const {
78 return CoordinateSequenceIterator(m_seq,
static_cast<std::size_t
>(m_pos + n));
81 CoordinateSequenceIterator operator+=(difference_type n) {
86 CoordinateSequenceIterator operator-(difference_type n)
const {
87 return CoordinateSequenceIterator(m_seq,
static_cast<std::size_t
>(m_pos - n));
90 CoordinateSequenceIterator operator-=(difference_type n) {
95 CoordinateType& operator[](difference_type n)
const {
99 bool operator==(
const CoordinateSequenceIterator& other)
const {
100 return this->m_pos == other.m_pos;
103 bool operator!=(
const CoordinateSequenceIterator& other)
const {
104 return !(*
this == other);
107 bool operator<(
const CoordinateSequenceIterator& other)
const {
108 return this->m_pos < other.m_pos;
111 bool operator<=(
const CoordinateSequenceIterator& other)
const {
112 return this->m_pos <= other.m_pos;
115 bool operator>(
const CoordinateSequenceIterator& other)
const {
116 return this->m_pos > other.m_pos;
119 bool operator>=(
const CoordinateSequenceIterator& other)
const {
120 return this->m_pos >= other.m_pos;
bool operator<(const CoordinateXY &a, const CoordinateXY &b)
Strict weak ordering operator for Coordinate.
Definition Coordinate.h:458
Basic namespace for all GEOS functionalities.
Definition geos.h:39