Add StringRef hasher, comparator.

This commit is contained in:
Bartosz Taudul 2020-05-23 13:49:42 +02:00
parent 670a292416
commit fa2559b3f0

View File

@ -44,6 +44,22 @@ struct StringRef
}; };
}; };
struct StringRefHasher
{
size_t operator()( const StringRef& key ) const
{
return charutil::hash( (const char*)&key, sizeof( StringRef ) );
}
};
struct StringRefComparator
{
bool operator()( const StringRef& lhs, const StringRef& rhs ) const
{
return memcmp( &lhs, &rhs, sizeof( StringRef ) ) == 0;
}
};
class StringIdx class StringIdx
{ {
public: public: