[PATCH] PR 95079 Improve unordered_map insert_or_assign and try_emplace

Jonathan Wakely jwakely@redhat.com
Fri May 29 09:53:27 GMT 2020


On 29/05/20 10:18 +0200, François Dumont via Libstdc++ wrote:
>I added a try_emplace at the underlying _Hashtable level which I use 
>in both insert_or_assign and try_emplace.
>
>I am not making any use of the hint for the moment. I'll review this 
>once my other hashtable patches are being validated.
>
>            PR libstdc++/95079
>            * include/bits/hashtable_policy.h 
>(_Insert_base<>::try_emplace): New.
>            * include/bits/unordered_map.h 
>(unordered_map<>::try_emplace): Adapt.
>            (unordered_map<>::insert_or_assign): Adapt.
>
>Tested under Linux x86_64.
>
>Ok to commit ?
>
>François
>

>diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
>index ef120134914..5c6c81bcf21 100644
>--- a/libstdc++-v3/include/bits/hashtable_policy.h
>+++ b/libstdc++-v3/include/bits/hashtable_policy.h
>@@ -848,6 +848,28 @@ namespace __detail
> 	return __h._M_insert(__hint, __v, __node_gen, __unique_keys());
>       }
> 
>+      template <typename _KType, typename... _Args>

Our coding conventions say no space in "template <" here.


Otherwise looks great, thanks.

OK for master. Please be aware of the new ChangeLog policy I forwarded
to the mailing list the other day.




More information about the Libstdc++ mailing list