[libcxx-commits] [libcxx] [libc++] Optimize most of the __tree search algorithms (PR #155245)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 28 08:52:30 PDT 2025
================
@@ -702,6 +703,41 @@ public:
# endif
};
+# if _LIBCPP_STD_VER >= 14
+template <class _CP, class _Key, class _Compare>
+struct __three_way_comparator<__map_value_compare<_Key, _CP, _Compare>, _CP, _CP> {
+ __three_way_comparator<_Compare, _Key, _Key> __comp_;
+
+ __three_way_comparator(const __map_value_compare<_Key, _CP, _Compare>& __comp) : __comp_(__comp.key_comp()) {}
+
+ _LIBCPP_HIDE_FROM_ABI auto operator()(const _CP& __lhs, const _CP& __rhs) const {
+ return __comp_(__lhs.first, __rhs.first);
+ }
+};
+
+template <class _CP, class _Key, class _Key2, class _Compare>
----------------
ldionne wrote:
```suggestion
template <class _CP, class _Key, class _TransparentKey, class _Compare>
```
How about that? It's longer but it explains why we need another template param.
https://github.com/llvm/llvm-project/pull/155245
More information about the libcxx-commits
mailing list