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.
Loading...
Searching...
No Matches
jh::immutable_str_compatible Concept Reference

Concept for types compatible with jh::immutable_str. More...

#include <jh/core/immutable_str.h>

Concept definition

template<typename U>
std::same_as<std::remove_cvref_t<U>, atomic_str_ptr> ||
std::same_as<std::decay_t<U>, const char *>
Concept for types compatible with jh::immutable_str.
Definition immutable_str.h:851
std::shared_ptr< immutable_str > atomic_str_ptr
Atomically replaceable handle to an immutable string.
Definition immutable_str.h:790

Detailed Description

Concept for types compatible with jh::immutable_str.

Defines the set of types that can safely participate in comparison and hashing operations with immutable_str instances. This allows seamless interoperability between atomic_str_ptr, const char*, and string literals.

  • Satisfied by atomic_str_ptr (and its cv/ref-qualified variants).
  • Satisfied by const char*.
  • Satisfied by string literals such as "hello" (which decay to const char*).
  • Used internally in custom hash and equality functors to enable transparent lookups, e.g. unordered_map::find("key") without constructing a temporary immutable_str.
Template Parameters
UCandidate type to test for immutable_str compatibility.
Note
  • Ensures that only pointer-safe, immutable-compatible types are accepted in hashing and equality operations.
  • String literals are automatically included through pointer decay.