libutil: impl <=> for Pos::{Stdin,String}
Change-Id: Ieb5016a261f5a90bbf08b2afb69bb1c288d07ca7
This commit is contained in:
+8
-12
@@ -22,21 +22,17 @@ struct Pos
|
||||
|
||||
struct Stdin {
|
||||
ref<std::string> 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<std::string> 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;
|
||||
|
||||
Reference in New Issue
Block a user