![]() |
ATLAS Offline Software
|
Transparent hash functor for string-like keys. More...
#include <transparent_string_hash.h>
Public Types | |
| using | is_transparent = void |
Public Member Functions | |
| std::size_t | operator() (std::string_view s) const |
| Hash a string view. | |
| std::size_t | operator() (const std::string &s) const |
| Hash a string. | |
| std::size_t | operator() (const char *s) const |
| Hash a C string. | |
Transparent hash functor for string-like keys.
This hash functor allows an associative container with std::string keys to be searched using other string-like types, such as std::string_view or const char*, without first constructing a temporary std::string.
The nested is_transparent type marks this functor as a transparent hash functor, allowing heterogeneous lookup in containers such as std::unordered_map.
Example:
Definition at line 60 of file transparent_string_hash.h.
| using CxxUtils::TransparentStringHash::is_transparent = void |
Definition at line 61 of file transparent_string_hash.h.
|
inline |
Hash a C string.
| s | Null-terminated C string to hash. |
s. Definition at line 89 of file transparent_string_hash.h.
|
inline |
Hash a string.
| s | String to hash. |
s. Definition at line 79 of file transparent_string_hash.h.
|
inline |
Hash a string view.
| s | String view to hash. |
s. Definition at line 69 of file transparent_string_hash.h.