c++ declare templated object 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: 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>>();