[libcxx-commits] [libcxx] [libc++] Make lazy three way comparator optimization apply in older standard modes (PR #218525)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 25 01:06:54 PDT 2026


================
@@ -713,16 +714,16 @@ template <class _MapValueT, class _Key, class _TransparentKey, class _Compare>
 struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _MapValueT, _TransparentKey> {
   __lazy_synth_three_way_comparator<_Compare, _Key, _TransparentKey> __comp_;
 
-  __lazy_synth_three_way_comparator(
+  _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_synth_three_way_comparator(
       _LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp)
       : __comp_(__comp.key_comp()) {}
 
-  _LIBCPP_HIDE_FROM_ABI auto
-  operator()(_LIBCPP_LIFETIMEBOUND const _MapValueT& __lhs, _LIBCPP_LIFETIMEBOUND const _TransparentKey& __rhs) const {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 auto
+  operator()(_LIBCPP_LIFETIMEBOUND const _MapValueT& __lhs, _LIBCPP_LIFETIMEBOUND const _TransparentKey& __rhs) const
+      -> decltype(__comp_(__lhs.first, __rhs)) {
----------------
philnik777 wrote:

Do we really care to back-port it all the way back to C++03? C++11 seems more than enough to me.

https://github.com/llvm/llvm-project/pull/218525


More information about the libcxx-commits mailing list