4 ms·
In modern C++, you don't need macros for polymorphism at all
by cherryteastain 2y ago
In modern C++, you don't need macros for polymorphism at all
- marginalia_nu 2y agoUnless this is about some particular technique I've missed, isn't this what virtual methods are for? Only place I'm aware of where you see macros-based polymorphism is in C.
- cherryteastain 2y agoVirtual methods are runtime polymporphism. Templates are compile time polymorphism, and therefore typically are faster (more inlining + avoiding virtual function call).
- pjmlp 2y agoNo need for macros in compile time polymorphism.