[libcxx-commits] [libcxx] [libc++] Reimplement `optional<T&>` as a partial specialization (PR #201983)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 9 02:11:44 PDT 2026
================
@@ -1343,24 +1220,137 @@ public:
# endif // _LIBCPP_STD_VER >= 23
using __base::reset;
+};
-// optional<T&> overloads
# if _LIBCPP_STD_VER >= 26
+template <class _Tp>
+class optional<_Tp&> : public __optional_iterator_base<_Tp&> {
----------------
philnik777 wrote:
Why do we use the bases here? Can't we just have a pointer in the specialization instead? That would save a bunch of template instantiations.
https://github.com/llvm/llvm-project/pull/201983
More information about the libcxx-commits
mailing list