27 Jul
2007
27 Jul
'07
9:11 p.m.
On Friday, July 27, 2007 at 22:49:22 (+0200) Ovanes Markarian writes:
Most of std classes support custom allocators. basic_stringstream and vector do this as well. You can preallocate the memory needed and create objects in this memory locations. For more help see the placement new operator.
Hmm, yes, they do, but they also have a pitfall. If I create a new templated ostringstream with a custom allocator, it then means that the string that is returned also must use this custom allocator, and is incompatible with standard strings. I guess that's not surprising, however, now that I think about it... Bill