From 19e4f11e88a30f70e1b367ef2ca178b08ed1bc5a Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Sat, 20 Sep 2025 17:55:05 +0200 Subject: [PATCH] =?UTF-8?q?libexpr/symbol-table:=20efficiently=20generate?= =?UTF-8?q?=20=E2=89=A4,=20<,=20>,=20=E2=89=A5,=20=3D=3D,=20!=3D=20for=20S?= =?UTF-8?q?ymbol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C++ has the "spaceship" operator which can be auto-implemented and generates efficiently a strong ordering. Change-Id: Idfd1fd68039b395e54401cbe913454e0cbd80fb3 Signed-off-by: Raito Bezarius --- lix/libexpr/symbol-table.hh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lix/libexpr/symbol-table.hh b/lix/libexpr/symbol-table.hh index b36002732..b24576047 100644 --- a/lix/libexpr/symbol-table.hh +++ b/lix/libexpr/symbol-table.hh @@ -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; }; /**