"Write a bool function template that accepts a vector of arbitrary type and a value of the same type and returns true if the vector contains the value, and false otherwise".
I'm reviewing for my final and this is one of the practice questions.
So this means to create a bool function with a template?
Code:
template <T*>
bool funk(vector<T*> v)
{
for(int i=0;i<v.size();i++)
{
if(v[i] == T*)
{
return true;
}
}
return false;
}
I'm confused when the beginning says "that accepts a vector of arbitrary type and a value of the same type". Could someone please explain this to me, and possibly correct my code?
Thanks so much for the help!!