[ox/std] Make String comparison operators const correct

This commit is contained in:
Gary Talent 2020-06-20 03:49:38 -05:00
parent 257e857116
commit a9ec635160
2 changed files with 4 additions and 4 deletions

View File

@ -125,7 +125,7 @@ const String String::operator+(const String &src) const noexcept {
return *this + src.c_str();
}
bool String::operator==(const String &other) noexcept {
bool String::operator==(const String &other) const noexcept {
bool retval = true;
std::size_t i = 0;
while (i < m_buff.size() && (m_buff[i] || other.m_buff[i])) {
@ -138,7 +138,7 @@ bool String::operator==(const String &other) noexcept {
return retval;
}
bool String::operator!=(const String &other) noexcept {
bool String::operator!=(const String &other) const noexcept {
return !operator==(other);
}

View File

@ -59,9 +59,9 @@ class String {
const String operator+(const String &src) const noexcept;
bool operator==(const String &other) noexcept;
bool operator==(const String &other) const noexcept;
bool operator!=(const String &other) noexcept;
bool operator!=(const String &other) const noexcept;
char operator[](std::size_t i) const noexcept;