BAN: Implement String::operator==(const String&)
This commit is contained in:
parent
9b8e6e6629
commit
0e714d5eb4
|
@ -134,6 +134,16 @@ namespace BAN
|
||||||
data()[m_size] = '\0';
|
data()[m_size] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool String::operator==(const String& str) const
|
||||||
|
{
|
||||||
|
if (size() != str.size())
|
||||||
|
return false;
|
||||||
|
for (size_type i = 0; i < m_size; i++)
|
||||||
|
if (data()[i] != str.data()[i])
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool String::operator==(StringView str) const
|
bool String::operator==(StringView str) const
|
||||||
{
|
{
|
||||||
if (size() != str.size())
|
if (size() != str.size())
|
||||||
|
|
|
@ -55,6 +55,7 @@ namespace BAN
|
||||||
char operator[](size_type index) const { ASSERT(index < m_size); return data()[index]; }
|
char operator[](size_type index) const { ASSERT(index < m_size); return data()[index]; }
|
||||||
char& operator[](size_type index) { ASSERT(index < m_size); return data()[index]; }
|
char& operator[](size_type index) { ASSERT(index < m_size); return data()[index]; }
|
||||||
|
|
||||||
|
bool operator==(const String&) const;
|
||||||
bool operator==(StringView) const;
|
bool operator==(StringView) const;
|
||||||
bool operator==(const char*) const;
|
bool operator==(const char*) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue