[libcxx-commits] [libcxx] [libc++] Implement a type-safe iterator for optional (PR #154239)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 5 08:57:54 PST 2025


================
@@ -688,52 +688,53 @@ private:
   using __pointer _LIBCPP_NODEBUG       = add_pointer_t<remove_reference_t<_Tp>>;
   using __const_pointer _LIBCPP_NODEBUG = add_pointer_t<const remove_reference_t<_Tp>>;
 
-public:
 #    if _LIBCPP_STD_VER >= 26
+  template <typename _Underlying>
+  using __iter _LIBCPP_NODEBUG = __upper_bounded_iterator<_Underlying, __optional_iterator, 1>;
----------------
ldionne wrote:

Should you be passing `__optional_iterator`? The template parameter is `_Container`, so we should arguably be passing `optional<_Tp>` instead?

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


More information about the libcxx-commits mailing list