What’s the point of std::monostate? You can’t do anything with it! -- Raymond Chen
C++17 introduced std::monostate, a dummy type with no members and trivial functions, primarily used when no action is needed. Despite its simplicity, std::monostate plays a crucial role in scenarios like coroutines and std::variant, where a default-constructible placeholder type is required.
What’s the point of std::monostate? You can’t do anything with it!
by Raymond Chen
From the article:
C++17 introduced
std::, and I used it as a placeholder to represent the results of a coroutine that produces nothing. In the comments, Neil Rashbrook asked what you are expected to do with amonostate std::, seeing as has no members and only trivial member functions.monostate The answer is “nothing”.
The purpose of
std::is to be a dummy type that does nothing. All instances are considered equal to each other. It is basically this:monostate struct monostate {}; // plus relational operators and a hash specializationYou can see it in libcxx (LLVM/clang), libstdc++ (gcc), and stl (msvc).

Registration is now open for CppCon 2024! The conference starts on September 15 and will be held
Concurrency is a complicated topic. Lucian Radu Teodorescu provides a simple theory of concurrency which is easy to reason about and apply.
Registration is now open for CppCon 2024! The conference starts on September 15 and will be held
Registration is now open for CppCon 2024! The conference starts on September 15 and will be held
How do you expose a C++ object to a TypeScript layer or other scripting language? Russell K. Standish demonstrates an approach using a RESTService API that is scripting-language independent.
Registration is now open for CppCon 2024! The conference starts on September 15 and will be held
Registration is now open for CppCon 2024! The conference starts on September 15 and will be held