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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
diff --git a/include/vector b/include/vector
index 15e00d9..fb92f68 100644
--- a/include/vector
+++ b/include/vector
@@ -400,9 +400,14 @@ public:
typedef typename __alloc_traits::difference_type difference_type;
typedef typename __alloc_traits::pointer pointer;
typedef typename __alloc_traits::const_pointer const_pointer;
+#if _YNDX_LIBCPP_MAKE_VECTOR_ITERATOR_POINTERS == 1
+ typedef pointer iterator;
+ typedef const_pointer const_iterator;
+#else
// TODO: Implement iterator bounds checking without requiring the global database.
typedef __wrap_iter<pointer> iterator;
typedef __wrap_iter<const_pointer> const_iterator;
+#endif
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
@@ -806,12 +811,8 @@ private:
void __append_uninitialized(size_type __n);
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
_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 {
- return iterator(__p);
- }
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator __make_iter(const_pointer __p) const _NOEXCEPT {
- return const_iterator(__p);
- }
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator __make_iter(pointer __p) _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator __make_iter(const_pointer __p) const _NOEXCEPT;
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v);
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer
@@ -1360,6 +1361,28 @@ vector<_Tp, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel
}
}
+// We need to save the make_iter function and replace all constructor calls with it
+// Made to support pointer iterators
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::iterator
+vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT {
+#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1
+ return iterator(__p);
+#else
+ return iterator(this, __p);
+#endif
+}
+
+template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::const_iterator
+vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT {
+#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1
+ return const_iterator(__p);
+#else
+ return const_iterator(this, __p);
+#endif
+}
+
template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u) {
if (__n <= capacity()) {
|