From 6221714ac96a31da5f848c990efe95316ffbb62f Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Thu, 14 Nov 2024 21:36:08 +0900 Subject: [PATCH] Replace some comparison operators with three-way comparison operators Signed-off-by: yamacir-kit --- README.md | 6 +++--- VERSION | 2 +- include/meevax/kernel/string.hpp | 6 +----- include/meevax/kernel/symbol.hpp | 8 ++------ src/kernel/symbol.cpp | 7 ------- 5 files changed, 7 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index af87860dc..2aa39989b 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Procedures for each standard are provided by the following R7RS-style libraries: cmake -B build -DCMAKE_BUILD_TYPE=Release cd build make package -sudo apt install build/meevax_0.5.268_amd64.deb +sudo apt install build/meevax_0.5.269_amd64.deb ``` or @@ -122,9 +122,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |-------------|------------- -| `all` | Build shared-library `libmeevax.0.5.268.so` and executable `meevax` +| `all` | Build shared-library `libmeevax.0.5.269.so` and executable `meevax` | `test` | Test executable `meevax` -| `package` | Generate debian package `meevax_0.5.268_amd64.deb` +| `package` | Generate debian package `meevax_0.5.269_amd64.deb` | `install` | Copy files into `/usr/local` directly ## Usage diff --git a/VERSION b/VERSION index 0c3b0aa47..5b08c5db7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.268 +0.5.269 diff --git a/include/meevax/kernel/string.hpp b/include/meevax/kernel/string.hpp index 10bd7bcc7..5baabcde7 100644 --- a/include/meevax/kernel/string.hpp +++ b/include/meevax/kernel/string.hpp @@ -50,11 +50,7 @@ inline namespace kernel operator std::string() const; - friend auto operator ==(string const& lhs, string const& rhs) { return static_cast const&>(lhs) == static_cast const&>(rhs); } - friend auto operator < (string const& lhs, string const& rhs) { return static_cast const&>(lhs) < static_cast const&>(rhs); } - friend auto operator > (string const& lhs, string const& rhs) { return static_cast const&>(lhs) > static_cast const&>(rhs); } - friend auto operator <=(string const& lhs, string const& rhs) { return static_cast const&>(lhs) <= static_cast const&>(rhs); } - friend auto operator >=(string const& lhs, string const& rhs) { return static_cast const&>(lhs) >= static_cast const&>(rhs); } + auto operator <=>(string const&) const = default; }; auto operator <<(std::ostream &, string const&) -> std::ostream &; diff --git a/include/meevax/kernel/symbol.hpp b/include/meevax/kernel/symbol.hpp index 58143de71..4e634e2ba 100644 --- a/include/meevax/kernel/symbol.hpp +++ b/include/meevax/kernel/symbol.hpp @@ -33,6 +33,8 @@ inline namespace kernel : name { std::forward(xs)... } {} + auto operator <=>(symbol const&) const = default; + operator std::string() const noexcept { return name; @@ -40,12 +42,6 @@ inline namespace kernel }; auto operator + (symbol const&, symbol const&) -> std::string; - auto operator ==(symbol const&, symbol const&) -> bool; - auto operator !=(symbol const&, symbol const&) -> bool; - auto operator < (symbol const&, symbol const&) -> bool; - auto operator <=(symbol const&, symbol const&) -> bool; - auto operator > (symbol const&, symbol const&) -> bool; - auto operator >=(symbol const&, symbol const&) -> bool; auto operator <<(std::ostream &, symbol const&) -> std::ostream &; diff --git a/src/kernel/symbol.cpp b/src/kernel/symbol.cpp index 866659fc8..874ebc491 100644 --- a/src/kernel/symbol.cpp +++ b/src/kernel/symbol.cpp @@ -28,13 +28,6 @@ inline namespace kernel return a.name + b.name; } - auto operator ==(symbol const& a, symbol const& b) -> bool { return a.name == b.name; } - auto operator !=(symbol const& a, symbol const& b) -> bool { return a.name != b.name; } - auto operator < (symbol const& a, symbol const& b) -> bool { return a.name < b.name; } - auto operator <=(symbol const& a, symbol const& b) -> bool { return a.name <= b.name; } - auto operator > (symbol const& a, symbol const& b) -> bool { return a.name > b.name; } - auto operator >=(symbol const& a, symbol const& b) -> bool { return a.name >= b.name; } - auto operator <<(std::ostream & os, symbol const& datum) -> std::ostream & { if (datum.name.empty())