oops templates code example
Example 1: how to write a template c++
template <class myType>
myType GetMax (myType a, myType b) {
return (a>b?a:b);
}
Example 2: templates of templates c++
namespace std {
template<typename t> struct hash<MyClass<t>>
{
size_t operator() (const MyClass<t>& c) const;
}
}
// You can also do things like
template<template<typename t> class type> func_name<type<t>>();