blob: 7e91011a870c3e23f08e29f5ad2f15c141bc1f24 (
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
|
diff --git a/include/string b/include/string
index e8ac1d4..5b960cd 100644
--- a/include/string
+++ b/include/string
@@ -833,7 +833,10 @@ public:
"Allocator::value_type must be same type as value_type");
static_assert(__check_valid_allocator<allocator_type>::value, "");
-#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING
+#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1
+ typedef pointer iterator;
+ typedef const_pointer const_iterator;
+#elif defined(_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING)
// 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.
@@ -1254,6 +1257,7 @@ public:
#endif
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(value_type __c);
+#ifndef _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT {
return __make_iterator(__get_pointer());
}
@@ -1266,6 +1270,20 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT {
return __make_const_iterator(__get_pointer() + size());
}
+#else
+ // It is necessary to keep the list of constructors matching the one above it.
+ // Made to support pointer iterators
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT { return iterator(__get_pointer()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator begin() const _NOEXCEPT {
+ return const_iterator(__get_pointer());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator end() _NOEXCEPT {
+ return iterator(__get_pointer() + size());
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT {
+ return const_iterator(__get_pointer() + size());
+ }
+#endif // _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rbegin() _NOEXCEPT {
return reverse_iterator(end());
|