+ inline Self& operator++() { ++idx; return *this; } // Preincrement
+
+ inline Self operator++(int) { // Postincrement
+ Self tmp = *this; ++*this; return tmp;
+ }
+
+ inline Self& operator--() { --idx; return *this; } // Predecrement
+ inline Self operator--(int) { // Postdecrement
+ Self tmp = *this; --*this; return tmp;
+ }
+
+ 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 {
+ assert(Term == x.Term && "Cannot compare iterators of different blocks!");
+ return idx > x.idx;
+ }
+
+ 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;