[libcxx-commits] [libcxx] [libc++] P3379R1: Constrain `std::expected` equality operators (PR #117664)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 25 21:50:39 PST 2024


================
@@ -1139,7 +1140,11 @@ class expected : private __expected_base<_Tp, _Err> {
 
   // [expected.object.eq], equality operators
   template <class _T2, class _E2>
-    requires(!is_void_v<_T2>)
+    requires(!is_void_v<_T2> &&
+             requires(const _Tp& __tp, const _T2& __t2, const _Err& __err, const _E2& __e2) {
+               { __tp == __t2 } -> convertible_to<bool>;
----------------
frederick-vs-ja wrote:

The `convertible_to` concept is stricter than the plain "(implicitly) convertible to". The latter can be expressed by `__is_core_convertible` in `<__type_traits/is_core_convertible.h>`.

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


More information about the libcxx-commits mailing list