templates in c++ cpp code example
Example 1: c++ template function
template <class T>
void swap(T & lhs, T & rhs)
{
T tmp = lhs;
lhs = rhs;
rhs = tmp;
}
Example 2: template c++
template <class identifier> function_declaration;
template <typename identifier> function_declaration;
//Example:
template <class Type>
void Swap( Type &x, Type &y)
{
Type Temp = x;
x = y;
y = Temp;
}