S
schoedl
Hello,
we often compose strings via a ostringstream and then create a string
from it. What is the rationale of not being able to use string in
place of a ostringstream, so I could write
string str;
str << ... << ...;
SomeAPI( str.c_str() );
Strangely enough, there is an string:perator+= that lets me
concatenate strings. Isn't ostringstream:perator<< also implemented
such that it first finds out the potential length of its argument,
then makes sure its buffer is long enough, and then lets the argument
fill the buffer with its representation? Wouldn't the same work just
as efficiently for string?
Thanks for insights,
Arno
we often compose strings via a ostringstream and then create a string
from it. What is the rationale of not being able to use string in
place of a ostringstream, so I could write
string str;
str << ... << ...;
SomeAPI( str.c_str() );
Strangely enough, there is an string:perator+= that lets me
concatenate strings. Isn't ostringstream:perator<< also implemented
such that it first finds out the potential length of its argument,
then makes sure its buffer is long enough, and then lets the argument
fill the buffer with its representation? Wouldn't the same work just
as efficiently for string?
Thanks for insights,
Arno