▲ | cisters 3 days ago | |
In a language with ad-hoc polymorphism like C++, mixins seems entirely unnecessary. You can just declare by convention that a freestanding clone(T x) -> T function should exist for it to be 'cloneable'. | ||
▲ | cgh 3 days ago | parent | next [-] | |
This “mixin” concept uses the CRTP pattern, as mentioned in the post: https://en.wikipedia.org/wiki/Curiously_recurring_template_p... It actually does have specific applications. That Wikipedia article shows a good example of polymorphic method chaining. In a former life, I worked with Microsoft’s Active Template Library, which is entirely based on this pattern. | ||
▲ | Rucadi 3 days ago | parent | prev [-] | |
And just use concepts and call it a day. |