Interesting, I haven't thought about using it in C++ before.<p>It's an idea that has existed for a long time in languages geared toward safety-critical systems.<p>E.g. Derived Types in Ada: <a href="https://fsharpforfunandprofit.com/posts/designing-with-types-discovering-the-domain/" rel="nofollow">https://fsharpforfunandprofit.com/posts/designing-with-types...</a><p>It is sometimes used in Ocaml or F# for domain-specific types: <a href="https://fsharpforfunandprofit.com/posts/discriminated-unions/#single-cases" rel="nofollow">https://fsharpforfunandprofit.com/posts/discriminated-unions...</a>