This is dangerous. The object might not have the crack() method, and this bloats the compiled size by a lot if you use it with different types. There’s also no reason I can see to use concepts here. The saner way would probably be to use inheritance and objects to mimic Java interfaces.
C++: Nuh, uh …
template concept Crackable = requires(T obj) { { obj.crack() }; }; auto crack(Crackable auto& nut) { nut.crack(); }
This is dangerous. The object might not have the crack() method, and this bloats the compiled size by a lot if you use it with different types. There’s also no reason I can see to use concepts here. The saner way would probably be to use inheritance and objects to mimic Java interfaces.
Well, they say you do have to be over 18 to use Concepts