[libcxx-commits] [libcxx] [libc++] Implement P2988R12: `std::optional<T&>` (PR #155202)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sun Oct 26 09:12:04 PDT 2025


https://github.com/frederick-vs-ja requested changes to this pull request.

Ah. I was too rushed to approve this. You seemed missed modifications of `swap` functions (both member and non-member ones) and `make_optional`.

We should verify
- that `optional<T&>::swap` is always `noexcept` and only swap the internal pointers, and
- that `std::swap` for `optional<T&>` behaves same as `optional<T&>::swap`, and
- the constraints of the `std::swap`, and
- modification to `std::make_optional`, especially that `std::make_optional<X&>(x)` can call different overloads until and since C++26.

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


More information about the libcxx-commits mailing list