On Sat, July 28, 2007 00:07, Bill Lear wrote: [...]
Well, stringstream defines a type, from g++ header:
typedef basic_string
__string_type; and str() is defined to return this:
__string_type str() { ...}
So, if I have a std::string, and an ostringstream with a different allocator, say my_ostringstream, I cannot do this:
my_ostringstream os; os << ...; std::string s = os.str();
Ok, but you understand that this approach, will probably consume twice as much memory, since str() leaves stream as it is and does not remove characters read. A was meaning this: my_ostringstream os; os << ...; std::string s; os >> s; And this should work with custom allocators in stringstream and string. With Kind Regards, Ovanes Markarian