class final
StringTransparentHashHash function for std::string and std::string_view, implemented as a class.
This allows using std::string_view as a key in unordered_map, while still allowing std::string as a key.
Public functions
- auto operator()(const char* c) const -> std::size_t
- Hash function for const char*.
- auto operator()(std::string_view sv) const -> std::size_t
- Hash function for std::string_view.
- auto operator()(const std::string& s) const -> std::size_t
- Hash function for std::string.
Function documentation
std::size_t cubos:: core:: data:: StringTransparentHash:: operator()(const char* c) const
Hash function for const char*.
Parameters | |
---|---|
c | The string to hash. |
Returns | The hash value. |
std::size_t cubos:: core:: data:: StringTransparentHash:: operator()(std::string_view sv) const
Hash function for std::string_view.
Parameters | |
---|---|
sv | The string view to hash. |
Returns | The hash value. |
std::size_t cubos:: core:: data:: StringTransparentHash:: operator()(const std::string& s) const
Hash function for std::string.
Parameters | |
---|---|
s | The string to hash. |
Returns | The hash value. |