mirror of git://gcc.gnu.org/git/gcc.git
				
				
				
			stl_deque.h (deque<>::insert(iterator, size_type, const value_type&), [...]): Adjust C++11 signatures to take a const_iterator.
2013-06-30 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/stl_deque.h (deque<>::insert(iterator, size_type, const value_type&), deque<>::insert(iterator, initializer_list<>), deque<>::insert(iterator, _InputIterator, _InputIterator)): Adjust C++11 signatures to take a const_iterator. * include/bits/stl_vector.h: Likewise. * include/bits/stl_bvector.h: Likewise. * include/debug/deque: Adjust. * include/debug/vector: Likewise. * include/profile/deque: Likewise. * include/profile/vector: Likewise. * testsuite/23_containers/deque/modifiers/insert/const_iterator.cc: Extend. * testsuite/23_containers/vector/bool/modifiers/insert/ const_iterator.cc: Likewise. * testsuite/23_containers/vector/modifiers/insert/const_iterator.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Adjust dg-error line number. * testsuite/23_containers/deque/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise. From-SVN: r200571
This commit is contained in:
		
							parent
							
								
									e8f24c86b8
								
							
						
					
					
						commit
						06eed9f588
					
				|  | @ -1,3 +1,39 @@ | |||
| 2013-06-30  Paolo Carlini  <paolo.carlini@oracle.com> | ||||
| 
 | ||||
| 	* include/bits/stl_deque.h (deque<>::insert(iterator, | ||||
| 	size_type, const value_type&), deque<>::insert(iterator, | ||||
| 	initializer_list<>), deque<>::insert(iterator, _InputIterator, | ||||
| 	_InputIterator)): Adjust C++11 signatures to take a const_iterator. | ||||
| 	* include/bits/stl_vector.h: Likewise. | ||||
| 	* include/bits/stl_bvector.h: Likewise. | ||||
| 	* include/debug/deque: Adjust. | ||||
| 	* include/debug/vector: Likewise. | ||||
| 	* include/profile/deque: Likewise. | ||||
| 	* include/profile/vector: Likewise. | ||||
| 	* testsuite/23_containers/deque/modifiers/insert/const_iterator.cc: | ||||
| 	Extend. | ||||
| 	* testsuite/23_containers/vector/bool/modifiers/insert/ | ||||
| 	const_iterator.cc: Likewise. | ||||
| 	* testsuite/23_containers/vector/modifiers/insert/const_iterator.cc: | ||||
| 	Likewise. | ||||
| 
 | ||||
| 	* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: | ||||
| 	Adjust dg-error line number. | ||||
| 	* testsuite/23_containers/deque/requirements/dr438/ | ||||
| 	constructor_1_neg.cc: Likewise. | ||||
| 	* testsuite/23_containers/deque/requirements/dr438/ | ||||
| 	constructor_2_neg.cc: Likewise. | ||||
| 	* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: | ||||
| 	Likewise. | ||||
| 	* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: | ||||
| 	Likewise. | ||||
| 	* testsuite/23_containers/vector/requirements/dr438/ | ||||
| 	constructor_1_neg.cc: Likewise. | ||||
| 	* testsuite/23_containers/vector/requirements/dr438/ | ||||
| 	constructor_2_neg.cc: Likewise. | ||||
| 	* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: | ||||
| 	Likewise. | ||||
| 
 | ||||
| 2013-06-27  Paolo Carlini  <paolo.carlini@oracle.com> | ||||
| 
 | ||||
