C++Syntax
Function Template
Code example
template <typename T>
T maxOf(T a, T b) { return a > b ? a : b; }Writes a function for any type.
In C++, function template: writes a function for any type — template <typename T> T maxOf(T a, T b) { return a > b ? a : b; }
template <typename T>
T maxOf(T a, T b) { return a > b ? a : b; }template <typename T>
T maxOf(T a, T b) { return a > b ? a : b; }Writes a function for any type.
Use template <typename T> T maxOf(T a, T b) { return a > b ? a : b; }.
Use this pattern: template <typename T> T maxOf(T a, T b) { return a > b ? a : b; }
Yes. Use Copy code and adapt the example to your program.
No. The language syntax is the same across operating systems.