diff --git a/BAN/BAN/String.cpp b/BAN/BAN/String.cpp index 07dc26577d..dfe9bc7b9e 100644 --- a/BAN/BAN/String.cpp +++ b/BAN/BAN/String.cpp @@ -134,6 +134,16 @@ namespace BAN 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 { if (size() != str.size()) diff --git a/BAN/include/BAN/String.h b/BAN/include/BAN/String.h index 3eecccd8ee..a0c4717112 100644 --- a/BAN/include/BAN/String.h +++ b/BAN/include/BAN/String.h @@ -55,6 +55,7 @@ namespace BAN 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]; } + bool operator==(const String&) const; bool operator==(StringView) const; bool operator==(const char*) const;