diff --git a/src/core/PieceTable.h b/src/core/PieceTable.h index 78705c3..d00de07 100644 --- a/src/core/PieceTable.h +++ b/src/core/PieceTable.h @@ -78,6 +78,16 @@ public: { return valid() && (offset < piece->length); } + + bool operator==(const Iterator & other) const + { + return (other.piece == piece) && (other.offset == offset); + } + + bool operator!=(const Iterator & other) const + { + return !(*this == other); + } }; struct Cursor @@ -110,10 +120,14 @@ public: bool check_go_left(int n); bool check_go_right(int n, bool allow_on_eol); - bool operator==(const Cursor & c) + bool operator==(const Cursor & c) const { return (c.line == line) && (c.column == column); } + bool operator!=(const Cursor & c) const + { + return !(*this == c); + } void warp_to_inserted_piece(Piece * piece); protected: