diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table --- a/libcxx/include/__hash_table +++ b/libcxx/include/__hash_table @@ -360,19 +360,15 @@ {return !(__x == __y);} private: -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __hash_iterator(__next_pointer __node, const void* __c) _NOEXCEPT : __node_(__node) { + (void)__c; +#if _LIBCPP_DEBUG_LEVEL == 2 __get_db()->__insert_ic(this, __c); - } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __hash_iterator(__next_pointer __node) _NOEXCEPT - : __node_(__node) - {} #endif + } template friend class __hash_table; template friend class _LIBCPP_TEMPLATE_VIS __hash_const_iterator; template friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator; @@ -478,19 +474,15 @@ {return !(__x == __y);} private: -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __hash_const_iterator(__next_pointer __node, const void* __c) _NOEXCEPT : __node_(__node) { + (void)__c; +#if _LIBCPP_DEBUG_LEVEL == 2 __get_db()->__insert_ic(this, __c); - } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __hash_const_iterator(__next_pointer __node) _NOEXCEPT - : __node_(__node) - {} #endif + } template friend class __hash_table; template friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator; template friend class _LIBCPP_TEMPLATE_VIS unordered_map; @@ -591,7 +583,6 @@ {return !(__x == __y);} private: -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __hash_local_iterator(__next_pointer __node, size_t __bucket, size_t __bucket_count, const void* __c) _NOEXCEPT @@ -599,22 +590,13 @@ __bucket_(__bucket), __bucket_count_(__bucket_count) { + (void)__c; +#if _LIBCPP_DEBUG_LEVEL == 2 __get_db()->__insert_ic(this, __c); +#endif if (__node_ != nullptr) __node_ = __node_->__next_; } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __hash_local_iterator(__next_pointer __node, size_t __bucket, - size_t __bucket_count) _NOEXCEPT - : __node_(__node), - __bucket_(__bucket), - __bucket_count_(__bucket_count) - { - if (__node_ != nullptr) - __node_ = __node_->__next_; - } -#endif template friend class __hash_table; template friend class _LIBCPP_TEMPLATE_VIS __hash_const_local_iterator; template friend class _LIBCPP_TEMPLATE_VIS __hash_map_iterator; @@ -734,7 +716,6 @@ {return !(__x == __y);} private: -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __hash_const_local_iterator(__next_pointer __node_ptr, size_t __bucket, size_t __bucket_count, const void* __c) _NOEXCEPT @@ -742,22 +723,13 @@ __bucket_(__bucket), __bucket_count_(__bucket_count) { + (void)__c; +#if _LIBCPP_DEBUG_LEVEL == 2 __get_db()->__insert_ic(this, __c); +#endif if (__node_ != nullptr) __node_ = __node_->__next_; } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __hash_const_local_iterator(__next_pointer __node_ptr, size_t __bucket, - size_t __bucket_count) _NOEXCEPT - : __node_(__node_ptr), - __bucket_(__bucket), - __bucket_count_(__bucket_count) - { - if (__node_ != nullptr) - __node_ = __node_->__next_; - } -#endif template friend class __hash_table; template friend class _LIBCPP_TEMPLATE_VIS __hash_map_const_iterator; }; @@ -1279,11 +1251,7 @@ { _LIBCPP_ASSERT(__n < bucket_count(), "unordered container::begin(n) called with n >= bucket_count()"); -#if _LIBCPP_DEBUG_LEVEL == 2 return local_iterator(__bucket_list_[__n], __n, bucket_count(), this); -#else - return local_iterator(__bucket_list_[__n], __n, bucket_count()); -#endif } _LIBCPP_INLINE_VISIBILITY @@ -1292,11 +1260,7 @@ { _LIBCPP_ASSERT(__n < bucket_count(), "unordered container::end(n) called with n >= bucket_count()"); -#if _LIBCPP_DEBUG_LEVEL == 2 return local_iterator(nullptr, __n, bucket_count(), this); -#else - return local_iterator(nullptr, __n, bucket_count()); -#endif } _LIBCPP_INLINE_VISIBILITY @@ -1305,11 +1269,7 @@ { _LIBCPP_ASSERT(__n < bucket_count(), "unordered container::cbegin(n) called with n >= bucket_count()"); -#if _LIBCPP_DEBUG_LEVEL == 2 return const_local_iterator(__bucket_list_[__n], __n, bucket_count(), this); -#else - return const_local_iterator(__bucket_list_[__n], __n, bucket_count()); -#endif } _LIBCPP_INLINE_VISIBILITY @@ -1318,11 +1278,7 @@ { _LIBCPP_ASSERT(__n < bucket_count(), "unordered container::cend(n) called with n >= bucket_count()"); -#if _LIBCPP_DEBUG_LEVEL == 2 return const_local_iterator(nullptr, __n, bucket_count(), this); -#else - return const_local_iterator(nullptr, __n, bucket_count()); -#endif } #if _LIBCPP_DEBUG_LEVEL == 2 @@ -1765,11 +1721,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__p1_.first().__next_, this); -#else - return iterator(__p1_.first().__next_); -#endif } template @@ -1777,11 +1729,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(nullptr, this); -#else - return iterator(nullptr); -#endif } template @@ -1789,11 +1737,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return const_iterator(__p1_.first().__next_, this); -#else - return const_iterator(__p1_.first().__next_); -#endif } template @@ -1801,11 +1745,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return const_iterator(nullptr, this); -#else - return const_iterator(nullptr); -#endif } template @@ -1910,11 +1850,7 @@ __existing_node = __nd->__ptr(); __inserted = true; } -#if _LIBCPP_DEBUG_LEVEL == 2 return pair(iterator(__existing_node, this), __inserted); -#else - return pair(iterator(__existing_node), __inserted); -#endif } // Prepare the container for an insertion of the value __cp_val with the hash @@ -2008,11 +1944,7 @@ __next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__value_); __node_insert_multi_perform(__cp, __pn); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__cp->__ptr(), this); -#else - return iterator(__cp->__ptr()); -#endif } template @@ -2041,11 +1973,7 @@ __cp->__next_ = __np; __pp->__next_ = static_cast<__next_pointer>(__cp); ++size(); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(static_cast<__next_pointer>(__cp), this); -#else - return iterator(static_cast<__next_pointer>(__cp)); -#endif } return __node_insert_multi(__cp); } @@ -2111,11 +2039,7 @@ __inserted = true; } __done: -#if _LIBCPP_DEBUG_LEVEL == 2 return pair(iterator(__nd, this), __inserted); -#else - return pair(iterator(__nd), __inserted); -#endif } template @@ -2386,11 +2310,7 @@ { if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__value_, __k)) -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__nd, this); -#else - return iterator(__nd); -#endif } } } @@ -2417,11 +2337,7 @@ { if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__value_, __k)) -#if _LIBCPP_DEBUG_LEVEL == 2 return const_iterator(__nd, this); -#else - return const_iterator(__nd); -#endif } } @@ -2474,11 +2390,7 @@ " referring to this container"); _LIBCPP_ASSERT(__p != end(), "unordered container erase(iterator) called with a non-dereferenceable iterator"); -#if _LIBCPP_DEBUG_LEVEL == 2 iterator __r(__np, this); -#else - iterator __r(__np); -#endif ++__r; remove(__p); return __r; @@ -2501,11 +2413,7 @@ erase(__p); } __next_pointer __np = __last.__node_; -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator (__np, this); -#else - return iterator (__np); -#endif } template diff --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h --- a/libcxx/include/__iterator/wrap_iter.h +++ b/libcxx/include/__iterator/wrap_iter.h @@ -135,17 +135,15 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 iterator_type base() const _NOEXCEPT {return __i;} private: -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 - explicit __wrap_iter(const void* __p, iterator_type __x) : __i(__x) + explicit __wrap_iter(const void* __p, iterator_type __x) _NOEXCEPT : __i(__x) { + (void)__p; +#if _LIBCPP_DEBUG_LEVEL == 2 if (!__libcpp_is_constant_evaluated()) __get_db()->__insert_ic(this, __p); - } -#else - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 - explicit __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {} #endif + } template friend class __wrap_iter; template friend class basic_string; diff --git a/libcxx/include/list b/libcxx/include/list --- a/libcxx/include/list +++ b/libcxx/include/list @@ -299,19 +299,15 @@ __link_pointer __ptr_; -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __list_iterator(__link_pointer __p, const void* __c) _NOEXCEPT : __ptr_(__p) { + (void)__c; +#if _LIBCPP_DEBUG_LEVEL == 2 __get_db()->__insert_ic(this, __c); - } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __list_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {} #endif - - + } template friend class list; template friend class __list_imp; @@ -412,17 +408,15 @@ __link_pointer __ptr_; -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_INLINE_VISIBILITY explicit __list_const_iterator(__link_pointer __p, const void* __c) _NOEXCEPT : __ptr_(__p) { + (void)__c; +#if _LIBCPP_DEBUG_LEVEL == 2 __get_db()->__insert_ic(this, __c); - } -#else - _LIBCPP_INLINE_VISIBILITY - explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {} #endif + } template friend class list; template friend class __list_imp; @@ -600,38 +594,22 @@ _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__end_.__next_, this); -#else - return iterator(__end_.__next_); -#endif } _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return const_iterator(__end_.__next_, this); -#else - return const_iterator(__end_.__next_); -#endif } _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__end_as_link(), this); -#else - return iterator(__end_as_link()); -#endif } _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL == 2 return const_iterator(__end_as_link(), this); -#else - return const_iterator(__end_as_link()); -#endif } void swap(__list_imp& __c) @@ -1401,11 +1379,7 @@ __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link()); ++base::__sz(); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__hold.release()->__as_link(), this); -#else - return iterator(__hold.release()->__as_link()); -#endif } template @@ -1414,11 +1388,7 @@ { _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "list::insert(iterator, n, x) called with an iterator not referring to this list"); -#if _LIBCPP_DEBUG_LEVEL == 2 iterator __r(__p.__ptr_, this); -#else - iterator __r(__p.__ptr_); -#endif if (__n > 0) { size_type __ds = 0; @@ -1426,11 +1396,7 @@ __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 __r = iterator(__hold->__as_link(), this); -#else - __r = iterator(__hold->__as_link()); -#endif __hold.release(); iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS @@ -1456,11 +1422,7 @@ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif } throw; } @@ -1479,11 +1441,7 @@ { _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "list::insert(iterator, range) called with an iterator not referring to this list"); -#if _LIBCPP_DEBUG_LEVEL == 2 iterator __r(__p.__ptr_, this); -#else - iterator __r(__p.__ptr_); -#endif if (__f != __l) { size_type __ds = 0; @@ -1491,11 +1449,7 @@ __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 __r = iterator(__hold.get()->__as_link(), this); -#else - __r = iterator(__hold.get()->__as_link()); -#endif __hold.release(); iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS @@ -1521,11 +1475,7 @@ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif } throw; } @@ -1644,11 +1594,7 @@ __link_nodes(__p.__ptr_, __nl, __nl); ++base::__sz(); __hold.release(); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__nl, this); -#else - return iterator(__nl); -#endif } template @@ -1664,11 +1610,7 @@ __link_nodes(__p.__ptr_, __nl, __nl); ++base::__sz(); __hold.release(); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__nl, this); -#else - return iterator(__nl); -#endif } #endif // _LIBCPP_CXX03_LANG @@ -1762,11 +1704,7 @@ __node_pointer __np = __n->__as_node(); __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_)); __node_alloc_traits::deallocate(__na, __np, 1); -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__r, this); -#else - return iterator(__r); -#endif } template @@ -1806,11 +1744,7 @@ __node_alloc_traits::deallocate(__na, __np, 1); } } -#if _LIBCPP_DEBUG_LEVEL == 2 return iterator(__l.__ptr_, this); -#else - return iterator(__l.__ptr_); -#endif } template @@ -1827,11 +1761,7 @@ __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_)); ++__ds; -#if _LIBCPP_DEBUG_LEVEL == 2 iterator __r = iterator(__hold.release()->__as_link(), this); -#else - iterator __r = iterator(__hold.release()->__as_link()); -#endif iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -1856,11 +1786,7 @@ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif } throw; } @@ -1885,11 +1811,7 @@ __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); ++__ds; __link_pointer __nl = __hold.release()->__as_link(); -#if _LIBCPP_DEBUG_LEVEL == 2 iterator __r = iterator(__nl, this); -#else - iterator __r = iterator(__nl); -#endif iterator __e = __r; #ifndef _LIBCPP_NO_EXCEPTIONS try @@ -1914,11 +1836,7 @@ __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; -#if _LIBCPP_DEBUG_LEVEL == 2 __e = iterator(__prev, this); -#else - __e = iterator(__prev); -#endif } throw; } diff --git a/libcxx/include/span b/libcxx/include/span --- a/libcxx/include/span +++ b/libcxx/include/span @@ -197,6 +197,10 @@ is_convertible_v>(*)[], _ElementType(*)[]>; #endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) +# define _LIBCPP_SPAN_USE_POINTER_ITERATOR +#endif + template class _LIBCPP_TEMPLATE_VIS span { public: @@ -209,7 +213,7 @@ using const_pointer = const _Tp *; using reference = _Tp &; using const_reference = const _Tp &; -#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) +#ifdef _LIBCPP_SPAN_USE_POINTER_ITERATOR using iterator = pointer; #else using iterator = __wrap_iter; @@ -381,8 +385,20 @@ _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } // [span.iter], span iterator support - _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); } - _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); } + _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { +#ifdef _LIBCPP_SPAN_USE_POINTER_ITERATOR + return iterator(data()); +#else + return iterator(this, data()); +#endif + } + _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { +#ifdef _LIBCPP_SPAN_USE_POINTER_ITERATOR + return iterator(data() + size()); +#else + return iterator(this, data() + size()); +#endif + } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } @@ -412,7 +428,7 @@ using const_pointer = const _Tp *; using reference = _Tp &; using const_reference = const _Tp &; -#if (_LIBCPP_DEBUG_LEVEL == 2) || defined(_LIBCPP_ABI_SPAN_POINTER_ITERATORS) +#ifdef _LIBCPP_SPAN_USE_POINTER_ITERATOR using iterator = pointer; #else using iterator = __wrap_iter; @@ -560,8 +576,20 @@ _LIBCPP_INLINE_VISIBILITY constexpr pointer data() const noexcept { return __data; } // [span.iter], span iterator support - _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { return iterator(data()); } - _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { return iterator(data() + size()); } + _LIBCPP_INLINE_VISIBILITY constexpr iterator begin() const noexcept { +#ifdef _LIBCPP_SPAN_USE_POINTER_ITERATOR + return iterator(data()); +#else + return iterator(this, data()); +#endif + } + _LIBCPP_INLINE_VISIBILITY constexpr iterator end() const noexcept { +#ifdef _LIBCPP_SPAN_USE_POINTER_ITERATOR + return iterator(data() + size()); +#else + return iterator(this, data() + size()); +#endif + } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } _LIBCPP_INLINE_VISIBILITY constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -900,7 +900,6 @@ #endif _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string& operator=(value_type __c); -#if _LIBCPP_DEBUG_LEVEL == 2 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 iterator begin() _NOEXCEPT {return iterator(this, __get_pointer());} @@ -913,20 +912,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 const_iterator end() const _NOEXCEPT {return const_iterator(this, __get_pointer() + size());} -#else - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 - iterator begin() _NOEXCEPT - {return iterator(__get_pointer());} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 - const_iterator begin() const _NOEXCEPT - {return const_iterator(__get_pointer());} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 - iterator end() _NOEXCEPT - {return iterator(__get_pointer() + size());} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 - const_iterator end() const _NOEXCEPT - {return const_iterator(__get_pointer() + size());} -#endif // _LIBCPP_DEBUG_LEVEL == 2 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -1361,36 +1361,12 @@ std::__debug_db_invalidate_all(this); } -template -inline _LIBCPP_INLINE_VISIBILITY -typename vector<_Tp, _Allocator>::iterator -vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT -{ -#if _LIBCPP_DEBUG_LEVEL == 2 - return iterator(this, __p); -#else - return iterator(__p); -#endif -} - -template -inline _LIBCPP_INLINE_VISIBILITY -typename vector<_Tp, _Allocator>::const_iterator -vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT -{ -#if _LIBCPP_DEBUG_LEVEL == 2 - return const_iterator(this, __p); -#else - return const_iterator(__p); -#endif -} - template inline _LIBCPP_INLINE_VISIBILITY typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::begin() _NOEXCEPT { - return __make_iter(this->__begin_); + return iterator(this, this->__begin_); } template @@ -1398,7 +1374,7 @@ typename vector<_Tp, _Allocator>::const_iterator vector<_Tp, _Allocator>::begin() const _NOEXCEPT { - return __make_iter(this->__begin_); + return const_iterator(this, this->__begin_); } template @@ -1406,7 +1382,7 @@ typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::end() _NOEXCEPT { - return __make_iter(this->__end_); + return iterator(this, this->__end_); } template @@ -1414,7 +1390,7 @@ typename vector<_Tp, _Allocator>::const_iterator vector<_Tp, _Allocator>::end() const _NOEXCEPT { - return __make_iter(this->__end_); + return const_iterator(this, this->__end_); } template @@ -1584,7 +1560,7 @@ pointer __p = this->__begin_ + __ps; this->__destruct_at_end(_VSTD::move(__p + 1, this->__end_, __p)); this->__invalidate_iterators_past(__p-1); - iterator __r = __make_iter(__p); + iterator __r = iterator(this, __p); return __r; } @@ -1603,7 +1579,7 @@ this->__destruct_at_end(_VSTD::move(__p + (__last - __first), this->__end_, __p)); this->__invalidate_iterators_past(__p - 1); } - iterator __r = __make_iter(__p); + iterator __r = iterator(this, __p); return __r; } @@ -1655,7 +1631,7 @@ __v.push_back(__x); __p = __swap_out_circular_buffer(__v, __p); } - return __make_iter(__p); + return iterator(this, __p); } template @@ -1684,7 +1660,7 @@ __v.push_back(_VSTD::move(__x)); __p = __swap_out_circular_buffer(__v, __p); } - return __make_iter(__p); + return iterator(this, __p); } template @@ -1715,7 +1691,7 @@ __v.emplace_back(_VSTD::forward<_Args>(__args)...); __p = __swap_out_circular_buffer(__v, __p); } - return __make_iter(__p); + return iterator(this, __p); } template @@ -1754,7 +1730,7 @@ __p = __swap_out_circular_buffer(__v, __p); } } - return __make_iter(__p); + return iterator(this, __p); } template @@ -1797,14 +1773,14 @@ } catch (...) { - erase(__make_iter(__old_last), end()); + erase(iterator(this, __old_last), end()); throw; } #endif // _LIBCPP_NO_EXCEPTIONS } __p = _VSTD::rotate(__p, __old_last, this->__end_); - insert(__make_iter(__p), _VSTD::make_move_iterator(__v.begin()), - _VSTD::make_move_iterator(__v.end())); + insert(iterator(this, __p), _VSTD::make_move_iterator(__v.begin()), + _VSTD::make_move_iterator(__v.end())); return begin() + __off; } @@ -1854,7 +1830,7 @@ __p = __swap_out_circular_buffer(__v, __p); } } - return __make_iter(__p); + return iterator(this, __p); } template