[libcxx-commits] [libcxx] [libc++] P3168R2 Give std::optional Range Support (PR #146491)

Yanzuo Liu via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 2 00:46:36 PDT 2025


================
@@ -588,6 +725,13 @@ class _LIBCPP_DECLSPEC_EMPTY_BASES optional
 public:
   using value_type = _Tp;
 
+#    if _LIBCPP_STD_VER >= 26
+
+  using iterator       = __optional_iterator<_Tp>;
+  using const_iterator = __optional_iterator<const _Tp&>;
----------------
zwuis wrote:

Did you mean `__optional_iterator<const _Tp>`?

This needs tests as well.

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


More information about the libcxx-commits mailing list