| 	* testsuite/21_strings/basic_string/operations/*: Move inside | ||||
|  |  | |||
|  | @ -881,10 +881,15 @@ template<typename _Alloc> | |||
| #if __cplusplus >= 201103L | ||||
|     template<typename _InputIterator, | ||||
| 	     typename = std::_RequireInputIter<_InputIterator>> | ||||
|       void | ||||
|       insert(iterator __position, | ||||
|       iterator | ||||
|       insert(const_iterator __position, | ||||
| 	     _InputIterator __first, _InputIterator __last) | ||||
|       { _M_insert_dispatch(__position, __first, __last, __false_type()); } | ||||
|       { | ||||
| 	difference_type __offset = __position - cbegin(); | ||||
| 	_M_insert_dispatch(__position._M_const_cast(), | ||||
| 			   __first, __last, __false_type()); | ||||
| 	return begin() + __offset; | ||||
|       } | ||||
| #else | ||||
|     template<typename _InputIterator> | ||||
|       void | ||||
|  | @ -896,13 +901,24 @@ template<typename _Alloc> | |||
|       } | ||||
| #endif | ||||
| 
 | ||||
| #if __cplusplus >= 201103L | ||||
|     iterator | ||||
|     insert(const_iterator __position, size_type __n, const bool& __x) | ||||
|     { | ||||
|       difference_type __offset = __position - cbegin(); | ||||
|       _M_fill_insert(__position._M_const_cast(), __n, __x); | ||||
|       return begin() + __offset; | ||||
|     } | ||||
| #else | ||||
|     void | ||||
|     insert(iterator __position, size_type __n, const bool& __x) | ||||
|     { _M_fill_insert(__position, __n, __x); } | ||||
| #endif | ||||
| 
 | ||||
| #if __cplusplus >= 201103L | ||||
|     void insert(iterator __p, initializer_list<bool> __l) | ||||
|     { this->insert(__p, __l.begin(), __l.end()); } | ||||
|     iterator | ||||
|     insert(const_iterator __p, initializer_list<bool> __l) | ||||
|     { return this->insert(__p, __l.begin(), __l.end()); } | ||||
| #endif | ||||
| 
 | ||||
|     void | ||||
|  |  | |||
|  | @ -1517,11 +1517,30 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER | |||
|        *  initializer_list @a __l into the %deque before the location | ||||
|        *  specified by @a __p.  This is known as <em>list insert</em>. | ||||
|        */ | ||||
|       void | ||||
|       insert(iterator __p, initializer_list<value_type> __l) | ||||
|       { this->insert(__p, __l.begin(), __l.end()); } | ||||
|       iterator | ||||
|       insert(const_iterator __p, initializer_list<value_type> __l) | ||||
|       { return this->insert(__p, __l.begin(), __l.end()); } | ||||
| #endif | ||||
| 
 | ||||
