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::typed Namespace Reference

Aggregated entry point for lightweight typing and semantic placeholder utilities. More...

Classes

struct  monostate
 Trivial empty type representing "no value". More...
struct  is_monostate
 Type trait: checks whether T is monostate. More...
struct  is_monostate< monostate >
struct  null_mutex_t
 Semantic placeholder for mutex_like types. More...

Concepts

concept  monostate_t
 Concept: satisfied only if T is monostate.

Functions

std::ostream & operator<< (std::ostream &os, const jh::typed::monostate &)

Variables

null_mutex_t null_mutex
 Global constant instance of null_mutex_t.

Detailed Description

Aggregated entry point for lightweight typing and semantic placeholder utilities.

The <jh/typed> forwarding header provides a unified, minimal interface over the type-oriented helpers implemented under jh/typing/.
This subsystem defines small, zero-overhead building blocks used to express type intent, structural absence, or disabled behavior in generic and synchronization-aware code.
Components in jh::typed are designed to work in tandem with the jh::concepts layer, supplying concrete types that satisfy or neutralize conceptual requirements without introducing runtime cost.

See also
jh::concepts

Variable Documentation

◆ null_mutex

null_mutex_t jh::typed::null_mutex
inline

Global constant instance of null_mutex_t.

Represents a universal no-op synchronization primitive. All operations are guaranteed to be optimized away.

Usage:

auto s = jh::safe_from(thread_local_string, jh::typed::null_mutex);
// returns std::shared_ptr<jh::immutable_str>
null_mutex_t null_mutex
Global constant instance of null_mutex_t.
Definition null_mutex.h:159
atomic_str_ptr safe_from(std::string_view sv, M &mtx)
Creates a shared pointer to an immutable_str from a locked string view.
Definition immutable_str.h:1123
Note
Semantic intent:
Using null_mutex explicitly declares that the protected resource is owned and accessed by a single thread only. It serves as a formal statement of exclusive single-thread ownership rather than an omission of synchronization.
This singleton should be used instead of creating local instances. Declaring null_mutex_t variables is meaningless, similar to instantiating std::nullptr_t.