libstdc++ - version 3 default allocator

Paolo Carlini pcarlini@suse.de
Tue Jul 5 11:19:00 GMT 2005


Sameer Atre wrote:

> How can I get the same behaviour in version 3 of libstdc++ when I want
> to change the default allocator for all containers.

Currently, there isn't an exact replacement, I'm afraid.

Either you build the whole library passing a specific
--enable-libstdcxx-allocator= option (see
http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html) - thus changing
the default allocator for the entire library, not only the containers -
or you include from your code one of the allocators available under /ext
and then pass it to each container as the second template argument. I
would suggest experimenting a bit with the second possibility, as a start.

In general, 4.0.x is much better than any previous release series as far
as allocators are concerned.

Paolo.



More information about the Libstdc++ mailing list