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
This commit is contained in:
Paolo Carlini 2010-11-08 16:07:32 +00:00 committed by Paolo Carlini
parent 7876e2b5f4
commit 7606bd1197
11 changed files with 270 additions and 399 deletions

View File

@ -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&&)):

View File

@ -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
/**

View File

@ -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)

View File

@ -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)

View File

@ -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
/**

View File

@ -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
void
_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
_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,7 +1372,19 @@ _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>
void
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
_M_erase_aux(const_iterator __first, const_iterator __last)
{
if (__first == begin() && __last == end())
clear();
else
while (__first != __last)
erase(__first++);
}
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
@ -1433,76 +1398,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
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)
{
if (__first == begin() && __last == end())
clear();
else
while (__first != __last)
erase(__first++);
}
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
void
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
erase(const_iterator __first, const_iterator __last)
{
if (__first == begin() && __last == end())
clear();
else
while (__first != __last)
erase(__first++);
}
#endif
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
void

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -251,14 +251,88 @@ 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) { }
};
// Specializations, old C++03 signatures.
template<typename _Tp1, typename _Tp2, typename _Tp3>
struct erase_base<std::basic_string<_Tp1, _Tp2, _Tp3>>
{
typedef std::basic_string<_Tp1, _Tp2, _Tp3> 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,
template <typename, typename, typename> class _Tp4>
struct erase_base<__gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>>
{
typedef __gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>
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>
struct erase_base<std::deque<_Tp1, _Tp2>>
{
typedef std::deque<_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>
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>
struct erase_base<std::vector<_Tp1, _Tp2>>
{
typedef std::vector<_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) { }
};
// Specialization, as forward_list has erase_after.
template<typename _Tp1, typename _Tp2>
struct erase_base<std::forward_list<_Tp1, _Tp2>>
@ -276,78 +350,6 @@ namespace __gnu_test
_F_erase_range(&container_type::erase_after) { }
};
// 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>>
{
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;
iterator (container_type::* _F_erase_point)(const_iterator);
iterator (container_type::* _F_erase_range)(const_iterator,
const_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>>
{
typedef std::unordered_multimap<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>
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);
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>>
{
typedef std::unordered_set<_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);
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>>
{
typedef std::unordered_multiset<_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);
erase_base()
: _F_erase_point(&container_type::erase),
_F_erase_range(&container_type::erase) { }
};
template<typename _Tp,
bool = traits<_Tp>::has_erase::value,
bool = traits<_Tp>::has_erase_after::value>
@ -633,13 +635,54 @@ 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) { }
};
// Specializations, old C++03 signatures.
template<typename _Tp1, typename _Tp2>
struct insert_base<std::deque<_Tp1, _Tp2>>
{
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,
const value_type&);
insert_base() : _F_insert_point(&container_type::insert) { }
};
template<typename _Tp1, typename _Tp2>
struct insert_base<std::list<_Tp1, _Tp2>>
{
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,
const value_type&);
insert_base() : _F_insert_point(&container_type::insert) { }
};
template<typename _Tp1, typename _Tp2>
struct insert_base<std::vector<_Tp1, _Tp2>>
{
typedef std::vector<_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,
const value_type&);
insert_base() : _F_insert_point(&container_type::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>>
@ -653,6 +696,7 @@ namespace __gnu_test
insert_base() : _F_insert_point(&container_type::insert) { }
};
// 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>>
@ -667,7 +711,7 @@ namespace __gnu_test
insert_base() : _F_insert_point(&container_type::insert) { }
};
// Specialization, as forward_list insertion has a different signature.
// Specialization, as forward_list has insert_after.
template<typename _Tp1, typename _Tp2>
struct insert_base<std::forward_list<_Tp1, _Tp2>>
{
@ -682,70 +726,6 @@ namespace __gnu_test
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,
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>>
{
typedef std::unordered_multimap<_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,
const 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>>
{
typedef std::unordered_set<_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&);
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>>
{
typedef std::unordered_multiset<_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&);
insert_base() : _F_insert_point(&container_type::insert) { }
};
template<typename _Tp,
bool = traits<_Tp>::has_insert::value,
bool = traits<_Tp>::has_insert_after::value>