Boost logo

Boost Users :

Subject: Re: [Boost-users] boost replacement for std::ostringstream
From: Szymon Gatner (szymon.gatner_at_[hidden])
Date: 2012-09-07 02:17:14


2012/9/6 Chris Stankevitz <chrisstankevitz_at_[hidden]>:
> Hello,
>
> Does boost provide a replacement for std::ostringstream? If so, can
> you please tell me the name so I can read the docs on it? The first
> thing I am going to read is whether or not such a best would provide
> "reserve". I would like to do this:
>
> //-----
>
> std::ostringstream Stream;
>
> // Stream.reserve(99999); // error: std::ostringstream does not provide reserve
>
> Stream.write(pBuffer, 99999);
>

You could use filtering_ostream with underlying vector and reserve()
on that vector.

Take a look at the very bottom of "container_sink" in Tutorials
section for usage example.

-- 
Szymon Gatner
The Lordz Games Studio
www.thelordzgamesstudio.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net