[libcxx-commits] [libcxx] [libc++] Implement P3168R2: Give optional range support (PR #149441)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Aug 11 00:32:38 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))> > {
----------------
philnik777 wrote:
Is it even possible to instantiate `optional` with an unbounded array or function reference?
https://github.com/llvm/llvm-project/pull/149441
More information about the libcxx-commits
mailing list