diff --git a/src/string.hh b/src/string.hh index b1e51e7e..5e90e98d 100644 --- a/src/string.hh +++ b/src/string.hh @@ -20,23 +20,6 @@ class StringOps public: using value_type = CharType; - [[gnu::always_inline]] - friend bool operator==(const Type& lhs, const Type& rhs) - { - return lhs.length() == rhs.length() and - std::equal(lhs.begin(), lhs.end(), rhs.begin()); - } - - [[gnu::always_inline]] - friend bool operator!=(const Type& lhs, const Type& rhs) - { return not (lhs == rhs); } - - friend bool operator<(const Type& lhs, const Type& rhs) - { - return std::lexicographical_compare(lhs.begin(), lhs.end(), - rhs.begin(), rhs.end()); - } - friend inline size_t hash_value(const Type& str) { return hash_data(str.data(), (int)str.length()); @@ -220,6 +203,23 @@ inline String operator+(StringView lhs, StringView rhs) return res; } +[[gnu::always_inline]] +inline bool operator==(const StringView& lhs, const StringView& rhs) +{ + return lhs.length() == rhs.length() and + std::equal(lhs.begin(), lhs.end(), rhs.begin()); +} + +[[gnu::always_inline]] +inline bool operator!=(const StringView& lhs, const StringView& rhs) +{ return not (lhs == rhs); } + +inline bool operator<(const StringView& lhs, const StringView& rhs) +{ + return std::lexicographical_compare(lhs.begin(), lhs.end(), + rhs.begin(), rhs.end()); +} + Vector split(StringView str, char separator, char escape); Vector split(StringView str, char separator);