Well considering what Subsonics wrote
And considering the related code, your post was only tangentially related to why Subsonics approach would not work.Quote:
Yes, but my understanding was that for chaining in general to work, you was required to return a reference. So, if my ++ operator did not return one it would affect other operators as well
Breaking down again how this works:
cout << d++ << c;
cout.operator<<(cout, d.operator++(int)).operator<<(cout, c);
Probably not how it really folds out, but that's not the point.
There is no situation where operator++ handles the chaining because cout -- an entirely different object -- is what is being "passed down" from operator to operator. So an in-depth explanation of chaining workings seemed off-topic to me. I hope that with my earlier post it became clear what d's role was in the chaining process, and how increment was really no part of it at all. So in this case, operator++(int) returning a reference or a value is neither here nor there. With this, I hope absolutely everyone understands.