BAN: use only memcmp when comparing string(view) with const char*

This commit is contained in:
2022-12-13 21:32:51 +02:00
parent 833a82c8d1
commit ced05ff5f2
3 changed files with 3 additions and 8 deletions

View File

@@ -45,9 +45,7 @@ namespace BAN
bool StringView::operator==(const char* other) const
{
if (m_size != strlen(other))
return false;
return memcmp(m_data, other, m_size) == 0;
return memcmp(m_data, other, m_size + 1) == 0;
}
StringView StringView::Substring(size_type index, size_type len) const