[ox/std] Make String comparison operators const correct
This commit is contained in:
parent
257e857116
commit
a9ec635160
4
deps/ox/src/ox/std/string.cpp
vendored
4
deps/ox/src/ox/std/string.cpp
vendored
@ -125,7 +125,7 @@ const String String::operator+(const String &src) const noexcept {
|
|||||||
return *this + src.c_str();
|
return *this + src.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool String::operator==(const String &other) noexcept {
|
bool String::operator==(const String &other) const noexcept {
|
||||||
bool retval = true;
|
bool retval = true;
|
||||||
std::size_t i = 0;
|
std::size_t i = 0;
|
||||||
while (i < m_buff.size() && (m_buff[i] || other.m_buff[i])) {
|
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;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool String::operator!=(const String &other) noexcept {
|
bool String::operator!=(const String &other) const noexcept {
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
deps/ox/src/ox/std/string.hpp
vendored
4
deps/ox/src/ox/std/string.hpp
vendored
@ -59,9 +59,9 @@ class String {
|
|||||||
|
|
||||||
const String operator+(const String &src) const noexcept;
|
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;
|
char operator[](std::size_t i) const noexcept;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user