mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 08:12:37 +01:00
ircd::js: Add an overload for hash(string) -> ircd::util::hash().
This commit is contained in:
parent
3ec62bba09
commit
36a7ffba37
1 changed files with 12 additions and 0 deletions
|
@ -89,6 +89,8 @@ struct string
|
|||
template<class T> constexpr bool is_string();
|
||||
template<class A, class B> constexpr bool string_argument();
|
||||
|
||||
template<lifetime L> auto hash(const string<L> &s);
|
||||
|
||||
template<lifetime A, lifetime B> int cmp(const string<A> &a, const string<B> &b);
|
||||
template<lifetime L> int cmp(const char *const &a, const string<L> &b);
|
||||
template<lifetime L> int cmp(const string<L> &a, const char *const &b);
|
||||
|
@ -127,6 +129,8 @@ using string = basic::string<lifetime::stack>;
|
|||
using heap_string = basic::string<lifetime::heap>;
|
||||
using persist_string = basic::string<lifetime::persist>;
|
||||
|
||||
using basic::hash;
|
||||
|
||||
//
|
||||
// Implementation
|
||||
//
|
||||
|
@ -519,6 +523,14 @@ cmp(const string<A> &a,
|
|||
return ret;
|
||||
}
|
||||
|
||||
template<lifetime L>
|
||||
auto
|
||||
hash(const string<L> &s)
|
||||
{
|
||||
//TODO: optimize
|
||||
return ircd::util::hash(std::u16string(s));
|
||||
}
|
||||
|
||||
template<class A,
|
||||
class B>
|
||||
constexpr bool
|
||||
|
|
Loading…
Reference in a new issue