|
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 equality functor for atomic_str_ptr and compatible types.
More...
#include <jh/core/immutable_str.h>
Public Member Functions | |
| template<typename U, typename V> | |
| bool | operator() (const U &lhs, const V &rhs) const noexcept |
Custom equality functor for atomic_str_ptr and compatible types.
Provides content-based comparison for immutable_str instances, enabling heterogeneous lookups in hash-based containers. Unlike the default std::shared_ptr equality operator, which compares raw pointer addresses, this functor compares the underlying string data safely and consistently.
atomic_str_ptr and const char* operands, constrained by immutable_str_compatible. atomic_str_ptr keys — e.g., map.find("key") is valid and efficient. lhs or rhs) must represent a valid immutable_str instance. JH_IMMUTABLE_STR_AUTO_TRIM is enabled, leading and trailing ASCII whitespace are ignored during comparison. | U | Type of the left-hand side operand (atomic_str_ptr or const char*). |
| V | Type of the right-hand side operand (atomic_str_ptr or const char*). |
| lhs | Left-hand side value to compare. |
| rhs | Right-hand side value to compare. |
true if the strings are equal (after trimming if enabled); false otherwise or if either side is nullptr.atomic_str_ptr, but supports lookup using const char* and string literals. immutable_str to ensure pointer safety and avoid undefined behavior. JH_IMMUTABLE_STR_AUTO_TRIM. is_transparent typedef enables heterogeneous comparison in unordered containers.