I'm currently working on Pandromeda's MojoWorld project.
We're using Microsoft VC++6.0.
Within MojoWorld, we use ostreams to save the state of our planet. This works fine for saving to ofstreams.
(When saving a planet to a file).
We also have a log, which users can save states of planets while they're changing them. So to do this we use (binary) ostringstreams, and so just store this log of states as a vector or strings.
This works fine for small files ( < 1meg) but when we have meshes in our planes, file sizes can quickly grow to >4 megs. As a result the ostringstream grinds to a very (extremly) slow crawl. ( around >~1.5megs ).
I suspect this is because we havn't preallocated memory and the memory allocation scheme in the stings is slow for >1.5megs.
How can I preallocate memory for a ostringstream?? I've tried preallocating a string and then passing it in the constructor for ostringstream, but it seems to just clear it and start from scratch again!
I want to avoid having to create my own allocator object as this seems like it should be a simple operation.....