diff options
| author | Maxime Coste <mawww@kakoune.org> | 2023-10-25 20:40:04 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2023-10-25 20:40:04 +1100 |
| commit | 96884193ddad76530a09a1b095180b0ca8257b7c (patch) | |
| tree | b218d628c370dffeb77a02e1e0bfcdbf0173af42 /src/string.hh | |
| parent | d1c8622dc7ac1d0e2ec07fa7034e4396dffb244f (diff) | |
Remove redundant comparison operators
Since C++20 (a != b) get automatically rewritten as !(a == b) if
the != operator does not exist.
Diffstat (limited to 'src/string.hh')
| -rw-r--r-- | src/string.hh | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/string.hh b/src/string.hh index 9a7e39f0..ec199d4c 100644 --- a/src/string.hh +++ b/src/string.hh @@ -341,14 +341,10 @@ inline bool operator==(const StringView& lhs, const StringView& rhs) std::equal(lhs.begin(), lhs.end(), rhs.begin()); } -[[gnu::always_inline]] -inline bool operator!=(const StringView& lhs, const StringView& rhs) -{ return not (lhs == rhs); } - -inline bool operator<(const StringView& lhs, const StringView& rhs) +inline auto operator<=>(const StringView& lhs, const StringView& rhs) { - return std::lexicographical_compare(lhs.begin(), lhs.end(), - rhs.begin(), rhs.end()); + return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), + rhs.begin(), rhs.end()); } inline String operator"" _str(const char* str, size_t) |
