[libcxx-commits] [libcxx] [libc++] Optimize std::lexicographical_compare_three_way (PR #230336)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sun Oct 11 18:17:42 PDT 2026


================
@@ -62,6 +70,28 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __lexicographical_compare_three_way_fast_pa
   return __len1 <=> __len2;
 }
 
+template <class _Tp,
+          class _Cmp,
+          __enable_if_t<__desugars_to_v<__compare_three_way_tag, _Cmp, _Tp, _Tp> && !is_volatile<_Tp>::value &&
+                            __is_trivially_equality_comparable_v<_Tp, _Tp>,
----------------
frederick-vs-ja wrote:

As these stuffs are available only since C++20, can we avoid such SFINAE tricks and use `if constexpr` instead?

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


More information about the libcxx-commits mailing list