[libcxx-commits] [libcxx] [libc++] P2944R3: Constrained comparisions - `variant` and `tuple` (PR #141396)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 24 01:44:50 PDT 2025


================
@@ -1153,9 +1154,16 @@ struct __tuple_equal<0> {
 };
 
 template <class... _Tp, class... _Up>
+#    if _LIBCPP_STD_VER >= 26
+  requires(requires(const _Tp& __t, const _Up& __u) {
+            { __t == __u } -> __boolean_testable;
+          } && ...) && (sizeof...(_Tp) == sizeof...(_Up))
+#    endif
 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
 operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) {
+#    if _LIBCPP_STD_VER < 26
   static_assert(sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes");
+#    endif
----------------
Zingam wrote:

>From a maintainace point of view IMO this guard tells that if in year 2042, C++29 becomes the min supported mode, this could be easily removed.
Anyway I will remove the guard.

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


More information about the libcxx-commits mailing list