libexpr/symbol-table: efficiently generate ≤, <, >, ≥, ==, != for Symbol
C++ has the "spaceship" operator which can be auto-implemented and generates efficiently a strong ordering. Change-Id: Idfd1fd68039b395e54401cbe913454e0cbd80fb3 Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
@@ -106,9 +106,7 @@ public:
|
||||
|
||||
explicit operator bool() const { return id > 0; }
|
||||
|
||||
bool operator<(const Symbol other) const { return id < other.id; }
|
||||
bool operator==(const Symbol other) const { return id == other.id; }
|
||||
bool operator!=(const Symbol other) const { return id != other.id; }
|
||||
constexpr auto operator<=>(const Symbol & other) const noexcept = default;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user