S
soy.hohe
Hi all
I have a class StreamLogger which implements operator << in this way:
template <class T> StreamLogger& operator<<(const T& t)
{
<print the stuff using fstream, etc.>
return *this;
}
It works perfectly, using it like:
m_logger << "My ID is " << getID() << "\n";
but for some reason it does not compile this code:
m_logger << std::endl;
It gives the following error:
--------------------------------------------------------------------------------
..\src\Dealer.cpp(70) : error C2678: binary '<<' : no operator found
which takes a left-hand operand of type 'StreamLogger' (or there is no
acceptable conversion)
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include
\afx.h(1428): could be 'CDumpContext &operator <<(CDumpContext
&,ATL::CTimeSpan)'
....
--------------------------------------------------------------------------------
Could you guys help me understand why it doesn't compile? (because I
dont have a clue...)
Thanks!!!
Jorge
I have a class StreamLogger which implements operator << in this way:
template <class T> StreamLogger& operator<<(const T& t)
{
<print the stuff using fstream, etc.>
return *this;
}
It works perfectly, using it like:
m_logger << "My ID is " << getID() << "\n";
but for some reason it does not compile this code:
m_logger << std::endl;
It gives the following error:
--------------------------------------------------------------------------------
..\src\Dealer.cpp(70) : error C2678: binary '<<' : no operator found
which takes a left-hand operand of type 'StreamLogger' (or there is no
acceptable conversion)
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include
\afx.h(1428): could be 'CDumpContext &operator <<(CDumpContext
&,ATL::CTimeSpan)'
....
--------------------------------------------------------------------------------
Could you guys help me understand why it doesn't compile? (because I
dont have a clue...)
Thanks!!!
Jorge