Also, you can always go with something like this: https://godbolt.org/z/dfKdq7Er4

On Wed, Feb 22, 2023 at 10:32 PM Jason McKesson via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On Wed, Feb 22, 2023 at 7:52 PM Frederick Virchanza Gotham via
Std-Proposals <std-proposals@lists.isocpp.org> 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
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals