Topic: Question on string allocator


Author: "Erwin Malagar" <uunet!hotmail!erwin315@ncar.UCAR.EDU>
Date: 1999/04/30
Raw View
STL string currently allocates its buffer in increments of
BufferSize=(32xN)-1 until BufferSize is > LengthOfString to assign.

Since my current application only assign once, and read only, it is safe to
assume that this applicaiton will never append to the string, thus the
string dont need to allocate a buffer size greater than the length of the
actual string assigned.

Is it possible to modify STL string's allocator to only allocate up to the
size of the string (plus memory alignment)?  An example code would be handy
if this is possible.

Thanks in advance :)




[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]