From feae3bc202cedbc1e83201eb8ea147f1a7729cd3 Mon Sep 17 00:00:00 2001 From: Nikhil Kotikalapudi Date: Tue, 24 Mar 2026 23:04:14 -0400 Subject: [PATCH] [libc++] Remove non-standard member type iterator_type from __wrap_iter (#186871) Resolves #186801 Removed the non-standard member type `iterator_type` from `__wrap_iter`. This member exposed the underlying iterator type, and its removal prevents users from relying on the implementation detail. --- libcxx/docs/ReleaseNotes/23.rst | 4 ++-- libcxx/include/__iterator/wrap_iter.h | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/libcxx/docs/ReleaseNotes/23.rst b/libcxx/docs/ReleaseNotes/23.rst index 4441a8aed198..9fcb0bbe9830 100644 --- a/libcxx/docs/ReleaseNotes/23.rst +++ b/libcxx/docs/ReleaseNotes/23.rst @@ -55,8 +55,8 @@ Deprecations and Removals - The ``std::launch::any`` enumerator that was accidentally provided as an extension is now deprecated. It will be removed in LLVM 25. -- ``__wrap_iter``'s (iterator type for ``array``, ``span``, ``string``, ``string_view`` and ``vector``) ``base()`` - method has been removed as it was non-standard. +- In ``__wrap_iter`` (iterator wrapper type for ``array``, ``span``, ``string``, ``string_view`` and ``vector``), + the ``base()`` method and ``iterator_type`` member type have been removed as they are non-standard. Potentially breaking changes ---------------------------- diff --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h index c1b27b8242cd..576adfbce384 100644 --- a/libcxx/include/__iterator/wrap_iter.h +++ b/libcxx/include/__iterator/wrap_iter.h @@ -34,18 +34,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD template class __wrap_iter { public: - typedef _Iter iterator_type; - typedef typename iterator_traits::value_type value_type; - typedef typename iterator_traits::difference_type difference_type; - typedef typename iterator_traits::pointer pointer; - typedef typename iterator_traits::reference reference; - typedef typename iterator_traits::iterator_category iterator_category; + typedef typename iterator_traits<_Iter>::value_type value_type; + typedef typename iterator_traits<_Iter>::difference_type difference_type; + typedef typename iterator_traits<_Iter>::pointer pointer; + typedef typename iterator_traits<_Iter>::reference reference; + typedef typename iterator_traits<_Iter>::iterator_category iterator_category; #if _LIBCPP_STD_VER >= 20 typedef contiguous_iterator_tag iterator_concept; #endif private: - iterator_type __i_; + _Iter __i_; friend struct pointer_traits<__wrap_iter<_Iter> >; @@ -103,7 +102,7 @@ public: } private: - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __wrap_iter(iterator_type __x) _NOEXCEPT : __i_(__x) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __wrap_iter(_Iter __x) _NOEXCEPT : __i_(__x) {} template friend class __wrap_iter;