Implements ConstString comparison with other string types.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
efec26fe68
commit
e6599e2b5b
|
@ -19,7 +19,8 @@ namespace Arbutils {
|
|||
|
||||
inline static constexpr char charToLower(const char c) { return (c >= 'A' && c <= 'Z') ? c + ('a' - 'A') : c; }
|
||||
inline static uint32_t constexpr LowercaseHash(char const* input) {
|
||||
return charToLower(*input) ? static_cast<uint32_t>(charToLower(*input)) + 33 * LowercaseHash(input + 1) : 5381;
|
||||
return charToLower(*input) ? static_cast<uint32_t>(charToLower(*input)) + 33 * LowercaseHash(input + 1)
|
||||
: 5381;
|
||||
}
|
||||
|
||||
inline static int constexpr Length(const char* str) { return *str ? 1 + Length(str + 1) : 0; }
|
||||
|
@ -51,6 +52,10 @@ namespace Arbutils {
|
|||
|
||||
inline constexpr bool operator==(const ConstString& rhs) const { return _hash == rhs._hash; }
|
||||
inline constexpr bool operator!=(const ConstString& rhs) const { return _hash != rhs._hash; }
|
||||
inline constexpr bool operator==(const std::string& rhs) const { return _hash == Hash(rhs.c_str()); }
|
||||
inline constexpr bool operator!=(const std::string& rhs) const { return _hash != Hash(rhs.c_str()); }
|
||||
inline constexpr bool operator==(const char* rhs) const { return _hash == Hash(rhs); }
|
||||
inline constexpr bool operator!=(const char* rhs) const { return _hash != Hash(rhs); }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue