ostringstream buffers (was Re: stringstream status)
Jim Gewin
jgewin@worldnet.att.net
Tue Jun 1 12:43:00 GMT 1999
"Edwards, Phil" wrote:
>
> + Well, could we please go with the sane:
> +
> + > ostringstream o;
> + > o << stuff << more stuff << stuff << ends;
> + > return o.str();
> +
> + ... even if it seems to have been overlooked in the standard?
>
> Let me toss out an idea: I'll post this problem to comp.std.c++ and
> we'll get some feedback before anything gets decided? The more I think
> about it, the more I become convinced that Stroustrup's example above
> is the sane way to go -- which makes me wonder even more what was the
> rationale behind the committee's decision (i.e., what am I missing).
>
> Phil
> "...the road to good intentions must always be paved with hell."
> - Igor Stravinsky
I've implemented stringbuf, and the way I read it is
that the first time overflow is called, a string (or
some buffer) should be allocated in the stringbuf.
See 27.7.1.3/8. Also the example at 22.2.8/9 sure
seems to imply this behavior.
More information about the Libstdc++
mailing list