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::meta::any_char Concept Reference

Concept representing character-semantic 1-byte integral types. More...

#include <jh/metax/char.h>

Concept definition

template<typename T>
concept any_char =
std::same_as<T, char> ||
std::same_as<T, signed char> ||
std::same_as<T, unsigned char>
Concept representing character-semantic 1-byte integral types.
Definition char.h:125

Detailed Description

Concept representing character-semantic 1-byte integral types.

This concept includes only the fundamental character types that the implementation treats as one-byte integral entities directly usable as textual or byte-sequence data.

Specifically, it accepts:

  • char
  • signed char
  • unsigned char

These are the clean core character types without cv-qualifiers or references, and are guaranteed to be exactly 1 byte in size (sizeof(T) == 1).

Note
char8_t is not included. It is a distinct built-in type introduced by __cpp_char8_t for UTF-8 character support, not considered equivalent to any form of char. It represents UTF-8 code units, not raw bytes, and therefore requires explicit conversion when hashing.

This constraint ensures that only raw character data (in the sense of 1-byte memory representation types) participates in compile-time hashing. Non-character or higher-level types such as:

  • bool
  • std::byte
  • char8_t

must be explicitly converted via reinterpret_cast<const char*>.

The intent is to enforce semantic correctness and guarantee that hashing remains constexpr-safe, type-clean, and free of undefined behavior across translation units.