You are viewing a single thread.
View all comments 16 points
C++: Nuh, uh …
template <typename T>
concept Crackable = requires(T obj) {
{ obj.crack() };
};
auto crack(Crackable auto& nut) {
nut.crack();
}
2 points
*
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.
5 points
This is dangerous
Well, they say you do have to be over 18 to use Concepts