diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-07-19 23:23:22 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-07-20 00:48:12 +0200 |
| commit | d09cd98bd3df9920f0ecab97615048c0594e8f7f (patch) | |
| tree | 6923b34ae6b603e19ede189098206cfe25feef35 /boot/result.cc | |
| parent | cdbc1695a93910df5729779de31912a3b4b4172b (diff) | |
| download | elna-d09cd98bd3df9920f0ecab97615048c0594e8f7f.tar.gz | |
Add clang-tidy support
Diffstat (limited to 'boot/result.cc')
| -rw-r--r-- | boot/result.cc | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/boot/result.cc b/boot/result.cc index 5f3c516..86b0e7a 100644 --- a/boot/result.cc +++ b/boot/result.cc @@ -39,16 +39,6 @@ namespace elna::boot return this->m_line != 0 || this->m_column != 0; } - bool location::operator==(const location& that) const - { - return this->m_line == that.m_line && this->m_column == that.m_column; - } - - bool location::operator!=(const location& that) const - { - return !(*this == that); - } - source_position::source_position(location start, location end) : m_start(start), m_end(end) { @@ -99,22 +89,30 @@ namespace elna::boot return this->m_position; } - bool identifier::operator==(const identifier& that) const + std::strong_ordering identifier::operator<=>(const identifier& that) const { - return this->m_name == that.m_name; - } + auto comparison = this->m_name.compare(that.name()); - bool identifier::operator!=(const identifier& that) const - { - return !(*this == that); + if (comparison < 0) + { + return std::strong_ordering::less; + } + else if (comparison > 0) + { + return std::strong_ordering::greater; + } + else + { + return std::strong_ordering::equal; + } } - bool identifier::operator==(const std::string& that) const + bool identifier::operator==(std::string_view that) const { return this->m_name == that; } - bool identifier::operator!=(const std::string& that) const + bool identifier::operator!=(std::string_view that) const { return !(*this == that); } @@ -142,7 +140,7 @@ namespace elna::boot } std::size_t std::hash<elna::boot::identifier>::operator()( - const elna::boot::identifier& key) const + const elna::boot::identifier& key) const noexcept { return std::hash<std::string>{}(key.name()); } |
