thoughts on ext/allocators
Benjamin Kosnik
bkoz@redhat.com
Thu Dec 18 21:03:00 GMT 2003
Matt indicated:
>3. Remove _Alloc_traits, and remove all support for the old
>pre-standard SGI allocator interface.
As part of this, I'm thinking that the /ext/allocator files should just
be written as allocators, or be derived from std::allocator. Thoughts?
It would be nice for the extension allocators that are shipped with v3
to be correct, and in working order.
As it stands, the extension classes like __mt_alloc, etc were used as
underlying allocator classes. I think a better way to go might be just
to do them as full-fledged allocators.
#include <list>
#include <ext/mt_allocator.h>
#include <ext/new_allocator.h>
#include <ext/malloc_allocator.h>
#include <pthread.h>
unsigned n = 10000000;
void* do_inserts(void * args_)
{
//typedef __gnu_cxx::__mt_alloc<0> allocator_type;
//typedef __gnu_cxx::__malloc_alloc<0> allocator_type;
typedef __gnu_cxx::new_allocator<unsigned int> allocator_type;
typedef std::list<unsigned int, allocator_type> list_type;
list_type l;
for (unsigned int i = 0; i < n; ++i)
l.push_back(i);
}
Here's a workup, not using derivation, just to stimulate conversation.
-benjamin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p.20031218-2.patch
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20031218/975d12cd/attachment.ksh>
More information about the Libstdc++
mailing list