4 ms·
C++ templates are a form of duck typing as well, and combined with type erasure give you a lot of the benefits of OO without the downsides.
by Kranar 2y ago
C++ templates are a form of duck typing as well, and combined with type erasure give you a lot of the benefits of OO without the downsides.
- michaelrpeskin 2y agoYes, you're right. I've done that in high-performance code where I couldn't afford the double function call of a virtual function. I forgot about that.
- jpc0 2y agoLikewise this is getting easier with the auto keyword now being sugar for templates when used in function arguments and return values