🎉 Smithery is now a part of Arcade.dev! Read more in our announcement here
Mastering C++ Polymorphism: Templates, Concepts, and Virtual Functions. Triggers: templates, concepts, vtable, CRTP, static polymorphism, dynamic polymorphism, SFINAE.
When do we determine the type?
std::any
std::variant
Is the set of types known at compile time?
Do I need to store them in a list?
std::vector<T>
std::vector<std::unique_ptr<Base>>
std::vector<std::variant<...>>
Does the interface match exactly?
Trace Up:
Trace Down:
.draw()
void render(Drawable auto& item) { item.draw(); }
virtual
std::function