>it will still work if i don't pass it by reference ( if i pass cout, not an ostringstream object )
If you use operator<< then you're passing the stream object by reference whether it seems that way or not.
>it will still work if i don't pass it by reference ( if i pass cout, not an ostringstream object )
If you use operator<< then you're passing the stream object by reference whether it seems that way or not.
My best code is written with the delete key.
>why the standard doesn't allow me to remove that referece?
I don't know, why don't you ask them? Go to comp.std.c++ and ask that same question. I'm sure some of the committee members floating around there will tell you why.
My best code is written with the delete key.
>But ypu are ABSOLUTELY sure that the standard says so?
I can't quote line and verse from memory if that's what you mean, though I'm quite sure. But I'm not about to go rooting through the standard for that tiny tidbit of information to verify it. If you want to get the standard and prove me wrong then by all means, do so.
My best code is written with the delete key.
Why on earth would you want to take in a copy of the stream? If you remove the reference **&**, then a copy is made. What's the point of adding data to a stream when it is just a copy? The stream in the code that calls the operator << won't get modified, only the copy will. So basically your operator<< will do nothing without the stream parameter being a reference.No it won't work, only the copy will get modified, and the original stream will be unchanged.Originally Posted by C+++C_foreverI wouldn't underestimate the abilities of the people who work on those kinds of things. It might be a better idea to always assume you are the one who is wrong if you disagree. Then you'll be right 99.9% of the time.Originally Posted by C+++C_forever