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

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 1 05:05:36 PDT 2025


================
@@ -976,6 +1070,25 @@ public:
   }
 #    endif // _LIBCPP_STD_VER >= 23
 
+// P3168R2
+#    if _LIBCPP_STD_VER >= 26
+
+  _LIBCPP_HIDE_FROM_ABI iterator begin() {
+    if (!this->has_value())
+      return this->end();
+    return iterator(reinterpret_cast<_Tp*>(this->__get()));
+  }
----------------
dywoq wrote:

Will use static_cast then

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


More information about the libcxx-commits mailing list