|
JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers โ header-only, RTTI-free, and concurrency-friendly.
|
Custom hash functor for atomic_str_ptr and compatible types.
More...
#include <jh/core/immutable_str.h>
Public Member Functions | |
| template<typename U> | |
| std::uint64_t | operator() (const U &value) const noexcept |
Custom hash functor for atomic_str_ptr and compatible types.
Provides transparent, content-based hashing for associative containers involving jh::immutable_str instances. It enables efficient heterogeneous lookup using const char* or string literals, while ensuring hash consistency across all compatible types.
std::shared_ptr hash, which hashes by pointer value, with a deterministic hash computed from string content. atomic_str_ptr and const char* operands, constrained by immutable_str_compatible. atomic_str_ptr keys can be queried with find("key") or contains("key"). immutable_str instance. JH_IMMUTABLE_STR_AUTO_TRIM is enabled, leading and trailing ASCII whitespace are ignored in hash computation. | U | Input type โ must satisfy immutable_str_compatible (atomic_str_ptr or const char*). |
| value | Input value to hash; may be nullptr (hash result = 0). |
atomic_str_ptr as keys. const char* during lookup, but at least one operand must refer to a valid immutable_str instance. JH_IMMUTABLE_STR_AUTO_TRIM. is_transparent typedef enables heterogeneous lookup in standard unordered containers.