Quick question help~
"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?
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?
bool funk(vector<T*> v)
if(v[i] == T*)
Thanks so much for the help!!
It suggests that your template function should accept two parameters.
I would suggest making both of them reference parameters.
Your loop is more or less there, if you sort out the parameters.
The template declaration is also wrong. The syntax is basically:
template<typename NameOfType, typename NameOfType, ...>