libstdc++: Review unordered_map insert_or_assign/try_emplace (PR 95079)
authorFrançois Dumont <fdumont@gcc.gnu.org>
Sun, 24 May 2020 10:04:38 +0000 (12:04 +0200)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Fri, 29 May 2020 11:12:36 +0000 (13:12 +0200)
commit7688e5e8c4d46102a0cc0b9c25191ac7dde0d285
tree6b2ea4cd581aa9dc529a6fe99c1377f5c70914d8
parentc735929a2503a7d03ac4739bba5b25336bf954c3
libstdc++: Review unordered_map insert_or_assign/try_emplace (PR 95079)

Those methods are making a double lookup in case of insertion, they can
perform only one.

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.
libstdc++-v3/include/bits/hashtable_policy.h
libstdc++-v3/include/bits/unordered_map.h