Skip to content

Commit

Permalink
Replace some comparison operators with three-way comparison operators
Browse files Browse the repository at this point in the history
Signed-off-by: yamacir-kit <[email protected]>
  • Loading branch information
yamacir-kit committed Nov 14, 2024
1 parent 2a2f5fe commit 6221714
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 22 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.268
0.5.269
6 changes: 1 addition & 5 deletions include/meevax/kernel/string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ inline namespace kernel

operator std::string() const;

friend auto operator ==(string const& lhs, string const& rhs) { return static_cast<std::vector<character> const&>(lhs) == static_cast<std::vector<character> const&>(rhs); }
friend auto operator < (string const& lhs, string const& rhs) { return static_cast<std::vector<character> const&>(lhs) < static_cast<std::vector<character> const&>(rhs); }
friend auto operator > (string const& lhs, string const& rhs) { return static_cast<std::vector<character> const&>(lhs) > static_cast<std::vector<character> const&>(rhs); }
friend auto operator <=(string const& lhs, string const& rhs) { return static_cast<std::vector<character> const&>(lhs) <= static_cast<std::vector<character> const&>(rhs); }
friend auto operator >=(string const& lhs, string const& rhs) { return static_cast<std::vector<character> const&>(lhs) >= static_cast<std::vector<character> const&>(rhs); }
auto operator <=>(string const&) const = default;
};

auto operator <<(std::ostream &, string const&) -> std::ostream &;
Expand Down
8 changes: 2 additions & 6 deletions include/meevax/kernel/symbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,15 @@ inline namespace kernel
: name { std::forward<decltype(xs)>(xs)... }
{}

auto operator <=>(symbol const&) const = default;

operator std::string() const noexcept
{
return name;
}
};

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 &;

Expand Down
7 changes: 0 additions & 7 deletions src/kernel/symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 6221714

Please sign in to comment.