I am trying to do the following:
template <class T>
std::ifstream& operator>> (std::ifstream& fin, List<T> l)
{
T temp;
l.resize(0);
fin >> ignore(1,'');
for(ListIterator<T> i=l.begin();i!=l.end();i++)
{
fin >> ignore(1,'') >> temp;
l.push_back(temp);
}
return fin;
}
I have to read all the contents from a file. Each field is separated by ''
character, so I have to ignore the ''
characters.
The error log is the following:
/home/ramy/Documents/C++/Prova/Util.h||In function ‘std::ifstream& Util::operator>> (std::ifstream&, Util::List<T>)’:|
/home/ramy/Documents/C++/Prova/Util.h|431|error: there are no arguments to ‘ignore’ that depend on a template parameter, so a declaration of ‘ignore’ must be available|
/home/ramy/Documents/C++/Prova/Util.h|431|note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)|
||=== Build finished: 1 errors, 0 warnings ===|
See Question&Answers more detail:os