diff options
Diffstat (limited to 'libstdc++-v3/include/profile')
-rw-r--r-- | libstdc++-v3/include/profile/deque | 28 | ||||
-rw-r--r-- | libstdc++-v3/include/profile/list | 42 | ||||
-rw-r--r-- | libstdc++-v3/include/profile/vector | 75 |
3 files changed, 95 insertions, 50 deletions
diff --git a/libstdc++-v3/include/profile/deque b/libstdc++-v3/include/profile/deque index 0ec98386bae..c46618e27e4 100644 --- a/libstdc++-v3/include/profile/deque +++ b/libstdc++-v3/include/profile/deque @@ -344,31 +344,35 @@ namespace __profile insert(const_iterator __position, _Tp&& __x) { return emplace(__position, std::move(__x)); } - void - insert(iterator __p, initializer_list<value_type> __l) - { - _Base::insert(__p, __l); - } + iterator + insert(const_iterator __p, initializer_list<value_type> __l) + { return _Base::insert(__p, __l); } #endif +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, size_type __n, const _Tp& __x) + { return _Base::insert(__position, __n, __x); } +#else void insert(iterator __position, size_type __n, const _Tp& __x) - { - _Base::insert(__position, __n, __x); - } + { _Base::insert(__position, __n, __x); } +#endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> + iterator + insert(const_iterator __position, + _InputIterator __first, _InputIterator __last) + { return _Base::insert(__position, __first, __last); } #else template<typename _InputIterator> -#endif void insert(iterator __position, _InputIterator __first, _InputIterator __last) - { - _Base::insert(__position, __first, __last); - } + { _Base::insert(__position, __first, __last); } +#endif void pop_front() diff --git a/libstdc++-v3/include/profile/list b/libstdc++-v3/include/profile/list index 3a68bf7493a..ac09aa3db26 100644 --- a/libstdc++-v3/include/profile/list +++ b/libstdc++-v3/include/profile/list @@ -363,27 +363,43 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> > this); } - void - insert(iterator __position, initializer_list<value_type> __l) + iterator + insert(const_iterator __position, initializer_list<value_type> __l) { _M_profile_insert(this, __position, size()); - _Base::insert(__position.base(), __l); + return iterator(_Base::insert(__position.base(), __l), this); } #endif +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, size_type __n, const _Tp& __x) + { + _M_profile_insert(this, __position, size()); + return iterator(_Base::insert(__position.base(), __n, __x), this); + } +#else void insert(iterator __position, size_type __n, const _Tp& __x) { _M_profile_insert(this, __position, size()); _Base::insert(__position.base(), __n, __x); } +#endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> + iterator + insert(const_iterator __position, _InputIterator __first, + _InputIterator __last) + { + _M_profile_insert(this, __position, size()); + return iterator(_Base::insert(__position.base(), __first, __last), + this); + } #else template<class _InputIterator> -#endif void insert(iterator __position, _InputIterator __first, _InputIterator __last) @@ -391,6 +407,7 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> > _M_profile_insert(this, __position, size()); _Base::insert(__position.base(), __first, __last); } +#endif iterator #if __cplusplus >= 201103L @@ -423,7 +440,7 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> > // 23.2.2.4 list operations: void #if __cplusplus >= 201103L - splice(iterator __position, list&& __x) + splice(const_iterator __position, list&& __x) #else splice(iterator __position, list& __x) #endif @@ -431,19 +448,17 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> > #if __cplusplus >= 201103L void - splice(iterator __position, list& __x) + splice(const_iterator __position, list& __x) { this->splice(__position, std::move(__x)); } -#endif -#if __cplusplus >= 201103L void - splice(iterator __position, list& __x, iterator __i) + splice(const_iterator __position, list& __x, const_iterator __i) { this->splice(__position, std::move(__x), __i); } #endif void #if __cplusplus >= 201103L - splice(iterator __position, list&& __x, iterator __i) + splice(const_iterator __position, list&& __x, const_iterator __i) #else splice(iterator __position, list& __x, iterator __i) #endif @@ -458,8 +473,8 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> > void #if __cplusplus >= 201103L - splice(iterator __position, list&& __x, iterator __first, - iterator __last) + splice(const_iterator __position, list&& __x, const_iterator __first, + const_iterator __last) #else splice(iterator __position, list& __x, iterator __first, iterator __last) @@ -474,7 +489,8 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> > #if __cplusplus >= 201103L void - splice(iterator __position, list& __x, iterator __first, iterator __last) + splice(const_iterator __position, list& __x, + const_iterator __first, const_iterator __last) { this->splice(__position, std::move(__x), __first, __last); } #endif diff --git a/libstdc++-v3/include/profile/vector b/libstdc++-v3/include/profile/vector index de058d0d814..3ef04ff0a7c 100644 --- a/libstdc++-v3/include/profile/vector +++ b/libstdc++-v3/include/profile/vector @@ -44,6 +44,9 @@ namespace __profile { typedef _GLIBCXX_STD_C::vector<_Tp, _Allocator> _Base; + typedef typename _Base::iterator _Base_iterator; + typedef typename _Base::const_iterator _Base_const_iterator; + #if __cplusplus >= 201103L typedef __gnu_cxx::__alloc_traits<_Allocator> _Alloc_traits; #endif @@ -52,9 +55,9 @@ namespace __profile typedef typename _Base::reference reference; typedef typename _Base::const_reference const_reference; - typedef __iterator_tracker<typename _Base::iterator, vector> + typedef __iterator_tracker<_Base_iterator, vector> iterator; - typedef __iterator_tracker<typename _Base::const_iterator, vector> + typedef __iterator_tracker<_Base_const_iterator, vector> const_iterator; typedef typename _Base::size_type size_type; @@ -361,7 +364,7 @@ namespace __profile __profcxx_vector_insert(this, __position.base() - _Base::begin(), this->size()); size_type __old_size = this->capacity(); - typename _Base::iterator __res = _Base::insert(__position.base(), __x); + _Base_iterator __res = _Base::insert(__position.base(), __x); _M_profile_resize(this, __old_size, this->capacity()); return iterator(__res, this); } @@ -370,10 +373,10 @@ namespace __profile iterator insert(const_iterator __position, _Tp&& __x) { - __profcxx_vector_insert(this, __position.base() - _Base::begin(), + __profcxx_vector_insert(this, __position.base() - _Base::cbegin(), this->size()); size_type __old_size = this->capacity(); - typename _Base::iterator __res = _Base::insert(__position.base(), __x); + _Base_iterator __res = _Base::insert(__position.base(), __x); _M_profile_resize(this, __old_size, this->capacity()); return iterator(__res, this); } @@ -382,15 +385,14 @@ namespace __profile iterator emplace(const_iterator __position, _Args&&... __args) { - typename _Base::iterator __res - = _Base::emplace(__position.base(), - std::forward<_Args>(__args)...); + _Base_iterator __res = _Base::emplace(__position.base(), + std::forward<_Args>(__args)...); return iterator(__res, this); } - void - insert(iterator __position, initializer_list<value_type> __l) - { this->insert(__position, __l.begin(), __l.end()); } + iterator + insert(const_iterator __position, initializer_list<value_type> __l) + { return this->insert(__position, __l.begin(), __l.end()); } #endif #if __cplusplus >= 201103L @@ -404,12 +406,24 @@ namespace __profile void swap(vector& __x) #if __cplusplus >= 201103L - noexcept(_Alloc_traits::_S_nothrow_swap()) + noexcept(_Alloc_traits::_S_nothrow_swap()) #endif { _Base::swap(__x); } +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, size_type __n, const _Tp& __x) + { + __profcxx_vector_insert(this, __position.base() - _Base::cbegin(), + this->size()); + size_type __old_size = this->capacity(); + _Base_iterator __res = _Base::insert(__position, __n, __x); + _M_profile_resize(this, __old_size, this->capacity()); + return iterator(__res, this); + } +#else void insert(iterator __position, size_type __n, const _Tp& __x) { @@ -419,23 +433,35 @@ namespace __profile _Base::insert(__position, __n, __x); _M_profile_resize(this, __old_size, this->capacity()); } +#endif #if __cplusplus >= 201103L template<typename _InputIterator, typename = std::_RequireInputIter<_InputIterator>> + iterator + insert(const_iterator __position, + _InputIterator __first, _InputIterator __last) + { + __profcxx_vector_insert(this, __position.base() - _Base::cbegin(), + this->size()); + size_type __old_size = this->capacity(); + _Base_iterator __res = _Base::insert(__position, __first, __last); + _M_profile_resize(this, __old_size, this->capacity()); + return iterator(__res, this); + } #else template<typename _InputIterator> + void + insert(iterator __position, + _InputIterator __first, _InputIterator __last) + { + __profcxx_vector_insert(this, __position.base() - _Base::begin(), + this->size()); + size_type __old_size = this->capacity(); + _Base::insert(__position, __first, __last); + _M_profile_resize(this, __old_size, this->capacity()); + } #endif - void - insert(iterator __position, - _InputIterator __first, _InputIterator __last) - { - __profcxx_vector_insert(this, __position.base()-_Base::begin(), - this->size()); - size_type __old_size = this->capacity(); - _Base::insert(__position, __first, __last); - _M_profile_resize(this, __old_size, this->capacity()); - } iterator #if __cplusplus >= 201103L @@ -444,7 +470,7 @@ namespace __profile erase(iterator __position) #endif { - typename _Base::iterator __res = _Base::erase(__position.base()); + _Base_iterator __res = _Base::erase(__position.base()); return iterator(__res, this); } @@ -457,8 +483,7 @@ namespace __profile { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 151. can't currently clear() empty container - typename _Base::iterator __res = _Base::erase(__first.base(), - __last.base()); + _Base_iterator __res = _Base::erase(__first.base(), __last.base()); return iterator(__res, this); } |