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

Yanzuo Liu via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 1 08:04:07 PDT 2025


================
@@ -588,6 +723,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<_Tp>;
----------------
zwuis wrote:

The reference type for `const_iterator` is `const _Tp&`.

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


More information about the libcxx-commits mailing list