Limit template parameters in hashtable

Jonathan Wakely jwakely.gcc@gmail.com
Tue Jul 16 09:03:00 GMT 2013


On 15 July 2013 21:36, François Dumont wrote:
> Hi
>
>     Here is a patch proposal to limit number of template parameters in
> recently introduced _ReuseOrAllocNode and _AllocNode types. I hope it is
> what you had in mind Jonathan. I have isolated most of allocation code into
> a new _Hashtable_alloc class and inherit from it in _Hashtable. It greatly
> reduce the number of template parameters for a number of methods that used
> to be in _Hashtable.

Yes, that's what I was thinking, thanks for doing it.  Would it be
possible to rebind the allocator before instantiating _Hashtable, and
have _Hastable_alloc<_Alloc, __cache> and get the value_type from the
allocator?  That would mean these two specializations would share more
code:

unordered_map<int, int, P, C, allocator<pair<int,int>>>

unordered_map<int, int, P, C, allocator<pair<const int,int>>>

because they would both use the same specialization of _Hashtable and
_Hashtable_alloc.

If that makes change too complicated it isn't essential.


>     The drawback is of course that it introduces a binary breaking change,
> is it fine ?

Did we already do that for 4.9 anyway?



More information about the Libstdc++ mailing list