aboutsummaryrefslogtreecommitdiff
path: root/boot/result.cc
diff options
context:
space:
mode:
Diffstat (limited to 'boot/result.cc')
-rw-r--r--boot/result.cc36
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());
}