Sign in to follow this  
dmatter

interesting ostream question

Recommended Posts

dmatter    4844
After reading this page about operator<< for ostreams, I noticed that there aren't any overloads for const references. So how then does an ostream handle code like this?:
writer << "some text\n";
writer << 1234;
Notice how 1234 is a const int, so how does that work? Just curious is all [wink]

Share this post


Link to post
Share on other sites
SiCrane    11839
Simple. The page you linked to is wrong. The insertion operator for an ostream takes an int argument not an int reference.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this