I have overloaded the << operator here. I tried printing out the object in my main class and it looks perfect. The problem is when I try to pass that object to stringstream, the string stream object gives me empty.
Asked
Active
Viewed 22 times
-2
-
Please your `TimeSpan` class code – Sisir Oct 12 '19 at 19:09
-
1Please post code *in the question*. Firstly, so that others can cut and paste it into an IDE and secondly so that it has the same life-time as the question. – marko Oct 12 '19 at 19:26
1 Answers
0
Your operator<<(ostream& output, ...)
ignores its output
parameter, and always prints to std::cout
. output
stream is left unchanged (except when it happens to also refer to std::cout
).

Igor Tandetnik
- 50,461
- 4
- 56
- 85