I am compiling an outdated project with my latest gcc g++ compilers, (version > 6)
There is a class CodeWriter
with an ostream
reference variable.
class CodeWriter
{
//private:
protected:
ostream &m_stream;
public:
CodeWriter(ostream &stream):m_stream(stream){}
~CodeWriter(){
if(m_stream != NULL){
m_stream.flush();
}
}
};
The class is quite large so i included only the relevant variables and functions.
As you can see the destructor seems to be comparing the reference to NULL
. This project compiled i when i used it long back with old gnu toolchain.
But now it is throwing an error saying that there is no matching operator != to compare ostream
and long int
.
Can anyone explain the rationale behind the comparison, and how i can fix this.
I would be happy to provide additional information/ include the whole class if required.
Aucun commentaire:
Enregistrer un commentaire