Also, you can always go with something like this:

On Wed, Feb 22, 2023 at 10:32 PM Jason McKesson via Std-Proposals <> wrote:
On Wed, Feb 22, 2023 at 7:52 PM Frederick Virchanza Gotham via
Std-Proposals <> wrote:
> To give an example where this would be useful, let's say that I want
> to use a 'std::binary_semaphore' as though it were a Lockable. The
> following code works fine with every C++ compiler:

No, absolutely not.

Ignoring the fact that this is a bad idea because that's not how
semaphores work (more on that in the other thread), this also isn't
how the type system works.

What you're talking about is analogous with Rust traits, but Rust
traits are not *types* and are not treated as types. You can't use the
type mechanism for this; you'd have to build some other mechanism the
way Rust did (or C++ does using traits classes in templates).
Std-Proposals mailing list