I want to define a helper function that takes a template parameter. I have tried making a templated function for this, but it does not compile. Any idea what I'm doing wrong? Here's the code I tried.
// vectors are great, but lack a find method. Implement one as a helper.
template<class T> bool vec_find(vector<T> &v, T obj)
{
vector<T>::iterator s;
for (s = v.begin(); s < v.end(); s++)
{
if (*s == obj)
{
return true;
}
}
return false;
}