xentara-utils v2.0.4
The Xentara Utility Library
|
A string that enables heterogeneous lookup when used as a key for hash tables. More...
#include <xentara/utils/string/HashKey.hpp>
Public Member Functions | |
constexpr | BasicHashKey (const std::basic_string< Char, CharTraits, Allocator > &string) |
Conversion constructor from a regular string. | |
constexpr | BasicHashKey (std::basic_string< Char, CharTraits, Allocator > &&string) noexcept |
Move-constructor from a regular string. | |
constexpr auto | operator= (const std::basic_string< Char, CharTraits, Allocator > &string) -> BasicHashKey & |
Assignment operator for a regular string. | |
constexpr auto | operator= (std::basic_string< Char, CharTraits, Allocator > &&string) noexcept -> BasicHashKey & |
Move-assignment operator for a regular string. | |
template<typename StringViewLike > requires (std::is_convertible_v<const StringViewLike &, std::basic_string_view<Char, CharTraits>> && !std::is_convertible_v<const StringViewLike &, const Char *>) | |
constexpr | BasicHashKey (const StringViewLike &string, const Allocator &alloc=Allocator()) |
Make this type implicitly constructible from string view-like types. | |
Public Member Functions inherited from std::basic_string | |
T | append (T... args) |
T | assign (T... args) |
T | at (T... args) |
T | back (T... args) |
T | basic_string (T... args) |
T | begin (T... args) |
T | c_str (T... args) |
T | capacity (T... args) |
T | cbegin (T... args) |
T | cend (T... args) |
T | clear (T... args) |
T | compare (T... args) |
T | copy (T... args) |
T | crbegin (T... args) |
T | crend (T... args) |
T | data (T... args) |
T | empty (T... args) |
T | end (T... args) |
T | ends_with (T... args) |
T | erase (T... args) |
T | find (T... args) |
T | find_first_not_of (T... args) |
T | find_first_of (T... args) |
T | find_last_not_of (T... args) |
T | find_last_of (T... args) |
T | front (T... args) |
T | get_allocator (T... args) |
T | insert (T... args) |
T | length (T... args) |
T | max_size (T... args) |
T | operator basic_string_view (T... args) |
T | operator+= (T... args) |
T | operator= (T... args) |
T | operator[] (T... args) |
T | pop_back (T... args) |
T | push_back (T... args) |
T | rbegin (T... args) |
T | rend (T... args) |
T | replace (T... args) |
T | reserve (T... args) |
T | resize (T... args) |
T | rfind (T... args) |
T | shrink_to_fit (T... args) |
T | size (T... args) |
T | starts_with (T... args) |
T | substr (T... args) |
T | swap (T... args) |
A string that enables heterogeneous lookup when used as a key for hash tables.
This class can be used as a key for std::unordered_map and std::unordered_set to enable heterogeneous lookup, allowing you to look up an entry in a hash table using any type convertible to std::basic_string_view as lookup key, not just BasicHashKey. This saves you from having to construct a string just to perform a lookup, which can lead to unwanted heap allocations. To accomplish this, this class does two things:
|
constexpr |
Conversion constructor from a regular string.
|
constexprnoexcept |
Move-constructor from a regular string.
|
constexpr |
Make this type implicitly constructible from string view-like types.
|
constexpr |
Assignment operator for a regular string.
|
constexprnoexcept |
Move-assignment operator for a regular string.