Add string_view equal/not equal comparison operators
This commit is contained in:
parent
2005028424
commit
ed8276402d
@ -85,6 +85,13 @@ public:
|
||||
int32_t compare(size_t pos, size_t count, const string_view& str) const;
|
||||
int32_t compare(size_t pos1, size_t count1, const string_view& str, size_t pos2, size_t count2 = npos) const;
|
||||
|
||||
bool operator==(const string_view& rhs) const;
|
||||
bool operator!=(const string_view& rhs) const;
|
||||
bool operator<(const string_view& rhs) const;
|
||||
bool operator<=(const string_view& rhs) const;
|
||||
bool operator>(const string_view& rhs) const;
|
||||
bool operator>=(const string_view& rhs) const;
|
||||
|
||||
friend bool operator==(const istring& lhs, const istring& rhs);
|
||||
friend bool operator!=(const istring& lhs, const istring& rhs);
|
||||
friend bool operator<(const istring& lhs, const istring& rhs);
|
||||
|
||||
@ -18,4 +18,11 @@ size_t string_view::copy(char* dest, size_t count, size_t pos) const {
|
||||
return count;
|
||||
}
|
||||
|
||||
bool string_view::operator==(const string_view& rhs) const {
|
||||
return strcmp(m_str, rhs.m_str) == 0;
|
||||
}
|
||||
bool string_view::operator!=(const string_view& rhs) const {
|
||||
return strcmp(m_str, rhs.m_str) != 0;
|
||||
}
|
||||
|
||||
} // namespace mtl
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user