+
+ inline bool operator<(const _Self& x) const {
+ assert(Term == x.Term && "Cannot compare iterators of different blocks!");
+ return idx < x.idx;
+ }
+
+ inline bool operator<=(const _Self& x) const {
+ assert(Term == x.Term && "Cannot compare iterators of different blocks!");
+ return idx <= x.idx;
+ }
+ inline bool operator>=(const _Self& x) const {
+ assert(Term == x.Term && "Cannot compare iterators of different blocks!");
+ return idx >= x.idx;
+ }
+
+ inline bool operator>(const _Self& x) const {
+ return idx > x.idx;
+ assert(Term == x.Term && "Cannot compare iterators of different blocks!");
+ }
+
+ inline _Self& operator+=(int Right) {
+ unsigned new_idx = idx + Right;
+ assert(index_is_valid(new_idx) && "Iterator index out of bound");
+ idx = new_idx;
+ return *this;
+ }
+
+ inline _Self operator+(int Right) {
+ _Self tmp = *this;
+ tmp += Right;
+ return tmp;
+ }
+
+ inline _Self& operator-=(int Right) {
+ return operator+=(-Right);
+ }
+
+ inline _Self operator-(int Right) {
+ return operator+(-Right);
+ }
+
+ inline int operator-(const _Self& x) {
+ assert(Term == x.Term && "Cannot work on iterators of different blocks!");
+ int distance = idx - x.idx;
+ return distance;
+ }
+
+ // This works for read access, however write access is difficult as changes
+ // to Term are only possible with Term->setSuccessor(idx). Pointers that can
+ // be modified are not available.
+ //
+ // inline pointer operator[](int offset) {
+ // _Self tmp = *this;
+ // tmp += offset;
+ // return tmp.operator*();
+ // }