65-string-iterator-pointer.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. diff --git a/include/string b/include/string
  2. index 57624c7..6550f5b 100644
  3. --- a/include/string
  4. +++ b/include/string
  5. @@ -730,9 +730,14 @@ public:
  6. "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
  7. "original allocator");
  8. +#if _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1
  9. + typedef pointer iterator;
  10. + typedef const_pointer const_iterator;
  11. +#else
  12. // TODO: Implement iterator bounds checking without requiring the global database.
  13. typedef __wrap_iter<pointer> iterator;
  14. typedef __wrap_iter<const_pointer> const_iterator;
  15. +#endif
  16. typedef std::reverse_iterator<iterator> reverse_iterator;
  17. typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
  18. @@ -1131,6 +1136,7 @@ public:
  19. #endif
  20. _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(value_type __c);
  21. +#ifndef _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1
  22. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
  23. iterator begin() _NOEXCEPT
  24. {return __make_iterator(__get_pointer());}
  25. @@ -1143,6 +1149,22 @@ public:
  26. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
  27. const_iterator end() const _NOEXCEPT
  28. {return __make_const_iterator(__get_pointer() + size());}
  29. +#else
  30. + // It is necessary to keep the list of constructors matching the one above it.
  31. + // Made to support pointer iterators
  32. + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
  33. + iterator begin() _NOEXCEPT
  34. + {return iterator(__get_pointer());}
  35. + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
  36. + const_iterator begin() const _NOEXCEPT
  37. + {return const_iterator(__get_pointer());}
  38. + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
  39. + iterator end() _NOEXCEPT
  40. + {return iterator(__get_pointer() + size());}
  41. + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
  42. + const_iterator end() const _NOEXCEPT
  43. + {return const_iterator(__get_pointer() + size());}
  44. +#endif // _YNDX_LIBCPP_MAKE_STRING_ITERATOR_POINTERS == 1
  45. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
  46. reverse_iterator rbegin() _NOEXCEPT