| #if __cplusplus >= 201103L | ||||
|       /**
 | ||||
|        *  @brief  Inserts a number of copies of given data into the %deque. | ||||
|        *  @param  __position  A const_iterator into the %deque. | ||||
|        *  @param  __n  Number of elements to be inserted. | ||||
|        *  @param  __x  Data to be inserted. | ||||
|        *  @return  An iterator that points to the inserted data. | ||||
|        * | ||||
|        *  This function will insert a specified number of copies of the given | ||||
|        *  data before the location specified by @a __position. | ||||
|        */ | ||||
|       iterator | ||||
|       insert(const_iterator __position, size_type __n, const value_type& __x) | ||||
|       { | ||||
| 	difference_type __offset = __position - cbegin(); | ||||
| 	_M_fill_insert(__position._M_const_cast(), __n, __x); | ||||
| 	return begin() + __offset; | ||||
|       } | ||||
| #else | ||||
|       /**
 | ||||
|        *  @brief  Inserts a number of copies of given data into the %deque. | ||||
|        *  @param  __position  An iterator into the %deque. | ||||
|  | @ -1534,7 +1553,32 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER | |||
|       void | ||||
|       insert(iterator __position, size_type __n, const value_type& __x) | ||||
|       { _M_fill_insert(__position, __n, __x); } | ||||
| #endif | ||||
| 
 | ||||
| #if __cplusplus >= 201103L | ||||
|       /**
 | ||||
|        *  @brief  Inserts a range into the %deque. | ||||
|        *  @param  __position  A const_iterator into the %deque. | ||||
|        *  @param  __first  An input iterator. | ||||
|        *  @param  __last   An input iterator. | ||||
|        *  @return  An iterator that points to the inserted data. | ||||
|        * | ||||
|        *  This function will insert copies of the data in the range | ||||
|        *  [__first,__last) into the %deque before the location specified | ||||
|        *  by @a __position.  This is known as <em>range insert</em>. | ||||
|        */ | ||||
|       template<typename _InputIterator, | ||||
| 	       typename = std::_RequireInputIter<_InputIterator>> | ||||
|         iterator | ||||
|         insert(const_iterator __position, _InputIterator __first, | ||||
| 	       _InputIterator __last) | ||||
|         { | ||||
| 	  difference_type __offset = __position - cbegin(); | ||||
| 	  _M_insert_dispatch(__position._M_const_cast(), | ||||
| 			     __first, __last, __false_type()); | ||||
| 	  return begin() + __offset; | ||||
| 	} | ||||
| #else | ||||
|       /**
 | ||||
|        *  @brief  Inserts a range into the %deque. | ||||
|        *  @param  __position  An iterator into the %deque. | ||||
|  | @ -1545,14 +1589,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER | |||
|        *  [__first,__last) into the %deque before the location specified | ||||
|        *  by @a __position.  This is known as <em>range insert</em>. | ||||
|        */ | ||||
| #if __cplusplus >= 201103L | ||||
|       template<typename _InputIterator, | ||||
| 	       typename = std::_RequireInputIter<_InputIterator>> | ||||
|         void | ||||
|         insert(iterator __position, _InputIterator __first, | ||||
| 	       _InputIterator __last) | ||||
|         { _M_insert_dispatch(__position, __first, __last, __false_type()); } | ||||
| #else | ||||
|       template<typename _InputIterator> | ||||
|         void | ||||
|         insert(iterator __position, _InputIterator __first, | ||||
|  |  | |||
|  | @ -1015,11 +1015,34 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER | |||
|        *  %vector and if it is frequently used the user should | ||||
|        *  consider using std::list. | ||||
|        */ | ||||
|       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 | ||||
|       /**
 | ||||
|        *  @brief  Inserts a number of copies of given data into the %vector. | ||||
|        *  @param  __position  A const_iterator into the %vector. | ||||
|        *  @param  __n  Number of elements to be inserted. | ||||
|        *  @param  __x  Data to be inserted. | ||||
|        *  @return  An iterator that points to the inserted data. | ||||
|        * | ||||
|        *  This function will insert a specified number of copies of | ||||
|        *  the given data before the location specified by @a position. | ||||
|        * | ||||
|        *  Note that this kind of operation could be expensive for a | ||||
|        *  %vector and if it is frequently used the user should | ||||
|        *  consider using std::list. | ||||
|        */ | ||||
|       iterator | ||||
|       insert(const_iterator __position, size_type __n, const value_type& __x) | ||||
|       { | ||||
| 	difference_type __offset = __position - cbegin(); | ||||
| 	_M_fill_insert(__position._M_const_cast(), __n, __x); | ||||
| 	return begin() + __offset; | ||||
|       } | ||||
| #else | ||||
|       /**
 | ||||
|        *  @brief  Inserts a number of copies of given data into the %vector. | ||||
|        *  @param  __position  An iterator into the %vector. | ||||
|  | @ -1036,7 +1059,36 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER | |||
|       void | ||||
|       insert(iterator __position, size_type __n, const value_type& __x) | ||||
|       { _M_fill_insert(__position, __n, __x); } | ||||
| #endif | ||||
| 
 | ||||
| #if __cplusplus >= 201103L | ||||
|       /**
 | ||||
|        *  @brief  Inserts a range into the %vector. | ||||
|        *  @param  __position  A const_iterator into the %vector. | ||||
|        *  @param  __first  An input iterator. | ||||
|        *  @param  __last   An input iterator. | ||||
|        *  @return  An iterator that points to the inserted data. | ||||
|        * | ||||
|        *  This function will insert copies of the data in the range | ||||
|        *  [__first,__last) into the %vector before the location specified | ||||
|        *  by @a pos. | ||||
|        * | ||||
|        *  Note that this kind of operation could be expensive for a | ||||
|        *  %vector and if it is frequently used the user should | ||||
|        *  consider using std::list. | ||||
|        */ | ||||
|       template<typename _InputIterator, | ||||
| 	       typename = std::_RequireInputIter<_InputIterator>> | ||||
|         iterator | ||||
|         insert(const_iterator __position, _InputIterator __first, | ||||
| 	       _InputIterator __last) | ||||
|         { | ||||
| 	  difference_type __offset = __position - cbegin(); | ||||
| 	  _M_insert_dispatch(__position._M_const_cast(), | ||||
| 			     __first, __last, __false_type()); | ||||
| 	  return begin() + __offset; | ||||
| 	} | ||||
| #else | ||||
|       /**
 | ||||
|        *  @brief  Inserts a range into the %vector. | ||||
|        *  @param  __position  An iterator into the %vector. | ||||
|  | @ -1051,14 +1103,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER | |||
|        *  %vector and if it is frequently used the user should | ||||
|        *  consider using std::list. | ||||
|        */ | ||||
| #if __cplusplus >= 201103L | ||||
|       template<typename _InputIterator, | ||||
| 	       typename = std::_RequireInputIter<_InputIterator>> | ||||
|         void | ||||
|         insert(iterator __position, _InputIterator __first, | ||||
| 	       _InputIterator __last) | ||||
|         { _M_insert_dispatch(__position, __first, __last, __false_type()); } | ||||
| #else | ||||
|       template<typename _InputIterator> | ||||
|         void | ||||
|         insert(iterator __position, _InputIterator __first, | ||||
|  |  | |||
|  | @ -411,14 +411,26 @@ namespace __debug | |||
|       insert(const_iterator __position, _Tp&& __x) | ||||
|       { return emplace(__position, std::move(__x)); } | ||||
| 
 | ||||
|       void | ||||
|       insert(iterator __p, initializer_list<value_type> __l) | ||||
|       iterator | ||||
|       insert(const_iterator __position, initializer_list<value_type> __l) | ||||
|       { | ||||
| 	_Base::insert(__p, __l); | ||||
| 	__glibcxx_check_insert(__position); | ||||
| 	_Base_iterator __res = _Base::insert(__position.base(), __l); | ||||
| 	this->_M_invalidate_all(); | ||||
| 	return iterator(__res, this); | ||||
|       } | ||||
| #endif | ||||
| 
 | ||||
| #if __cplusplus >= 201103L | ||||
|       iterator | ||||
|       insert(const_iterator __position, size_type __n, const _Tp& __x) | ||||
|       { | ||||
| 	__glibcxx_check_insert(__position); | ||||
| 	_Base_iterator __res = _Base::insert(__position.base(), __n, __x); | ||||
| 	this->_M_invalidate_all(); | ||||
| 	return iterator(__res, this); | ||||
|       } | ||||
| #else | ||||
|       void | ||||
|       insert(iterator __position, size_type __n, const _Tp& __x) | ||||
|       { | ||||
|  | @ -426,13 +438,24 @@ namespace __debug | |||
| 	_Base::insert(__position.base(), __n, __x); | ||||
| 	this->_M_invalidate_all(); | ||||
|       } | ||||
| #endif | ||||
| 
 | ||||
| #if __cplusplus >= 201103L | ||||
|       template<class _InputIterator, | ||||
| 	       typename = std::_RequireInputIter<_InputIterator>> | ||||
| 	iterator | ||||
|         insert(const_iterator __position, | ||||
| 	       _InputIterator __first, _InputIterator __last) | ||||
|         { | ||||
| 	  __glibcxx_check_insert_range(__position, __first, __last); | ||||
| 	  _Base_iterator __res = _Base::insert(__position.base(), | ||||
| 					       __gnu_debug::__base(__first), | ||||
| 					       __gnu_debug::__base(__last)); | ||||
| 	  this->_M_invalidate_all(); | ||||
| 	  return iterator(__res, this); | ||||
| 	} | ||||
| #else | ||||
|       template<class _InputIterator> | ||||
| #endif | ||||
|         void | ||||
|         insert(iterator __position, | ||||
| 	       _InputIterator __first, _InputIterator __last) | ||||
|  | @ -442,6 +465,7 @@ namespace __debug | |||
| 					   __gnu_debug::__base(__last)); | ||||
| 	  this->_M_invalidate_all(); | ||||
| 	} | ||||
| #endif | ||||
| 
 | ||||
