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
monostate.h File Reference

Trivial placeholder type monostate and its traits. More...

#include <type_traits>

Go to the source code of this file.

Classes

struct  jh::typed::monostate
 Trivial empty type representing "no value". More...
struct  jh::typed::is_monostate< T >
 Type trait: checks whether T is monostate. More...
struct  jh::typed::is_monostate< monostate >

Namespaces

namespace  jh::typed
 Aggregated entry point for lightweight typing and semantic placeholder utilities.

Concepts

concept  jh::typed::monostate_t
 Concept: satisfied only if T is monostate.

Detailed Description

Trivial placeholder type monostate and its traits.

Author
JeongHan-Bae <mastropseudo@gmail.com>

Provides jh::typed::monostate, a strict POD type equivalent in spirit to std::monostate, but lightweight and header-only (no dependency on <variant> or other STL headers).

Components:

  • monostate — trivial empty type with equality operators.
  • is_monostate<T> — type trait for detection.
  • monostate_t<T> — concept form for SFINAE/constraints.

Design Goals:

  • POD compliance: trivially copyable, trivially constructible, standard layout.
  • Minimal dependency footprint, no heavy STL headers required.
  • Use as a safe placeholder in POD containers (e.g. unused tuple slots).

Notes:

  • Represents only "no value"; not interchangeable with nullopt or nullable types.
  • Has no runtime state, equality is always true.
Version
1.3.x
Date
2025