[libcxx-commits] [PATCH] D128021: [libc++] Don't call key_eq in unordered_map/set rehashing routine
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jun 17 10:15:34 PDT 2022
Mordante added a comment.
Thanks for your contribution! I'll have another look after all comment have been addressed.
================
Comment at: libcxx/include/__hash_table:863
-template <class _Tp, class _Hash, class _Equal, class _Alloc>
-class __hash_table
-{
+template <bool _Unique_Keys>
+struct __hash_table_traits {
----------------
Can you add some comment why these traits are needed? The reason is in the commit message, but not in the code.
================
Comment at: libcxx/include/__hash_table:865
+struct __hash_table_traits {
+ typedef integral_constant<bool, _Unique_Keys> __unique_keys;
+};
----------------
Nowadays we tend to use `using` instead of `typedef`. This works for all supported compilers in C++98/C++03 mode.
================
Comment at: libcxx/include/__hash_table:868
+
+template <class _Tp, class _Hash, class _Equal, class _Alloc, class _Traits>
+class __hash_table {
----------------
I'm not fond of name `_Traits` it very generic. How about `_UniqueKeys`?
================
Comment at: libcxx/include/unordered_map:1034
- typedef __hash_table<__value_type, __hasher,
- __key_equal, __allocator_type> __table;
+ typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type, __hash_table_traits<true >> __table;
----------------
As an extension we add `unordered_map` to C++03.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128021/new/
https://reviews.llvm.org/D128021
More information about the libcxx-commits
mailing list