[libc++] Assume that __wrap_iter always wraps a fancy pointer.
Not only do we conscientiously avoid using `__wrap_iter` for non-contiguous
iterators (in vector, string, span...) but also we make the assumption
(in regex) that `__wrap_iter<_Iter>` is contiguous for all `_Iter`.
So `__wrap_iter<reverse_iterator<int*>>` should be considered IFNDR,
and every `__wrap_iter` should correctly advertise contiguity in C++20.
Drive-by simplify some type traits.
Reviewed as part of https://reviews.llvm.org/D102781
NOKEYCHECK=True
GitOrigin-RevId: fc9248877d07132981f2d598d3684de81d12d0b8
diff --git a/include/iterator b/include/iterator
index 6bc98ec..e3d1360 100644
--- a/include/iterator
+++ b/include/iterator
@@ -1294,8 +1294,7 @@
typedef typename iterator_traits<iterator_type>::reference reference;
typedef typename iterator_traits<iterator_type>::iterator_category iterator_category;
#if _LIBCPP_STD_VER > 17
- typedef _If<__is_cpp17_contiguous_iterator<_Iter>::value,
- contiguous_iterator_tag, iterator_category> iterator_concept;
+ typedef contiguous_iterator_tag iterator_concept;
#endif
private:
@@ -1473,12 +1472,12 @@
#if _LIBCPP_STD_VER <= 17
template <class _It>
-struct __is_cpp17_contiguous_iterator<__wrap_iter<_It> > : __is_cpp17_contiguous_iterator<_It> {};
+struct __is_cpp17_contiguous_iterator<__wrap_iter<_It> > : true_type {};
#endif
template <class _Iter>
_LIBCPP_CONSTEXPR
-_EnableIf<__is_cpp17_contiguous_iterator<_Iter>::value, decltype(_VSTD::__to_address(declval<_Iter>()))>
+decltype(_VSTD::__to_address(declval<_Iter>()))
__to_address(__wrap_iter<_Iter> __w) _NOEXCEPT {
return _VSTD::__to_address(__w.base());
}