Hi!
I've been trying to figure this out, but can't seem to find an answer.
Most likely it's some weird bug in my code, but since I don't have
access to the Standard, I wanted to cover my bases.. basically the
situation is that I'm writing a logging facility, class Log. Instances
of the class can be invoked to read a message by using the method
Read() that enables the overloaded op<<. The trick is, Read() does not
necessarily return the Log reference (*this), but a reference to
another object, a Logstream. So the code looks something like
logger.Read() << "This is to be " << "logged.";
return 0;
Now, the problem is: if I return *this in Read(), everything works
fine. However, if I return a Logstream&, the program skips directly to
the return instruction. Even if I disable the op<< for Logstream,
there's no complaint, which suggests that op<< isn't applied to the
result of logger() -but when returning a Log object it is, with all
other code the exact same.
So, the question is: does anyone know of anything in the Standard that
causes this, or is there just a bug in the program -and if so, any
ideas where to look? I'll post followups if I figure it out.