[libcxx-commits] [libcxx] [libc++] Implement P3168R2: Give optional range support (PR #149441)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 21 21:57:22 PDT 2025
================
@@ -586,8 +614,17 @@ class _LIBCPP_DECLSPEC_EMPTY_BASES optional
private __optional_sfinae_assign_base_t<_Tp> {
using __base _LIBCPP_NODEBUG = __optional_move_assign_base<_Tp>;
+# if _LIBCPP_STD_VER >= 26
+ using pointer = std::add_pointer_t<std::remove_cvref_t<_Tp>>;
+ using const_pointer = std::add_pointer_t<const std::remove_cvref_t<_Tp>>;
+# endif
+
public:
using value_type = _Tp;
+# if _LIBCPP_STD_VER >= 26
+ using iterator = __wrap_iter<pointer>;
----------------
philnik777 wrote:
@ldionne What improvement do you see by providing an `optional`-specific iterator? I don't really see how such an iterator would buy us anything. It would be an improvement for bounds-safety, but that's not provided here anyways.
https://github.com/llvm/llvm-project/pull/149441
More information about the libcxx-commits
mailing list