stl_tree.h (_Rb_tree<>::_M_const_cast_iter): Remove.

2010-11-14  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/stl_tree.h (_Rb_tree<>::_M_const_cast_iter): Remove.
	(_Rb_tree_const_iterator<>::_M_const_cast): Add.
	(_Rb_tree<>::erase, _M_insert_unique_): Adjust.
	* include/debug/map.h (map<>::erase, insert): Fix C++0x signatures.
	* include/debug/multimap.h (multimap<>::erase, insert): Likewise.
	* include/debug/set.h (set<>::erase, insert): Fix, only cosmetic
	changes in this case.
	* include/debug/multiset.h (multiset<>::erase, insert): Likewise.
	* include/profile/set.h (set<>::insert): Remove redundant macro.
	* include/profile/multiset.h (multiset<>::insert): Likewise.
	* include/bits/stl_set.h (set<>::insert): Likewise.
	* include/bits/stl_multiset.h (multiset<>::insert): Likewise.

From-SVN: r166734
This commit is contained in:
Paolo Carlini 2010-11-14 18:41:01 +00:00 committed by Paolo Carlini
parent fc3f9236ec
commit 6b6d5d0922
10 changed files with 46 additions and 39 deletions

View File

@ -1,3 +1,18 @@
2010-11-14 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_tree.h (_Rb_tree<>::_M_const_cast_iter): Remove.
(_Rb_tree_const_iterator<>::_M_const_cast): Add.
(_Rb_tree<>::erase, _M_insert_unique_): Adjust.
* include/debug/map.h (map<>::erase, insert): Fix C++0x signatures.
* include/debug/multimap.h (multimap<>::erase, insert): Likewise.
* include/debug/set.h (set<>::erase, insert): Fix, only cosmetic
changes in this case.
* include/debug/multiset.h (multiset<>::erase, insert): Likewise.
* include/profile/set.h (set<>::insert): Remove redundant macro.
* include/profile/multiset.h (multiset<>::insert): Likewise.
* include/bits/stl_set.h (set<>::insert): Likewise.
* include/bits/stl_multiset.h (multiset<>::insert): Likewise.
2010-11-12 Ian Lance Taylor <iant@google.com>
PR other/46332

View File

@ -423,11 +423,7 @@ _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); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__

View File

@ -439,11 +439,7 @@ _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); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__

View File

@ -247,6 +247,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_Rb_tree_const_iterator(const iterator& __it)
: _M_node(__it._M_node) { }
iterator
_M_const_cast() const
{ return iterator(static_cast<typename iterator::_Link_type>
(const_cast<typename iterator::_Base_ptr>(_M_node))); }
reference
operator*() const
{ return static_cast<_Link_type>(_M_node)->_M_value_field; }
@ -556,11 +561,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
private:
iterator
_M_const_cast_iter(const_iterator __cit)
{ return iterator(static_cast<_Link_type>
(const_cast<_Base_ptr>(__cit._M_node))); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename _Arg>
iterator
@ -756,7 +756,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const_iterator __result = __position;
++__result;
_M_erase_aux(__position);
return _M_const_cast_iter(__result);
return __result._M_const_cast();
}
#else
void
@ -773,7 +773,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
erase(const_iterator __first, const_iterator __last)
{
_M_erase_aux(__first, __last);
return _M_const_cast_iter(__last);
return __last._M_const_cast();
}
#else
void
@ -1364,7 +1364,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
else
// Equivalent keys.
return _M_const_cast_iter(__position);
return __position._M_const_cast();
}
template<typename _Key, typename _Val, typename _KeyOfValue,

View File

