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

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 23 06:10:37 PDT 2025


================
@@ -265,6 +266,11 @@ namespace std {
 _LIBCPP_PUSH_MACROS
 #  include <__undef_macros>
 
+#  if _LIBCPP_STD_VER >= 26
+#    define _LIBCPP_OPT_REF_DELETED_CONS_REQUIRES(_TP, _UP)                                                            \
+      requires(is_lvalue_reference_v<_TP> && reference_constructs_from_temporary_v<_TP, _UP>)
----------------
frederick-vs-ja wrote:

It's clearer to me to introduce a variable template and write `requires __opt_ref_ctor_deleted<_Tp, _Up>`.

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


More information about the libcxx-commits mailing list