[libcxx-commits] [libcxx] [libc++] Implement P3168R2: Give optional range support (PR #149441)

William Tran-Viet via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 11 06:21:32 PDT 2025


================
@@ -579,16 +607,49 @@ struct __is_std_optional : false_type {};
 template <class _Tp>
 struct __is_std_optional<optional<_Tp>> : true_type {};
 
+template <class _Tp, class = void>
+struct __optional_iterator_aliases {};
+
+#    if _LIBCPP_STD_VER >= 26
+// disallow T (&)() and T (&)[]
+template <class _Tp>
+struct __optional_iterator_aliases<
+    _Tp,
+    __enable_if_t<!(is_reference<_Tp>::value && (is_function<__libcpp_remove_reference_t<_Tp>>::value ||
+                                                 is_unbounded_array<__libcpp_remove_reference_t<_Tp>>::value))> > {
----------------
smallp-o-p wrote:

Not at the moment, since those would fall under `optional<T&>` which is unimplemented, but since I plan on tackling that later on and the potential issue was mentioned here, I might as well get this out of the way beforehand. 

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


More information about the libcxx-commits mailing list