@ -232,7 +232,11 @@ namespace __debug
#endif
iterator
#ifdef __GXX_EXPERIMENTAL_CXX0X__
insert(const_iterator __position, const value_type& __x)
#else
insert(iterator __position, const value_type& __x)
#endif
{
__glibcxx_check_insert(__position);
return iterator(_Base::insert(__position.base(), __x), this);
@ -262,7 +266,7 @@ namespace __debug
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
erase(iterator __position)
erase(const_iterator __position)
{
__glibcxx_check_erase(__position);
__position._M_invalidate();
@ -294,14 +298,14 @@ namespace __debug
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
erase(iterator __first, iterator __last)
erase(const_iterator __first, const_iterator __last)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 151. can't currently clear() empty container
__glibcxx_check_erase_range(__first, __last);
while (__first != __last)
this->erase(__first++);
return __last;
return iterator(__last.base()._M_const_cast(), this);
}
#else
void

View File

@ -213,7 +213,11 @@ namespace __debug
#endif
iterator
insert(iterator __position, const value_type& __x)
#ifdef __GXX_EXPERIMENTAL_CXX0X__
insert(const_iterator __position, const value_type& __x)
#else
insert(iterator __position, const value_type& __x)
#endif
{
__glibcxx_check_insert(__position);
return iterator(_Base::insert(__position.base(), __x), this);
@ -243,7 +247,7 @@ namespace __debug
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
erase(iterator __position)
erase(const_iterator __position)
{
__glibcxx_check_erase(__position);
__position._M_invalidate();
@ -276,14 +280,14 @@ namespace __debug
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
erase(iterator __first, iterator __last)
erase(const_iterator __first, const_iterator __last)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 151. can't currently clear() empty container
__glibcxx_check_erase_range(__first, __last);
while (__first != __last)
this->erase(__first++);
return __last;
return iterator(__last.base()._M_const_cast(), this);
}
#else
void

View File

@ -201,7 +201,7 @@ namespace __debug
#endif
iterator
insert(iterator __position, const value_type& __x)
insert(const_iterator __position, const value_type& __x)
{
__glibcxx_check_insert(__position);
return iterator(_Base::insert(__position.base(), __x), this);
@ -234,7 +234,7 @@ namespace __debug
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
erase(iterator __position)
erase(const_iterator __position)
{
__glibcxx_check_erase(__position);
__position._M_invalidate();
@ -267,14 +267,14 @@ namespace __debug
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
erase(iterator __first, iterator __last)
erase(const_iterator __first, const_iterator __last)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 151. can't currently clear() empty container
__glibcxx_check_erase_range(__first, __last);
while (__first != __last)
this->erase(__first++);
return __last;
return __last; // iterator == const_iterator
}
#else
void

View File

@ -212,7 +212,7 @@ namespace __debug
#endif
iterator
insert(iterator __position, const value_type& __x)
insert(const_iterator __position, const value_type& __x)
{
__glibcxx_check_insert(__position);
return iterator(_Base::insert(__position.base(), __x), this);
@ -245,7 +245,7 @@ namespace __debug
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
erase(iterator __position)
erase(const_iterator __position)
{
__glibcxx_check_erase(__position);
__position._M_invalidate();
@ -277,14 +277,14 @@ namespace __debug
#ifdef __GXX_EXPERIMENTAL_CXX0X__
iterator
erase(iterator __first, iterator __last)
erase(const_iterator __first, const_iterator __last)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 151. can't currently clear() empty container
__glibcxx_check_erase_range(__first, __last);
while (__first != __last)
this->erase(__first++);
return __last;
return __last; // iterator == const_iterator
}
#else
void

View File

@ -190,11 +190,7 @@ namespace __profile
#endif
iterator
#ifdef __GXX_EXPERIMENTAL_CXX0X__
insert(const_iterator __position, const value_type& __x)
#else
insert(iterator __position, const value_type& __x)
#endif
{ return iterator(_Base::insert(__position, __x)); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__

View File

@ -201,11 +201,7 @@ namespace __profile
#endif
iterator
#ifdef __GXX_EXPERIMENTAL_CXX0X__
insert(const_iterator __position, const value_type& __x)
#else
insert(iterator __position, const value_type& __x)
#endif
{ return iterator(_Base::insert(__position, __x)); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__