Hashtable PR96088 Work in Progress

François Dumont frs.dumont@gmail.com
Tue Sep 1 12:36:20 GMT 2020


Hi

     I started working on PR96088 problem in Hashtable implementation.

     In the case of multi-key containers the problem is easy to manage. 
Now that we have _Scoped_node we can easily allocate the node first and 
then extract the key from it to compute hash code. It is quite safe as 
computating a hash code is rarely going to throw especially if there is 
no allocation anymore to invoke the hasher.

     In the unique-key case it is more tricky. First I only consider the 
hasher invocation, the equal_to shall be consistent with it. My approach 
is to consider that if the operation needed transform the inserted 
element key part into the hasher argument can throw then I better 
generate a key_type instance myself and move it to the node if it is 
eventually to be inserted. Note that any allocation needed to call the 
hasher from the key_type is user fault.

     Of course the tricky part here is to find out what is the hasher 
argument_type. For the moment I support hasher with a nested 
argument_type typedef and function pointer. But, as pointed out by the 
tests which are failing for the moment I am missing the support for a 
classic functor. I am pretty sure that if I support it I will still be 
missing some use cases (like std::function). So I am looking for help on 
how to determine it. Or maybe the whole approach it wrong ?

For now I am still working on it, thanks,

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr96088.patch
Type: text/x-patch
Size: 19300 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20200901/b9ee9b97/attachment-0001.bin>


More information about the Libstdc++ mailing list