const reference to stream object

Hi,everyone.
I am trying to use stream object reference as function arguments,like this:

void fun(const ostream& os, const istream& is);

but it keeps to give me errors. I remove the two const things works fine. How to understand this? As when we overload the <<(or >>) operators, we usually add const to stream objects. Thanks a lot.
No, you don't. If it's const, you wouldn't be able to stream anything to it. >_>
Right. Passing by const reference means you won't change the state of the object.

using << and >> either inserts or removes content from the stream. This alters its state -- which means you can't do it with a const object.
yes, that's right. I just checked old codes, I don't use const when overload operator <<
I may too love const :) thanks for clarifying.
Topic archived. No new replies allowed.