Hum, I know that the best way to overload the << operator is using an external function.
ostream& operator<<(ostream &os, const myClass &mc)
{
return os << myClass.whatever;
}
ostream& operator<<(ostream &os, const myClass &mc)
{
return os << myClass.whatever;
}
To copy to clipboard, switch view to plain text mode
And declare that function as a friend of the class
Class myClass
{
friend ostream& operator<<(ostream &os, const myClass &mc);
//etc
};
Class myClass
{
friend ostream& operator<<(ostream &os, const myClass &mc);
//etc
};
To copy to clipboard, switch view to plain text mode
I know templates are a little different though, and I don't know if I can use qDebug() just like an STL ostream.
Bookmarks