aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2010-11-08 16:07:32 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-11-08 16:07:32 +0000
commit7606bd1197e8b097d175639bc0be68833e1ef1df (patch)
treeaab9c7af7885b649144d762d73e89592cb94b93a /libstdc++-v3
parent7876e2b5f44e8d961d43f9e0e2b007efebd1d955 (diff)
downloadgcc-7606bd1197e8b097d175639bc0be68833e1ef1df.zip
gcc-7606bd1197e8b097d175639bc0be68833e1ef1df.tar.gz
gcc-7606bd1197e8b097d175639bc0be68833e1ef1df.tar.bz2
stl_tree.h (_Rb_tree<>::_M_erase_aux): Add.
2010-11-08 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/stl_tree.h (_Rb_tree<>::_M_erase_aux): Add. (_Rb_tree<>::erase(iterator)): Fix in C++0x mode to take const_iterator; remove redundant overload in C++03 mode. (_Rb_tree<>::erase(iterator, iterator)): Likewise. * include/bits/stl_map.h (map<>::erase): Adjust. (map<>::insert): Fix signature in C++0x mode. * include/bits/stl_set.h (set<>::erase): Likewise. (set<>::insert): Likewise. * include/bits/stl_multimap.h (multimap<>::erase): Likewise. (multimap<>::insert): Likewise. * include/bits/stl_multiset.h (multiset<>::erase): Likewise. (multiset<>::insert): Fix signature in C++0x mode. * include/profile/set.h: Adjust. * include/profile/multiset.h: Likewise. * include/profile/map.h: Likewise. * include/profile/multimap.h: Likewise. * testsuite/util/exception/safety.h (erase_base, insert_base): Update. From-SVN: r166438
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog21
-rw-r--r--libstdc++-v3/include/bits/stl_map.h10
-rw-r--r--libstdc++-v3/include/bits/stl_multimap.h14
-rw-r--r--libstdc++-v3/include/bits/stl_multiset.h14
-rw-r--r--libstdc++-v3/include/bits/stl_set.h14
-rw-r--r--libstdc++-v3/include/bits/stl_tree.h175
-rw-r--r--libstdc++-v3/include/profile/map.h34
-rw-r--r--libstdc++-v3/include/profile/multimap.h37
-rw-r--r--libstdc++-v3/include/profile/multiset.h41
-rw-r--r--libstdc++-v3/include/profile/set.h37
-rw-r--r--libstdc++-v3/testsuite/util/exception/safety.h176
11 files changed, 222 insertions, 351 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index d9156b1..fa9f25e 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,24 @@
+2010-11-08 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/stl_tree.h (_Rb_tree<>::_M_erase_aux): Add.
+ (_Rb_tree<>::erase(iterator)): Fix in C++0x mode to take
+ const_iterator; remove redundant overload in C++03 mode.
+ (_Rb_tree<>::erase(iterator, iterator)): Likewise.
+ * include/bits/stl_map.h (map<>::erase): Adjust.
+ (map<>::insert): Fix signature in C++0x mode.
+ * include/bits/stl_set.h (set<>::erase): Likewise.
+ (set<>::insert): Likewise.
+ * include/bits/stl_multimap.h (multimap<>::erase): Likewise.
+ (multimap<>::insert): Likewise.
+ * include/bits/stl_multiset.h (multiset<>::erase): Likewise.
+ (multiset<>::insert): Fix signature in C++0x mode.
+ * include/profile/set.h: Adjust.
+ * include/profile/multiset.h: Likewise.
+ * include/profile/map.h: Likewise.
+ * include/profile/multimap.h: Likewise.
+ * testsuite/util/exception/safety.h (erase_base, insert_base):
+ Update.
+
2010-11-07 Paolo Carlini <paolo.carlini@oracle.com>
* include/profile/unordered_map (unordered_map<>::operator[](_Key&&)):
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index 5d6a98b..9614a12 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -510,7 +510,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
*/
void
insert(std::initializer_list<value_type> __list)
- { insert (__list.begin(), __list.end()); }
+ { insert(__list.begin(), __list.end()); }
#endif
/**
@@ -537,7 +537,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* Insertion requires logarithmic time (if the hint is not taken).
*/
iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ insert(const_iterator __position, const value_type& __x)
+#else
insert(iterator __position, const value_type& __x)
+#endif
{ return _M_t._M_insert_unique_(__position, __x); }
/**
@@ -570,7 +574,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* the pointer is the user's responsibility.
*/
iterator
- erase(iterator __position)
+ erase(const_iterator __position)
{ return _M_t.erase(__position); }
#else
/**
@@ -619,7 +623,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* in any way. Managing the pointer is the user's responsibility.
*/
iterator
- erase(iterator __first, iterator __last)
+ erase(const_iterator __first, const_iterator __last)
{ return _M_t.erase(__first, __last); }
#else
/**
diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h
index 82a80f2..1a01ffe 100644
--- a/libstdc++-v3/include/bits/stl_multimap.h
+++ b/libstdc++-v3/include/bits/stl_multimap.h
@@ -459,7 +459,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* Insertion requires logarithmic time (if the hint is not taken).
*/
iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ insert(const_iterator __position, const value_type& __x)
+#else
insert(iterator __position, const value_type& __x)
+#endif
{ return _M_t._M_insert_equal_(__position, __x); }
/**
@@ -506,7 +510,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* responsibility.
*/
iterator
- erase(iterator __position)
+ erase(const_iterator __position)
{ return _M_t.erase(__position); }
#else
/**
@@ -552,10 +556,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* This function erases a sequence of elements from a %multimap.
* Note that this function only erases the elements, and that if
* the elements themselves are pointers, the pointed-to memory is not
- * touched in any way. Managing the pointer is the user's responsibility.
+ * touched in any way. Managing the pointer is the user's
+ * responsibility.
*/
iterator
- erase(iterator __first, iterator __last)
+ erase(const_iterator __first, const_iterator __last)
{ return _M_t.erase(__first, __last); }
#else
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -569,7 +574,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* This function erases a sequence of elements from a %multimap.
* Note that this function only erases the elements, and that if
* the elements themselves are pointers, the pointed-to memory is not
- * touched in any way. Managing the pointer is the user's responsibility.
+ * touched in any way. Managing the pointer is the user's
+ * responsibility.
*/
void
erase(iterator __first, iterator __last)
diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h
index cfe849b..20d7f50 100644
--- a/libstdc++-v3/include/bits/stl_multiset.h
+++ b/libstdc++-v3/include/bits/stl_multiset.h
@@ -417,7 +417,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* Insertion requires logarithmic time (if the hint is not taken).
*/
iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ insert(const_iterator __position, const value_type& __x)
+#else
insert(iterator __position, const value_type& __x)
+#endif
{ return _M_t._M_insert_equal_(__position, __x); }
/**
@@ -463,7 +467,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* responsibility.
*/
iterator
- erase(iterator __position)
+ erase(const_iterator __position)
{ return _M_t.erase(__position); }
#else
/**
@@ -509,10 +513,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* This function erases a sequence of elements from a %multiset.
* Note that this function only erases the elements, and that if
* the elements themselves are pointers, the pointed-to memory is not
- * touched in any way. Managing the pointer is the user's responsibility.
+ * touched in any way. Managing the pointer is the user's
+ * responsibility.
*/
iterator
- erase(iterator __first, iterator __last)
+ erase(const_iterator __first, const_iterator __last)
{ return _M_t.erase(__first, __last); }
#else
/**
@@ -524,7 +529,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* This function erases a sequence of elements from a %multiset.
* Note that this function only erases the elements, and that if
* the elements themselves are pointers, the pointed-to memory is not
- * touched in any way. Managing the pointer is the user's responsibility.
+ * touched in any way. Managing the pointer is the user's
+ * responsibility.
*/
void
erase(iterator __first, iterator __last)
diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h
index ce5bc6c..211b67e 100644
--- a/libstdc++-v3/include/bits/stl_set.h
+++ b/libstdc++-v3/include/bits/stl_set.h
@@ -429,7 +429,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* Insertion requires logarithmic time (if the hint is not taken).
*/
iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ insert(const_iterator __position, const value_type& __x)
+#else
insert(iterator __position, const value_type& __x)
+#endif
{ return _M_t._M_insert_unique_(__position, __x); }
/**
@@ -472,10 +476,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* This function erases an element, pointed to by the given iterator,
* from a %set. Note that this function only erases the element, and
* that if the element is itself a pointer, the pointed-to memory is not
- * touched in any way. Managing the pointer is the user's responsibility.
+ * touched in any way. Managing the pointer is the user's
+ * responsibility.
*/
iterator
- erase(iterator __position)
+ erase(const_iterator __position)
{ return _M_t.erase(__position); }
#else
/**
@@ -485,7 +490,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* This function erases an element, pointed to by the given iterator,
* from a %set. Note that this function only erases the element, and
* that if the element is itself a pointer, the pointed-to memory is not
- * touched in any way. Managing the pointer is the user's responsibility.
+ * touched in any way. Managing the pointer is the user's
+ * responsibility.
*/
void
erase(iterator __position)
@@ -523,7 +529,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* in any way. Managing the pointer is the user's responsibility.
*/
iterator
- erase(iterator __first, iterator __last)
+ erase(const_iterator __first, const_iterator __last)
{ return _M_t.erase(__first, __last); }
#else
/**
diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index 4e9fdf7..b85398d 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -702,22 +702,30 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
void
_M_insert_equal(_InputIterator __first, _InputIterator __last);
+ private:
+ void
+ _M_erase_aux(const_iterator __position);
+
+ void
+ _M_erase_aux(const_iterator __first, const_iterator __last);
+
+ public:
#ifdef __GXX_EXPERIMENTAL_CXX0X__
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 130. Associative erase should return an iterator.
iterator
- erase(iterator __position);
-
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // DR 130. Associative erase should return an iterator.
- const_iterator
- erase(const_iterator __position);
+ erase(const_iterator __position)
+ {
+ const_iterator __result = __position;
+ ++__result;
+ _M_erase_aux(__position);
+ return iterator(static_cast<_Link_type>
+ (const_cast<_Base_ptr>(__result._M_node)));
+ }
#else
void
- erase(iterator __position);
-
- void
- erase(const_iterator __position);
+ erase(const_iterator __position)
+ { _M_erase_aux(__position); }
#endif
size_type
erase(const key_type& __x);
@@ -726,18 +734,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 130. Associative erase should return an iterator.
iterator
- erase(iterator __first, iterator __last);
-
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // DR 130. Associative erase should return an iterator.
- const_iterator
- erase(const_iterator __first, const_iterator __last);
+ erase(const_iterator __first, const_iterator __last)
+ {
+ _M_erase_aux(__first, __last);
+ return iterator(static_cast<_Link_type>
+ (const_cast<_Base_ptr>(__last._M_node)));
+ }
#else
void
- erase(iterator __first, iterator __last);
-
- void
- erase(const_iterator __first, const_iterator __last);
+ erase(const_iterator __first, const_iterator __last)
+ { _M_erase_aux(__first, __last); }
#endif
void
erase(const key_type* __first, const key_type* __last);
@@ -1353,64 +1359,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_insert_equal_(end(), *__first);
}
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // DR 130. Associative erase should return an iterator.
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
- _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
- erase(iterator __position)
- {
- iterator __result = __position;
- ++__result;
- _Link_type __y =
- static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
- (__position._M_node,
- this->_M_impl._M_header));
- _M_destroy_node(__y);
- --_M_impl._M_node_count;
- return __result;
- }
-
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // DR 130. Associative erase should return an iterator.
- template<typename _Key, typename _Val, typename _KeyOfValue,
- typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
- _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
- erase(const_iterator __position)
- {
- const_iterator __result = __position;
- ++__result;
- _Link_type __y =
- static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
- (const_cast<_Base_ptr>(__position._M_node),
- this->_M_impl._M_header));
- _M_destroy_node(__y);
- --_M_impl._M_node_count;
- return __result;
- }
-#else
- template<typename _Key, typename _Val, typename _KeyOfValue,
- typename _Compare, typename _Alloc>
- inline void
- _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
- erase(iterator __position)
- {
- _Link_type __y =
- static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
- (__position._M_node,
- this->_M_impl._M_header));
- _M_destroy_node(__y);
- --_M_impl._M_node_count;
- }
-
- template<typename _Key, typename _Val, typename _KeyOfValue,
- typename _Compare, typename _Alloc>
- inline void
+ void
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
- erase(const_iterator __position)
+ _M_erase_aux(const_iterator __position)
{
_Link_type __y =
static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
@@ -1419,68 +1372,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_destroy_node(__y);
--_M_impl._M_node_count;
}
-#endif
-
- template<typename _Key, typename _Val, typename _KeyOfValue,
- typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
- _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
- erase(const _Key& __x)
- {
- pair<iterator, iterator> __p = equal_range(__x);
- const size_type __old_size = size();
- erase(__p.first, __p.second);
- return __old_size - size();
- }
-
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // DR 130. Associative erase should return an iterator.
- template<typename _Key, typename _Val, typename _KeyOfValue,
- typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
- _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
- erase(iterator __first, iterator __last)
- {
- if (__first == begin() && __last == end())
- {
- clear();
- return end();
- }
- else
- {
- while (__first != __last)
- erase(__first++);
- return __last;
- }
- }
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // DR 130. Associative erase should return an iterator.
- template<typename _Key, typename _Val, typename _KeyOfValue,
- typename _Compare, typename _Alloc>
- typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
- _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
- erase(const_iterator __first, const_iterator __last)
- {
- if (__first == begin() && __last == end())
- {
- clear();
- return end();
- }
- else
- {
- while (__first != __last)
- erase(__first++);
- return __last;
- }
- }
-#else
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
void
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
- erase(iterator __first, iterator __last)
+ _M_erase_aux(const_iterator __first, const_iterator __last)
{
if (__first == begin() && __last == end())
clear();
@@ -1491,17 +1388,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
- void
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
- erase(const_iterator __first, const_iterator __last)
+ erase(const _Key& __x)
{
- if (__first == begin() && __last == end())
- clear();
- else
- while (__first != __last)
- erase(__first++);
+ pair<iterator, iterator> __p = equal_range(__x);
+ const size_type __old_size = size();
+ erase(__p.first, __p.second);
+ return __old_size - size();
}
-#endif
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
diff --git a/libstdc++-v3/include/profile/map.h b/libstdc++-v3/include/profile/map.h
index 3f668af..5bc9ab9 100644
--- a/libstdc++-v3/include/profile/map.h
+++ b/libstdc++-v3/include/profile/map.h
@@ -251,17 +251,22 @@ namespace __profile
size_type size_before = size();
_Base::insert(__list);
__profcxx_map_to_unordered_map_insert(this, size_before,
- size() - size_before);
+ size() - size_before);
}
#endif
iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ insert(const_iterator __position, const value_type& __x)
+#else
insert(iterator __position, const value_type& __x)
+#endif
{
size_type size_before = size();
- return iterator(_Base::insert(__position, __x));
+ iterator __i = iterator(_Base::insert(__position, __x));
__profcxx_map_to_unordered_map_insert(this, size_before,
- size() - size_before);
+ size() - size_before);
+ return __i;
}
template<typename _InputIterator>
@@ -276,7 +281,7 @@ namespace __profile
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
- erase(iterator __position)
+ erase(const_iterator __position)
{
iterator __i = _Base::erase(__position);
__profcxx_map_to_unordered_map_erase(this, size(), 1);
@@ -306,31 +311,18 @@ namespace __profile
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
- erase(iterator __first, iterator __last)
- {
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // 151. can't currently clear() empty container
- while (__first != __last)
- this->erase(__first++);
- return __last;
- }
+ erase(const_iterator __first, const_iterator __last)
+ { return iterator(_Base::erase(__first, __last)); }
#else
void
erase(iterator __first, iterator __last)
- {
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // 151. can't currently clear() empty container
- while (__first != __last)
- this->erase(__first++);
- }
+ { _Base::erase(__first, __last); }
#endif
void
swap(map& __x)
- {
- _Base::swap(__x);
- }
+ { _Base::swap(__x); }
void
clear()
diff --git a/libstdc++-v3/include/profile/multimap.h b/libstdc++-v3/include/profile/multimap.h
index 2897614..6fe7f5b 100644
--- a/libstdc++-v3/include/profile/multimap.h
+++ b/libstdc++-v3/include/profile/multimap.h
@@ -192,22 +192,22 @@ namespace __profile
#endif
iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ insert(const_iterator __position, const value_type& __x)
+#else
insert(iterator __position, const value_type& __x)
- {
- return iterator(_Base::insert(__position, __x));
- }
+#endif
+ { return iterator(_Base::insert(__position, __x)); }
template<typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last)
- {
- _Base::insert(__first, __last);
- }
+ { _Base::insert(__first, __last); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
- erase(iterator __position)
- { return _Base::erase(__position); }
+ erase(const_iterator __position)
+ { return iterator(_Base::erase(__position)); }
#else
void
erase(iterator __position)
@@ -230,30 +230,17 @@ namespace __profile
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
- erase(iterator __first, iterator __last)
- {
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // 151. can't currently clear() empty container
- while (__first != __last)
- this->erase(__first++);
- return __last;
- }
+ erase(const_iterator __first, const_iterator __last)
+ { return iterator(_Base::erase(__first, __last)); }
#else
void
erase(iterator __first, iterator __last)
- {
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // 151. can't currently clear() empty container
- while (__first != __last)
- this->erase(__first++);
- }
+ { _Base::erase(__first, __last); }
#endif
void
swap(multimap& __x)
- {
- _Base::swap(__x);
- }
+ { _Base::swap(__x); }
void
clear()
diff --git a/libstdc++-v3/include/profile/multiset.h b/libstdc++-v3/include/profile/multiset.h
index 3c113ef..d66fa0c 100644
--- a/libstdc++-v3/include/profile/multiset.h
+++ b/libstdc++-v3/include/profile/multiset.h
@@ -184,17 +184,17 @@ namespace __profile
{ return iterator(_Base::insert(__x)); }
iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ insert(const_iterator __position, const value_type& __x)
+#else
insert(iterator __position, const value_type& __x)
- {
- return iterator(_Base::insert(__position, __x));
- }
+#endif
+ { return iterator(_Base::insert(__position, __x)); }
template<typename _InputIterator>
- void
- insert(_InputIterator __first, _InputIterator __last)
- {
- _Base::insert(__first, __last);
- }
+ void
+ insert(_InputIterator __first, _InputIterator __last)
+ { _Base::insert(__first, __last); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
void
@@ -204,8 +204,8 @@ namespace __profile
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
- erase(iterator __position)
- { return _Base::erase(__position); }
+ erase(const_iterator __position)
+ { return iterator(_Base::erase(__position)); }
#else
void
erase(iterator __position)
@@ -228,30 +228,17 @@ namespace __profile
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
- erase(iterator __first, iterator __last)
- {
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // 151. can't currently clear() empty container
- while (__first != __last)
- this->erase(__first++);
- return __last;
- }
+ erase(const_iterator __first, const_iterator __last)
+ { return iterator(_Base::erase(__first, __last)); }
#else
void
erase(iterator __first, iterator __last)
- {
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // 151. can't currently clear() empty container
- while (__first != __last)
- this->erase(__first++);
- }
+ { _Base::erase(__first, __last); }
#endif
void
swap(multiset& __x)
- {
- _Base::swap(__x);
- }
+ { _Base::swap(__x); }
void
clear()
diff --git a/libstdc++-v3/include/profile/set.h b/libstdc++-v3/include/profile/set.h
index 42acf72..f6941eb 100644
--- a/libstdc++-v3/include/profile/set.h
+++ b/libstdc++-v3/include/profile/set.h
@@ -189,17 +189,17 @@ namespace __profile
}
iterator
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ insert(const_iterator __position, const value_type& __x)
+#else
insert(iterator __position, const value_type& __x)
- {
- return iterator(_Base::insert(__position, __x));
- }
+#endif
+ { return iterator(_Base::insert(__position, __x)); }
template <typename _InputIterator>
void
insert(_InputIterator __first, _InputIterator __last)
- {
- _Base::insert(__first, __last);
- }
+ { _Base::insert(__first, __last); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
void
@@ -209,8 +209,8 @@ namespace __profile
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
- erase(iterator __position)
- { return _Base::erase(__position); }
+ erase(const_iterator __position)
+ { return iterator(_Base::erase(__position)); }
#else
void
erase(iterator __position)
@@ -232,30 +232,17 @@ namespace __profile
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
- erase(iterator __first, iterator __last)
- {
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // 151. can't currently clear() empty container
- while (__first != __last)
- this->erase(__first++);
- return __last;
- }
+ erase(const_iterator __first, const_iterator __last)
+ { return iterator(_Base::erase(__first, __last)); }
#else
void
erase(iterator __first, iterator __last)
- {
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // 151. can't currently clear() empty container
- while (__first != __last)
- this->erase(__first++);
- }
+ { _Base::erase(__first, __last); }
#endif
void
swap(set& __x)
- {
- _Base::swap(__x);
- }
+ { _Base::swap(__x); }
void
clear()
diff --git a/libstdc++-v3/testsuite/util/exception/safety.h b/libstdc++-v3/testsuite/util/exception/safety.h
index cab31e2..9468bff 100644
--- a/libstdc++-v3/testsuite/util/exception/safety.h
+++ b/libstdc++-v3/testsuite/util/exception/safety.h
@@ -251,91 +251,93 @@ namespace __gnu_test
struct erase_base
{
typedef typename _Tp::iterator iterator;
+ typedef typename _Tp::const_iterator const_iterator;
- iterator (_Tp::* _F_erase_point)(iterator);
- iterator (_Tp::* _F_erase_range)(iterator, iterator);
+ iterator (_Tp::* _F_erase_point)(const_iterator);
+ iterator (_Tp::* _F_erase_range)(const_iterator, const_iterator);
erase_base()
: _F_erase_point(&_Tp::erase), _F_erase_range(&_Tp::erase) { }
};
- // Specialization, as forward_list has erase_after.
- template<typename _Tp1, typename _Tp2>
- struct erase_base<std::forward_list<_Tp1, _Tp2>>
+ // Specializations, old C++03 signatures.
+ template<typename _Tp1, typename _Tp2, typename _Tp3>
+ struct erase_base<std::basic_string<_Tp1, _Tp2, _Tp3>>
{
- typedef std::forward_list<_Tp1, _Tp2> container_type;
+ typedef std::basic_string<_Tp1, _Tp2, _Tp3> container_type;
typedef typename container_type::iterator iterator;
- typedef typename container_type::const_iterator const_iterator;
- iterator (container_type::* _F_erase_point)(const_iterator);
- iterator (container_type::* _F_erase_range)(const_iterator,
- const_iterator);
+ iterator (container_type::* _F_erase_point)(iterator);
+ iterator (container_type::* _F_erase_range)(iterator, iterator);
erase_base()
- : _F_erase_point(&container_type::erase_after),
- _F_erase_range(&container_type::erase_after) { }
+ : _F_erase_point(&container_type::erase),
+ _F_erase_range(&container_type::erase) { }
};
- // Specializations for the unordered containers.
template<typename _Tp1, typename _Tp2, typename _Tp3,
- typename _Tp4, typename _Tp5>
- struct erase_base<std::unordered_map<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>>
+ template <typename, typename, typename> class _Tp4>
+ struct erase_base<__gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>>
{
- typedef std::unordered_map<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>
+ typedef __gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>
container_type;
typedef typename container_type::iterator iterator;
- typedef typename container_type::const_iterator const_iterator;
- iterator (container_type::* _F_erase_point)(const_iterator);
- iterator (container_type::* _F_erase_range)(const_iterator,
- const_iterator);
+ iterator (container_type::* _F_erase_point)(iterator);
+ iterator (container_type::* _F_erase_range)(iterator, iterator);
erase_base()
: _F_erase_point(&container_type::erase),
_F_erase_range(&container_type::erase) { }
};
- template<typename _Tp1, typename _Tp2, typename _Tp3,
- typename _Tp4, typename _Tp5>
- struct erase_base<std::unordered_multimap<_Tp1, _Tp2, _Tp3,
- _Tp4, _Tp5>>
+ template<typename _Tp1, typename _Tp2>
+ struct erase_base<std::deque<_Tp1, _Tp2>>
{
- typedef std::unordered_multimap<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>
- container_type;
+ typedef std::deque<_Tp1, _Tp2> container_type;
typedef typename container_type::iterator iterator;
- typedef typename container_type::const_iterator const_iterator;
- iterator (container_type::* _F_erase_point)(const_iterator);
- iterator (container_type::* _F_erase_range)(const_iterator,
- const_iterator);
+ iterator (container_type::* _F_erase_point)(iterator);
+ iterator (container_type::* _F_erase_range)(iterator, iterator);
+
+ erase_base()
+ : _F_erase_point(&container_type::erase),
+ _F_erase_range(&container_type::erase) { }
+ };
+
+ template<typename _Tp1, typename _Tp2>
+ struct erase_base<std::list<_Tp1, _Tp2>>
+ {
+ typedef std::list<_Tp1, _Tp2> container_type;
+ typedef typename container_type::iterator iterator;
+
+ iterator (container_type::* _F_erase_point)(iterator);
+ iterator (container_type::* _F_erase_range)(iterator, iterator);
erase_base()
: _F_erase_point(&container_type::erase),
_F_erase_range(&container_type::erase) { }
};
- template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
- struct erase_base<std::unordered_set<_Tp1, _Tp2, _Tp3, _Tp4>>
+ template<typename _Tp1, typename _Tp2>
+ struct erase_base<std::vector<_Tp1, _Tp2>>
{
- typedef std::unordered_set<_Tp1, _Tp2, _Tp3, _Tp4>
- container_type;
+ typedef std::vector<_Tp1, _Tp2> container_type;
typedef typename container_type::iterator iterator;
- typedef typename container_type::const_iterator const_iterator;
- iterator (container_type::* _F_erase_point)(const_iterator);
- iterator (container_type::* _F_erase_range)(const_iterator,
- const_iterator);
+ iterator (container_type::* _F_erase_point)(iterator);
+ iterator (container_type::* _F_erase_range)(iterator, iterator);
erase_base()
: _F_erase_point(&container_type::erase),
_F_erase_range(&container_type::erase) { }
};
- template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
- struct erase_base<std::unordered_multiset<_Tp1, _Tp2, _Tp3, _Tp4>>
+ // Specialization, as forward_list has erase_after.
+ template<typename _Tp1, typename _Tp2>
+ struct erase_base<std::forward_list<_Tp1, _Tp2>>
{
- typedef std::unordered_multiset<_Tp1, _Tp2, _Tp3, _Tp4>
- container_type;
+ typedef std::forward_list<_Tp1, _Tp2> container_type;
typedef typename container_type::iterator iterator;
typedef typename container_type::const_iterator const_iterator;
@@ -344,8 +346,8 @@ namespace __gnu_test
const_iterator);
erase_base()
- : _F_erase_point(&container_type::erase),
- _F_erase_range(&container_type::erase) { }
+ : _F_erase_point(&container_type::erase_after),
+ _F_erase_range(&container_type::erase_after) { }
};
template<typename _Tp,
@@ -633,109 +635,87 @@ namespace __gnu_test
struct insert_base
{
typedef typename _Tp::iterator iterator;
+ typedef typename _Tp::const_iterator const_iterator;
typedef typename _Tp::value_type value_type;
- iterator (_Tp::* _F_insert_point)(iterator, const value_type&);
+ iterator (_Tp::* _F_insert_point)(const_iterator, const value_type&);
insert_base() : _F_insert_point(&_Tp::insert) { }
};
- // Specialization, as string insertion has a different signature.
- template<typename _Tp1, typename _Tp2, typename _Tp3>
- struct insert_base<std::basic_string<_Tp1, _Tp2, _Tp3>>
+ // Specializations, old C++03 signatures.
+ template<typename _Tp1, typename _Tp2>
+ struct insert_base<std::deque<_Tp1, _Tp2>>
{
- typedef std::basic_string<_Tp1, _Tp2, _Tp3> container_type;
+ typedef std::deque<_Tp1, _Tp2> container_type;
typedef typename container_type::iterator iterator;
typedef typename container_type::value_type value_type;
- iterator (container_type::* _F_insert_point)(iterator, value_type);
+ iterator (container_type::* _F_insert_point)(iterator,
+ const value_type&);
insert_base() : _F_insert_point(&container_type::insert) { }
};
- template<typename _Tp1, typename _Tp2, typename _Tp3,
- template <typename, typename, typename> class _Tp4>
- struct insert_base<__gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>>
+ template<typename _Tp1, typename _Tp2>
+ struct insert_base<std::list<_Tp1, _Tp2>>
{
- typedef __gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>
- container_type;
+ typedef std::list<_Tp1, _Tp2> container_type;
typedef typename container_type::iterator iterator;
typedef typename container_type::value_type value_type;
- iterator (container_type::* _F_insert_point)(iterator, value_type);
+ iterator (container_type::* _F_insert_point)(iterator,
+ const value_type&);
insert_base() : _F_insert_point(&container_type::insert) { }
};
- // Specialization, as forward_list insertion has a different signature.
template<typename _Tp1, typename _Tp2>
- struct insert_base<std::forward_list<_Tp1, _Tp2>>
+ struct insert_base<std::vector<_Tp1, _Tp2>>
{
- typedef std::forward_list<_Tp1, _Tp2> container_type;
+ typedef std::vector<_Tp1, _Tp2> container_type;
typedef typename container_type::iterator iterator;
- typedef typename container_type::const_iterator const_iterator;
typedef typename container_type::value_type value_type;
- iterator (container_type::* _F_insert_point)(const_iterator,
- const value_type&);
-
- insert_base() : _F_insert_point(&container_type::insert_after) { }
- };
-
- // Likewise for the unordered containers.
- template<typename _Tp1, typename _Tp2, typename _Tp3,
- typename _Tp4, typename _Tp5>
- struct insert_base<std::unordered_map<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>>
- {
- typedef std::unordered_map<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>
- container_type;
- typedef typename container_type::iterator iterator;
- typedef typename container_type::const_iterator const_iterator;
- typedef typename container_type::value_type value_type;
-
- iterator (container_type::* _F_insert_point)(const_iterator,
+ iterator (container_type::* _F_insert_point)(iterator,
const value_type&);
insert_base() : _F_insert_point(&container_type::insert) { }
};
- template<typename _Tp1, typename _Tp2, typename _Tp3,
- typename _Tp4, typename _Tp5>
- struct insert_base<std::unordered_multimap<_Tp1, _Tp2, _Tp3,
- _Tp4, _Tp5>>
+ // Specialization, as string insertion has a different signature.
+ template<typename _Tp1, typename _Tp2, typename _Tp3>
+ struct insert_base<std::basic_string<_Tp1, _Tp2, _Tp3>>
{
- typedef std::unordered_multimap<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>
- container_type;
+ typedef std::basic_string<_Tp1, _Tp2, _Tp3> container_type;
typedef typename container_type::iterator iterator;
- typedef typename container_type::const_iterator const_iterator;
typedef typename container_type::value_type value_type;
- iterator (container_type::* _F_insert_point)(const_iterator,
- const value_type&);
+ iterator (container_type::* _F_insert_point)(iterator, value_type);
insert_base() : _F_insert_point(&container_type::insert) { }
};
- template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
- struct insert_base<std::unordered_set<_Tp1, _Tp2, _Tp3, _Tp4>>
+ // Likewise for __versa_string.
+ template<typename _Tp1, typename _Tp2, typename _Tp3,
+ template <typename, typename, typename> class _Tp4>
+ struct insert_base<__gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>>
{
- typedef std::unordered_set<_Tp1, _Tp2, _Tp3, _Tp4>
+ typedef __gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>
container_type;
typedef typename container_type::iterator iterator;
- typedef typename container_type::const_iterator const_iterator;
typedef typename container_type::value_type value_type;
- iterator (container_type::* _F_insert_point)(const_iterator,
- const value_type&);
+ iterator (container_type::* _F_insert_point)(iterator, value_type);
insert_base() : _F_insert_point(&container_type::insert) { }
};
- template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
- struct insert_base<std::unordered_multiset<_Tp1, _Tp2, _Tp3, _Tp4>>
+ // Specialization, as forward_list has insert_after.
+ template<typename _Tp1, typename _Tp2>
+ struct insert_base<std::forward_list<_Tp1, _Tp2>>
{
- typedef std::unordered_multiset<_Tp1, _Tp2, _Tp3, _Tp4>
- container_type;
+ typedef std::forward_list<_Tp1, _Tp2> container_type;
typedef typename container_type::iterator iterator;
typedef typename container_type::const_iterator const_iterator;
typedef typename container_type::value_type value_type;
@@ -743,7 +723,7 @@ namespace __gnu_test
iterator (container_type::* _F_insert_point)(const_iterator,
const value_type&);
- insert_base() : _F_insert_point(&container_type::insert) { }
+ insert_base() : _F_insert_point(&container_type::insert_after) { }
};
template<typename _Tp,