I've been using an overload for QDebug
with msvc2010
for a while:
friend QDebug &operator<<(QDebug &debug, const UsingClass &uc)
{
debug << uc.stringForStreaming();
return debug;
}
However, under MinGW
with gcc 4.6.2
this signature is not recognized and I have to change it to (no reference &):
friend QDebug operator<<(QDebug debug, const UsingClass &uc)
{
debug << uc.stringForStreaming();
return debug;
}
This suprises me somehow, since I have checked the headerfile for QDebug
and the signatures there are basically references.
- So what is the correct signature for overloading operators with
QDebug
? SO: How to overload operator<< for qDebug shows the one without reference, but does not tell why (different focus). - Why is the first signature (&) working with msvc2010, but fails with gcc?