|       void | ||||
|       pop_front() | ||||
|  |  | |||
|  | @ -471,11 +471,27 @@ namespace __debug | |||
|         insert(const_iterator __position, _Tp&& __x) | ||||
|         { return emplace(__position, std::move(__x)); } | ||||
| 
 | ||||
|       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 | ||||
|       iterator | ||||
|       insert(const_iterator __position, size_type __n, const _Tp& __x) | ||||
|       { | ||||
| 	__glibcxx_check_insert(__position); | ||||
| 	bool __realloc = _M_requires_reallocation(this->size() + __n); | ||||
| 	difference_type __offset = __position.base() - _Base::cbegin(); | ||||
| 	_Base_iterator __res = _Base::insert(__position.base(), __n, __x); | ||||
| 	if (__realloc) | ||||
| 	  this->_M_invalidate_all(); | ||||
| 	else | ||||
| 	  this->_M_invalidate_after_nth(__offset); | ||||
| 	_M_update_guaranteed_capacity(); | ||||
| 	return iterator(__res, this); | ||||
|       } | ||||
| #else | ||||
|       void | ||||
|       insert(iterator __position, size_type __n, const _Tp& __x) | ||||
|       { | ||||
|  | @ -489,13 +505,35 @@ namespace __debug | |||
| 	  this->_M_invalidate_after_nth(__offset); | ||||
| 	_M_update_guaranteed_capacity(); | ||||
|       } | ||||
| #endif | ||||
| 
 | ||||
