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).

Concurrency is a complicated topic. Lucian Radu Teodorescu provides a simple theory of concurrency which is easy to reason about and apply.
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.
Last time, we saw how to provide formatting for a simple user-defined class. Spencer Collyer builds on this, showing how to write a formatter for more complicated types.
The conclusion of the last post was that we need to change something in our models: maybe std::vector should use a different strategy when erasing elements; maybe types like std::tuple<int &> should not be allowed to be stored in a vector; maybe Qt should not be using memmove when erasing objects of trivially relocatable type (but it can still optimize the reallocation of a vector); maybe Qt’s definition of trivial relocability does not match ours, and we need to fix our definitions. In this post we will explore these possibilities and reach some conclusions.
In the last post of this series we started exploring how to erase an element from the middle of a vector.