summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-30 16:24:30 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-30 16:24:30 +0000
commitfc0701588c12a1eeeb3029ecf25a6023282d7dca (patch)
tree83347806f74e9a3b4ea1901cf1df2a4ea1238bfc /libstdc++-v3
parentf5049de703af188022f2dfe8b12f22a4fb924944 (diff)
downloadgcc-fc0701588c12a1eeeb3029ecf25a6023282d7dca.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200571 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog36
-rw-r--r--libstdc++-v3/include/bits/stl_bvector.h26
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h52
-rw-r--r--libstdc++-v3/include/bits/stl_vector.h60
-rw-r--r--libstdc++-v3/include/debug/deque32
-rw-r--r--libstdc++-v3/include/debug/vector47
-rw-r--r--libstdc++-v3/include/profile/deque28
-rw-r--r--libstdc++-v3/include/profile/vector75
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/modifiers/insert/const_iterator.cc7
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/const_iterator.cc5
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/insert/const_iterator.cc7
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc2
19 files changed, 312 insertions, 79 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 1ae52c2bf58..14c49db86d2 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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
diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index 489d819f06f..887ea16ae55 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -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
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index a03ba256b53..a4656734469 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -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,25 +1553,42 @@ _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 An iterator 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>.
*/
-#if __cplusplus >= 201103L
template<typename _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
- void
- insert(iterator __position, _InputIterator __first,
+ 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
+ /**
+ * @brief Inserts a range into the %deque.
+ * @param __position An iterator into the %deque.
+ * @param __first An input iterator.
+ * @param __last An input iterator.
+ *
+ * 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>
void
insert(iterator __position, _InputIterator __first,
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index a403b4f83bb..726693918a3 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -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,12 +1059,15 @@ _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 An iterator 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
@@ -1051,14 +1077,32 @@ _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,
+ 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
+ /**
+ * @brief Inserts a range into the %vector.
+ * @param __position An iterator into the %vector.
+ * @param __first An input iterator.
+ * @param __last An input iterator.
+ *
+ * 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>
void
insert(iterator __position, _InputIterator __first,
diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque
index 638bf1cd3ca..e5e902dfc7b 100644
--- a/libstdc++-v3/include/debug/deque
+++ b/libstdc++-v3/include/debug/deque
@@ -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()
diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector
index f55dc67ede0..7b28177c2a0 100644
--- a/libstdc++-v3/include/debug/vector
+++ b/libstdc++-v3/include/debug/vector
@@ -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
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/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);
}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/modifiers/insert/const_iterator.cc b/libstdc++-v3/testsuite/23_containers/deque/modifiers/insert/const_iterator.cc
index 915aa688a91..9af2bc90886 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/modifiers/insert/const_iterator.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/modifiers/insert/const_iterator.cc
@@ -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());
}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
index 9788b4d952d..7558ac7d855 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
index a85b5c3f9f8..ee6b721d9d3 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
index 162bdf0bf95..d36964efa4e 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
index 7e8356fd763..cda684d29f5 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/const_iterator.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/const_iterator.cc
index b8993d84342..93f3d928711 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/const_iterator.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/const_iterator.cc
@@ -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());
}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/insert/const_iterator.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/insert/const_iterator.cc
index 5e5ef9e3739..b1bf91edc22 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/modifiers/insert/const_iterator.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/insert/const_iterator.cc
@@ -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());
}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
index e9434677282..f7353ab325c 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
index ba14bcef2ad..f404a7009da 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
index c9ac43782c4..070295676a5 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
index 343edc2c7f3..95af05795ce 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
@@ -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>