From 2e7bfa447451d6bc5d6518c8b1b35b9ef3737841 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Thu, 6 Nov 2025 12:52:13 +0100 Subject: [PATCH] libutil: impl <=> for Pos::{Stdin,String} Change-Id: Ieb5016a261f5a90bbf08b2afb69bb1c288d07ca7 --- lix/libutil/position.hh | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lix/libutil/position.hh b/lix/libutil/position.hh index 54728fab4..ce2e8f925 100644 --- a/lix/libutil/position.hh +++ b/lix/libutil/position.hh @@ -22,21 +22,17 @@ struct Pos struct Stdin { ref source; - bool operator==(const Stdin & rhs) const - { return *source == *rhs.source; } - bool operator!=(const Stdin & rhs) const - { return *source != *rhs.source; } - bool operator<(const Stdin & rhs) const - { return *source < *rhs.source; } + constexpr friend auto operator<=>(Stdin const & lhs, Stdin const & rhs) + { + return *lhs.source <=> *rhs.source; + } }; struct String { ref source; - bool operator==(const String & rhs) const - { return *source == *rhs.source; } - bool operator!=(const String & rhs) const - { return *source != *rhs.source; } - bool operator<(const String & rhs) const - { return *source < *rhs.source; } + constexpr friend auto operator<=>(String const & lhs, String const & rhs) + { + return *lhs.source <=> *rhs.source; + } }; struct Hidden { auto operator<=>(const Hidden &) const = default;