| #if __cplusplus >= 201103L | ||||
|       template<class _InputIterator, | ||||
| 	       typename = std::_RequireInputIter<_InputIterator>> | ||||
|         iterator | ||||
|         insert(const_iterator __position, | ||||
| 	       _InputIterator __first, _InputIterator __last) | ||||
|         { | ||||
| 	  __glibcxx_check_insert_range(__position, __first, __last); | ||||
| 
 | ||||
| 	  /* Hard to guess if invalidation will occur, because __last | ||||
| 	     - __first can't be calculated in all cases, so we just | ||||
| 	     punt here by checking if it did occur. */ | ||||
| 	  _Base_iterator __old_begin = _M_base().begin(); | ||||
| 	  difference_type __offset = __position.base() - _Base::cbegin(); | ||||
| 	  _Base_iterator __res = _Base::insert(__position.base(), | ||||
| 					       __gnu_debug::__base(__first), | ||||
| 					       __gnu_debug::__base(__last)); | ||||
| 
 | ||||
| 	  if (_M_base().begin() != __old_begin) | ||||
| 	    this->_M_invalidate_all(); | ||||
| 	  else | ||||
| 	    this->_M_invalidate_after_nth(__offset); | ||||
| 	  _M_update_guaranteed_capacity(); | ||||
| 	  return iterator(__res, this); | ||||
| 	} | ||||
| #else | ||||
|       template<class _InputIterator> | ||||
| #endif | ||||
|         void | ||||
|         insert(iterator __position, | ||||
| 	       _InputIterator __first, _InputIterator __last) | ||||
|  | @ -516,6 +554,7 @@ namespace __debug | |||
| 	    this->_M_invalidate_after_nth(__offset); | ||||
| 	  _M_update_guaranteed_capacity(); | ||||
| 	} | ||||
| #endif | ||||
| 
 | ||||
|       iterator | ||||
| #if __cplusplus >= 201103L | ||||
|  |  | |||
|  | @ -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() | ||||
|  |  | |||
|  | @ -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); | ||||
|       } | ||||
| 
 | ||||
