4 ms·
Templates are the C++ implementation of "generics". Their utility extends far beyond lambdas-as-callables. The entire STL library is built using the Template fe
by Iftheshoefits 12y ago
Templates are the C++ implementation of "generics". Their utility extends far beyond lambdas-as-callables. The entire STL library is built using the Template feature of C++. Templates are far more important than the ability to do "true" object-oriented programming using other features, in my opinion.
For a more concrete example that doesn't rely on the "authority" of an externally developed template library, consider that templates are also useful for static/compile-time polymorphism (see: Curiously Recurring Template Pattern).