소스 검색

feat(string): add operator==

greatbridf 3 년 전
부모
커밋
6bab50c7fe
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      include/types/string.hpp

+ 4 - 0
include/types/string.hpp

@@ -73,6 +73,10 @@ public:
     {
         return this->append(move(str));
     }
+    bool operator==(const string& rhs) const
+    {
+        return strcmp(c_str(), rhs.c_str()) == 0;
+    }
     string substr(size_type pos, size_type n = npos)
     {
         return string(this->m_arr + pos, n);