|  |  | |||
|  | @ -24,6 +24,9 @@ void test01() | |||
| { | ||||
|   std::deque<int> d1; | ||||
|   int n = 0; | ||||
|   d1.insert(d1.cbegin(), n); | ||||
|   d1.insert(d1.cbegin(), 1); | ||||
|   std::deque<int>::iterator it = d1.insert(d1.cbegin(), n); | ||||
|   it = d1.insert(d1.cbegin(), 1); | ||||
|   it = d1.insert(d1.cbegin(), {2, 3}); | ||||
|   it = d1.insert(d1.cbegin(), 1, 4); | ||||
|   it = d1.insert(d1.cbegin(), d1.begin(), d1.end()); | ||||
| } | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
| // <http://www.gnu.org/licenses/>.
 | ||||
| 
 | ||||
| // { dg-do compile }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1724 }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1760 }
 | ||||
| 
 | ||||
| #include <deque> | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
| // <http://www.gnu.org/licenses/>.
 | ||||
| 
 | ||||
| // { dg-do compile }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1657 }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1693 }
 | ||||
| 
 | ||||
| #include <deque> | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
| // <http://www.gnu.org/licenses/>.
 | ||||
| 
 | ||||
| // { dg-do compile }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1657 }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1693 }
 | ||||
| 
 | ||||
| #include <deque> | ||||
| #include <utility> | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
| // <http://www.gnu.org/licenses/>.
 | ||||
| 
 | ||||
| // { dg-do compile }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1808 }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1844 }
 | ||||
| 
 | ||||
| #include <deque> | ||||
| 
 | ||||
|  |  | |||
|  | @ -23,5 +23,8 @@ | |||
| void test01() | ||||
| { | ||||
|   std::vector<bool> vb1; | ||||
|   vb1.insert(vb1.cbegin(), true); | ||||
|   std::vector<bool>::iterator it = vb1.insert(vb1.cbegin(), true); | ||||
|   it = vb1.insert(vb1.cbegin(), {false, true}); | ||||
|   it = vb1.insert(vb1.cbegin(), 1, false); | ||||
|   it = vb1.insert(vb1.cbegin(), vb1.begin(), vb1.end());   | ||||
| } | ||||
|  |  | |||
|  | @ -24,6 +24,9 @@ void test01() | |||
| { | ||||
|   std::vector<int> v1; | ||||
|   int n = 0; | ||||
|   v1.insert(v1.cbegin(), n); | ||||
|   v1.insert(v1.cbegin(), 1); | ||||
|   std::vector<int>::iterator it = v1.insert(v1.cbegin(), n); | ||||
|   it = v1.insert(v1.cbegin(), 1); | ||||
|   it = v1.insert(v1.cbegin(), {2, 3}); | ||||
|   it = v1.insert(v1.cbegin(), 1, 4); | ||||
|   it = v1.insert(v1.cbegin(), v1.begin(), v1.end()); | ||||
| } | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
| // <http://www.gnu.org/licenses/>.
 | ||||
| 
 | ||||
| // { dg-do compile }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1264 }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1308 }
 | ||||
| 
 | ||||
| #include <vector> | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
| // <http://www.gnu.org/licenses/>.
 | ||||
| 
 | ||||
| // { dg-do compile }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1190 }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1234 }
 | ||||
| 
 | ||||
| #include <vector> | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
| // <http://www.gnu.org/licenses/>.
 | ||||
| 
 | ||||
| // { dg-do compile }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1190 }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1234 }
 | ||||
| 
 | ||||
| #include <vector> | ||||
| #include <utility> | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
| // <http://www.gnu.org/licenses/>.
 | ||||
| 
 | ||||
| // { dg-do compile }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1305 }
 | ||||
| // { dg-error "no matching" "" { target *-*-* } 1349 }
 | ||||
| 
 | ||||
| #include <vector> | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Paolo Carlini
						Paolo Carlini