[ox/std] Add comparison operators to String
This commit is contained in:
parent
39b1292b91
commit
78d444c2e5
28
deps/ox/src/ox/std/string.hpp
vendored
28
deps/ox/src/ox/std/string.hpp
vendored
@ -86,6 +86,14 @@ class BasicString {
|
||||
|
||||
bool operator!=(const BasicString &other) const noexcept;
|
||||
|
||||
bool operator<(const BasicString &other) const noexcept;
|
||||
|
||||
bool operator>(const BasicString &other) const noexcept;
|
||||
|
||||
bool operator<=(const BasicString &other) const noexcept;
|
||||
|
||||
bool operator>=(const BasicString &other) const noexcept;
|
||||
|
||||
char operator[](std::size_t i) const noexcept;
|
||||
|
||||
char &operator[](std::size_t i) noexcept;
|
||||
@ -350,6 +358,26 @@ bool BasicString<SmallStringSize>::operator!=(const BasicString &other) const no
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
template<std::size_t SmallStringSize>
|
||||
bool BasicString<SmallStringSize>::operator<(const BasicString &other) const noexcept {
|
||||
return ox_strcmp(c_str(), other.c_str()) < 0;
|
||||
}
|
||||
|
||||
template<std::size_t SmallStringSize>
|
||||
bool BasicString<SmallStringSize>::operator>(const BasicString &other) const noexcept {
|
||||
return ox_strcmp(c_str(), other.c_str()) > 0;
|
||||
}
|
||||
|
||||
template<std::size_t SmallStringSize>
|
||||
bool BasicString<SmallStringSize>::operator<=(const BasicString &other) const noexcept {
|
||||
return ox_strcmp(c_str(), other.c_str()) < 1;
|
||||
}
|
||||
|
||||
template<std::size_t SmallStringSize>
|
||||
bool BasicString<SmallStringSize>::operator>=(const BasicString &other) const noexcept {
|
||||
return ox_strcmp(c_str(), other.c_str()) > -1;
|
||||
}
|
||||
|
||||
template<std::size_t SmallStringSize>
|
||||
char BasicString<SmallStringSize>::operator[](std::size_t i) const noexcept {
|
||||
return m_buff[i];
|
||||
|
Loading…
Reference in New Issue
Block a user