Horje
c++ template Code Example
c++ template
int x,y;
GetMax <int> (x,y);
c++ template
template <class  T>//or <typename T> it´s the same
 //T can be int, float, double, etc. 
//simple use example: 
T sum(T a, T b)
{
  return a + b;
}
sum(5.0f, 10f);//sum using float
sum(2,3);//sum using int
c++ template
template <class T>
class mypair {
    T values [2];
  public:
    mypair (T first, T second)
    {
      values[0]=first; values[1]=second;
    }
};
c++ template
template <class myType>
myType GetMax (myType a, myType b) {
 return (a>b?a:b);
}




Cpp

Related
recherche recursive le max dans une liste Code Example recherche recursive le max dans une liste Code Example
Array implementation of Queue using class in c++ Code Example Array implementation of Queue using class in c++ Code Example
How to remove to an Array Code Example How to remove to an Array Code Example
qrandomgenerator bounded Code Example qrandomgenerator bounded Code Example
how to print an array in cpp in single line Code Example how to print an array in cpp in single line Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7