Template (C++)

Template (C++)

Templates are a feature of the C++ programming language that allow functions and classes to operate with generic types. This allows a function or class to work on many different data types without being rewritten for each one. This is effectively a Turing-complete language.

Templates are of great utility to programmers in C++, especially when combined with multiple inheritance and operator overloading. The C++ Standard Library provides many useful functions within a framework of connected templates.

Major inspirations for C++ templates were the parametrized modules provided by CLU and the generics provided by Ada.

Read more about Template (C++):  Advantages and Disadvantages, Generic Programming Features in Other Languages