Я давно не кодировал в C ++ и пытаюсь исправить какой-то старый код.
Я получаю сообщение об ошибке:
TOutputFile& TOutputFile::operator<<(TOutputFile&, T)' must have exactly one argument
на следующемкод:
template<class T>
TOutputFile &operator<<(TOutputFile &OutFile, T& a);
class TOutputFile : public Tiofile{
public:
TOutputFile (std::string AFileName);
~TOutputFile (void) {delete FFileID;}
//close file
void close (void) {
if (isopened()) {
FFileID->close();
Tiofile::close();
}
}
//open file
void open (void) {
if (!isopened()) {
FFileID->open(FFileName, std::ios::out);
Tiofile::open();
}
}
template<class T>
TOutputFile &operator<<(TOutputFile &OutFile, const T a){
*OutFile.FFileID<<a;
return OutFile;
}
protected:
void writevalues (Array<TSequence*> &Flds);
private:
std::ofstream * FFileID;
};
Что не так с перегрузкой этого оператора?