I know all kinds of ostreams holds their own internal buffers. I have to know whether there is some kind of ostream which accept an instance std::string and write on that instance.
(I want to avoid redundant copies)
Note: My question is about the standard library, don't offer me other libraries that can do that, I know they exist. :)
Edit: After a request to be more specific ... Here is what I want, consider the following code:
std::string str = "bla bla bla ";
std::ospecialstream o(str);
o << 34 << " bla bla";
std::cout << str; //console output : "bla bla bla 34 bla bla"
I want ospecialstream such that it won't copy str contents into some internal buffer but rather write to the same instance of str.
Edit #2 I need it for performece reasons , ostringstream will make a memcopy when created with a string and will also make a memcpy when the contents are retrieved.