[libcxx-commits] [libcxx] [libc++] P3379R1: Constrain `std::expected` equality operators (PR #117664)
Xiaoyang Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Nov 30 18:36:32 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>;
----------------
xiaoyang-sde wrote:
It seems we used `__boolean_testable` to implement the constraints for `operator==` in `std::reference_wrapper`. (https://github.com/llvm/llvm-project/blob/main/libcxx/include/__functional/reference_wrapper.h#L75-L81)
Should we consider making them consistent?
https://github.com/llvm/llvm-project/pull/117664
More information about the libcxx-commits
mailing list