stl_vector.h?!? (Re: [libstdc++] PATCH: STL allocator cleanup, part 1)

Matt Austern austern@apple.com
Fri Dec 19 18:57:00 GMT 2003


On Dec 19, 2003, at 2:07 AM, Paolo Carlini wrote:

> Matt Austern wrote:
>
>> Thanks!  I've now checked in the changes to list, vector, deque, and 
>> the four hash containers.  I'll do vector<bool>, the four associative 
>> containers, and slist next.
>
> Great!
> Matt, it looks like there is something wrong with the stl_vector.h 
> changes... Running 'make check-performance' I get:

And actually, I see that the problem is actually a little bit bigger 
than I thought: it's not that the testsuite is incorrectly using the 
wrong allocator interface, it's that the allocators in the ext 
directory don't provide the standard interface at all.  That's ugly.  
Among other things, it means that they can't be used with third-party 
containers.

The simplest solution is to do a bit of typedef hackery to define the 
public interface to the extension allocators in terms of the 
__allocator adapter.  But that's a bit convoluted; there isn't really a 
good reason to leave any trace of the old SGI interface around.  So 
this probably calls for a bit of cleanup.

One issue: at present the names of the nonstandard allocators are 
__debug_alloc, __pool_alloc, __mt_alloc, __new_alloc, and 
__malloc_alloc.  Why the double underscores?  They're already in the 
__gnu_cxx namespace, and they aren't included in any standard headers.  
(__pool_alloc is included in <memory>, but that's just an 
implementation artifact.  It shouldn't be.)

When I give these allocators standard interfaces, I'd like to change 
their names too.  Would anyone object to names like debug_allocator, 
pool_allocator, mt_allocator, new_allocator, and malloc_allocator?

			--Matt



More information about the Libstdc++ mailing list