diff --git a/include/ircd/js/string.h b/include/ircd/js/string.h index 137a301be..abe292c33 100644 --- a/include/ircd/js/string.h +++ b/include/ircd/js/string.h @@ -89,6 +89,8 @@ struct string template constexpr bool is_string(); template constexpr bool string_argument(); +template auto hash(const string &s); + template int cmp(const string &a, const string &b); template int cmp(const char *const &a, const string &b); template int cmp(const string &a, const char *const &b); @@ -127,6 +129,8 @@ using string = basic::string; using heap_string = basic::string; using persist_string = basic::string; +using basic::hash; + // // Implementation // @@ -519,6 +523,14 @@ cmp(const string &a, return ret; } +template +auto +hash(const string &s) +{ + //TODO: optimize + return ircd::util::hash(std::u16string(s)); +} + template constexpr bool