summaryrefslogtreecommitdiff
path: root/src/coord.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2020-11-15 08:57:19 +1100
committerMaxime Coste <mawww@kakoune.org>2021-11-21 09:44:56 +1100
commitab9d78f50ddba621f875cf5ceb9da3e20d0a04f5 (patch)
tree776f88ea6befeab321ae8bd4d881e556a264916f /src/coord.hh
parentfb4cef5b61639c507e6c5740cc5973d0d79ba673 (diff)
Convert comparisons to spaceship operator
Diffstat (limited to 'src/coord.hh')
-rw-r--r--src/coord.hh33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/coord.hh b/src/coord.hh
index 6109bf14..30f8e1c0 100644
--- a/src/coord.hh
+++ b/src/coord.hh
@@ -42,31 +42,10 @@ struct LineAndColumn
}
[[gnu::always_inline]]
- constexpr bool operator< (EffectiveType other) const
+ constexpr auto operator<=> (EffectiveType other) const
{
- return (line != other.line) ? line < other.line
- : column < other.column;
- }
-
- [[gnu::always_inline]]
- constexpr bool operator<= (EffectiveType other) const
- {
- return (line != other.line) ? line < other.line
- : column <= other.column;
- }
-
- [[gnu::always_inline]]
- constexpr bool operator> (EffectiveType other) const
- {
- return (line != other.line) ? line > other.line
- : column > other.column;
- }
-
- [[gnu::always_inline]]
- constexpr bool operator>= (EffectiveType other) const
- {
- return (line != other.line) ? line > other.line
- : column >= other.column;
+ return (line != other.line) ? line <=> other.line
+ : column <=> other.column;
}
[[gnu::always_inline]]
@@ -75,12 +54,6 @@ struct LineAndColumn
return line == other.line and column == other.column;
}
- [[gnu::always_inline]]
- constexpr bool operator!= (EffectiveType other) const
- {
- return line != other.line or column != other.column;
- }
-
friend constexpr size_t hash_value(const EffectiveType& val)
{
return hash_values(val.line, val.column);