[libcxx-commits] [libcxx] [libc++] Implement P2988R12: `std::optional<T&>` (PR #155202)
William Tran-Viet via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Nov 8 11:19:31 PST 2025
smallp-o-p wrote:
> Oh... I forgot the following partial specialization. Looks like that it isn't added yet.
>
> ```c++
> template<class T>
> constexpr bool ranges::enable_borrowed_range<optional<T&>> = true;
> ```
>
> I think we should test that
>
> * `ranges::enable_borrowed_range<optional<T&>>` is `true` for all `T`, even if `T` is an array of unknown bound or a function type;
>
> * `ranges::borrow_range<optional<T&>>` is `true` if and only if `ranges::range<optional<T&>>` is `true`. It should be `false` when `T` is a function type.
I believe `ranges::borrow_range<optional<T&>>` should also be false if `T` is an array type, at least until LWG4308 is accepted, which I currently don't think should be tackled in this PR.
https://github.com/llvm/llvm-project/pull/155202
More information about the libcxx-commits
mailing list