• Advertisement
Sign in to follow this  

interesting ostream question

This topic is 4472 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
Sign in to follow this  

  • Advertisement