update comparison operators for Iterator/Cursor
This commit is contained in:
parent
523eba81f5
commit
8432e7f4b7
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user