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 iterator; typedef __wrap_iter const_iterator; +#endif typedef std::reverse_iterator reverse_iterator; typedef std::reverse_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& __v); _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer __swap_out_circular_buffer(__split_buffer& __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 +_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 +_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 _LIBCPP_CONSTEXPR_SINCE_CXX20 void