[libcxx-commits] [libcxx] [libc++] P3379R1: Constrain `std::expected` equality operators (PR #117664)
Jonathan Wakely via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 10 01:00:13 PDT 2025
jwakely wrote:
> And P3379R0 is the paper. libstdc++ treated it as DR against C++23 ([gcc-mirror/gcc at 0515b24](https://github.com/gcc-mirror/gcc/commit/0515b2436b7c7e5e391eae7edc42173c52bab61d)).
I think the constrained comparisons for `expected` should be consistent with the constrained comparisons for `tuple`, `optional` and `variant` added by P2944R3, i.e. all those constrained comparisons should both be treated as DRs or none of them.
For libstdc++ we also treated the tuple/optional/variant parts of P2944 as a DR against C++20. I didn't apply them further back because without defaulted comparisons I don't think it really matters whether the comparisons are constrained (and because I'm lazy and I didn't want to implement the constraints without concepts and spaceship). So for consistency, I treated the `expected` constrained comparisons as a DR too (but only to C++23 because `expected` isnt' in C++20).
I did _not_ add comparisons for `reference_wrapper` as a DR. That's a more significant API change, but I consider constraining existing comparisons to be just a nice QoI improvement (we already constrained some of the `optional` comparisons even before P2944).
P2944 should probably have been two separate papers, instead of adding new comparisons and also constraining existing ones as a drive-by fix.
https://github.com/llvm/llvm-project/pull/117664
More information about the libcxx-commits
mailing list