blob: ab4163f0bc9f2b90cd1c62cf85d1237ba400fdb6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
diff --git a/include/vector b/include/vector
index e7aea68..fd58458 100644
--- a/include/vector
+++ b/include/vector
@@ -415,7 +415,10 @@ public:
typedef typename __alloc_traits::difference_type difference_type;
typedef typename __alloc_traits::pointer pointer;
typedef typename __alloc_traits::const_pointer const_pointer;
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR
+#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1
+ typedef pointer iterator;
+ typedef const_pointer const_iterator;
+#elif defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR)
// Users might provide custom allocators, and prior to C++20 we have no existing way to detect whether the allocator's
// pointer type is contiguous (though it has to be by the Standard). Using the wrapper type ensures the iterator is
// considered contiguous.
@@ -860,7 +863,12 @@ private:
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const_reference __x);
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator __make_iter(pointer __p) _NOEXCEPT {
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR
+
+// We need to save the make_iter function and replace all constructor calls with it
+// Made to support pointer iterators
+#if _YNDX_LIBCPP_MAKE_VECTOR_ITERATOR_POINTERS == 0
+ return iterator(this, __p);
+#elif defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR)
// Bound the iterator according to the capacity, rather than the size.
//
// Vector guarantees that iterators stay valid as long as no reallocation occurs even if new elements are inserted
@@ -880,7 +888,9 @@ private:
}
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator __make_iter(const_pointer __p) const _NOEXCEPT {
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR
+#if _YNDX_LIBCPP_MAKE_VECTOR_ITERATOR_POINTERS == 0
+ return const_iterator(this, __p);
+#elif defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR)
// Bound the iterator according to the capacity, rather than the size.
return std::__make_bounded_iter(
std::__wrap_iter<const_pointer>(__p),
|