This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

thoughts on ext/allocators


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

Attachment: p.20031218-2.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]