I have this simple function to check if a value is in list:
template <class T>
bool IsinList(list<T> l, T x)
{
for(list<T>::iterator it=list.begin(); it != list.end(); it++)
{
if (*it == x)
return true;
}
return false;
}
I used the function in the same .cpp file like this:
if (!IsinList (words, temp))
goodwords.push_back(temp);
but I am getting this error :
'std::list' : use of class template requires template argument list
and I cant figure out what the problem is. I checked in previous asked questions and it didn't help. Can you explain to me what am I doing wrong?