aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxxcuda11/patches/66-vector-iterator-pointer.patch
blob: d86947dacf0cecda342df79016269b5820f139d0 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
diff --git a/include/vector b/include/vector
index 559b7fd..659b035 100644
--- a/include/vector
+++ b/include/vector
@@ -396,9 +396,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;
 
@@ -823,9 +828,9 @@ private:
     _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); }
+    iterator       __make_iter(pointer __p) _NOEXCEPT;
     _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
-    const_iterator __make_iter(const_pointer __p) const _NOEXCEPT { return const_iterator(__p); }
+    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 __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p);
     _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_range(pointer __from_s, pointer __from_e, pointer __to);
@@ -1497,6 +1502,34 @@ void vector<_Tp, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sent
     }
 }
 
+// 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