LineAndColumn: add comparison operators
This commit is contained in:
parent
26459abf8a
commit
187a99aba2
|
@ -27,15 +27,34 @@ struct LineAndColumn
|
|||
|
||||
EffectiveType operator-(const EffectiveType& other) const
|
||||
{
|
||||
return EffectiveType(line + other.line, column + other.column);
|
||||
return EffectiveType(line - other.line, column - other.column);
|
||||
}
|
||||
|
||||
EffectiveType& operator-=(const EffectiveType& other)
|
||||
{
|
||||
line += other.line;
|
||||
column += other.column;
|
||||
line -= other.line;
|
||||
column -= other.column;
|
||||
return *static_cast<EffectiveType*>(this);
|
||||
}
|
||||
|
||||
bool operator< (const EffectiveType& other) const
|
||||
{
|
||||
if (line != other.line)
|
||||
return line < other.line;
|
||||
return column < other.column;
|
||||
}
|
||||
|
||||
bool operator<= (const EffectiveType& other) const
|
||||
{
|
||||
if (line != other.line)
|
||||
return line < other.line;
|
||||
return column <= other.column;
|
||||
}
|
||||
|
||||
bool operator== (const EffectiveType& other) const
|
||||
{
|
||||
return line == other.line and column == other.column;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user