Commit 11aaf40c by Paolo Carlini Committed by Paolo Carlini

stl_list.h: Trivial formatting fixes.

2004-10-03  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/stl_list.h: Trivial formatting fixes.
	* include/bits/stl_tree.h: Likewise.

From-SVN: r88451
parent 807e955b
2004-10-03 Paolo Carlini <pcarlini@suse.de> 2004-10-03 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_list.h: Trivial formatting fixes.
* include/bits/stl_tree.h: Likewise.
2004-10-03 Paolo Carlini <pcarlini@suse.de>
* include/bits/sstream.tcc (seekpos): In case of success, just * include/bits/sstream.tcc (seekpos): In case of success, just
return __sp. return __sp.
......
...@@ -888,7 +888,7 @@ namespace _GLIBCXX_STD ...@@ -888,7 +888,7 @@ namespace _GLIBCXX_STD
*/ */
void void
swap(list& __x) swap(list& __x)
{ _List_node_base::swap(this->_M_impl._M_node,__x._M_impl._M_node); } { _List_node_base::swap(this->_M_impl._M_node, __x._M_impl._M_node); }
/** /**
* Erases all the elements. Note that this function only erases * Erases all the elements. Note that this function only erases
...@@ -1115,7 +1115,7 @@ namespace _GLIBCXX_STD ...@@ -1115,7 +1115,7 @@ namespace _GLIBCXX_STD
_InputIterator __first, _InputIterator __last, _InputIterator __first, _InputIterator __last,
__false_type) __false_type)
{ {
for ( ; __first != __last; ++__first) for (; __first != __last; ++__first)
_M_insert(__pos, *__first); _M_insert(__pos, *__first);
} }
...@@ -1124,7 +1124,7 @@ namespace _GLIBCXX_STD ...@@ -1124,7 +1124,7 @@ namespace _GLIBCXX_STD
void void
_M_fill_insert(iterator __pos, size_type __n, const value_type& __x) _M_fill_insert(iterator __pos, size_type __n, const value_type& __x)
{ {
for ( ; __n > 0; --__n) for (; __n > 0; --__n)
_M_insert(__pos, __x); _M_insert(__pos, __x);
} }
...@@ -1132,7 +1132,7 @@ namespace _GLIBCXX_STD ...@@ -1132,7 +1132,7 @@ namespace _GLIBCXX_STD
// Moves the elements from [first,last) before position. // Moves the elements from [first,last) before position.
void void
_M_transfer(iterator __position, iterator __first, iterator __last) _M_transfer(iterator __position, iterator __first, iterator __last)
{ __position._M_node->transfer(__first._M_node,__last._M_node); } { __position._M_node->transfer(__first._M_node, __last._M_node); }
// Inserts new element at position given and with value given. // Inserts new element at position given and with value given.
void void
...@@ -1165,9 +1165,9 @@ namespace _GLIBCXX_STD ...@@ -1165,9 +1165,9 @@ namespace _GLIBCXX_STD
*/ */
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{ {
typedef typename list<_Tp,_Alloc>::const_iterator const_iterator; typedef typename list<_Tp, _Alloc>::const_iterator const_iterator;
const_iterator __end1 = __x.end(); const_iterator __end1 = __x.end();
const_iterator __end2 = __y.end(); const_iterator __end2 = __y.end();
...@@ -1194,32 +1194,32 @@ namespace _GLIBCXX_STD ...@@ -1194,32 +1194,32 @@ namespace _GLIBCXX_STD
*/ */
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator<(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) operator<(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{ return std::lexicographical_compare(__x.begin(), __x.end(), { return std::lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end()); } __y.begin(), __y.end()); }
/// Based on operator== /// Based on operator==
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator!=(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{ return !(__x == __y); } { return !(__x == __y); }
/// Based on operator< /// Based on operator<
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator>(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) operator>(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{ return __y < __x; } { return __y < __x; }
/// Based on operator< /// Based on operator<
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator<=(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{ return !(__y < __x); } { return !(__y < __x); }
/// Based on operator< /// Based on operator<
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator>=(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{ return !(__x < __y); } { return !(__x < __y); }
/// See std::list::swap(). /// See std::list::swap().
......
...@@ -461,8 +461,10 @@ namespace std ...@@ -461,8 +461,10 @@ namespace std
_Const_Link_type _Const_Link_type
_M_begin() const _M_begin() const
{ return static_cast< {
_Const_Link_type>(this->_M_impl._M_header._M_parent); } return static_cast<_Const_Link_type>
(this->_M_impl._M_header._M_parent);
}
_Link_type _Link_type
_M_end() _M_end()
...@@ -550,7 +552,7 @@ namespace std ...@@ -550,7 +552,7 @@ namespace std
: _M_impl(__a, __comp) : _M_impl(__a, __comp)
{ } { }
_Rb_tree(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x) _Rb_tree(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x)
: _M_impl(__x.get_allocator(), __x._M_impl._M_key_compare) : _M_impl(__x.get_allocator(), __x._M_impl._M_key_compare)
{ {
if (__x._M_root() != 0) if (__x._M_root() != 0)
...@@ -565,8 +567,8 @@ namespace std ...@@ -565,8 +567,8 @@ namespace std
~_Rb_tree() ~_Rb_tree()
{ _M_erase(_M_begin()); } { _M_erase(_M_begin()); }
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&
operator=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x); operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x);
// Accessors. // Accessors.
_Compare _Compare
...@@ -579,7 +581,10 @@ namespace std ...@@ -579,7 +581,10 @@ namespace std
const_iterator const_iterator
begin() const begin() const
{ return static_cast<_Const_Link_type>(this->_M_impl._M_header._M_left); } {
return static_cast<_Const_Link_type>
(this->_M_impl._M_header._M_left);
}
iterator iterator
end() end()
...@@ -618,7 +623,7 @@ namespace std ...@@ -618,7 +623,7 @@ namespace std
{ return size_type(-1); } { return size_type(-1); }
void void
swap(_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __t); swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t);
// Insert/erase. // Insert/erase.
pair<iterator,bool> pair<iterator,bool>
...@@ -699,8 +704,8 @@ namespace std ...@@ -699,8 +704,8 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
inline bool inline bool
operator==(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{ {
return __x.size() == __y.size() return __x.size() == __y.size()
&& equal(__x.begin(), __x.end(), __y.begin()); && equal(__x.begin(), __x.end(), __y.begin());
...@@ -709,8 +714,8 @@ namespace std ...@@ -709,8 +714,8 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
inline bool inline bool
operator<(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{ {
return lexicographical_compare(__x.begin(), __x.end(), return lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end()); __y.begin(), __y.end());
...@@ -719,43 +724,43 @@ namespace std ...@@ -719,43 +724,43 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
inline bool inline bool
operator!=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, operator!=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{ return !(__x == __y); } { return !(__x == __y); }
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
inline bool inline bool
operator>(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, operator>(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{ return __y < __x; } { return __y < __x; }
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
inline bool inline bool
operator<=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, operator<=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{ return !(__y < __x); } { return !(__y < __x); }
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
inline bool inline bool
operator>=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, operator>=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{ return !(__x < __y); } { return !(__x < __y); }
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
inline void inline void
swap(_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
{ __x.swap(__y); } { __x.swap(__y); }
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
operator=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x) operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x)
{ {
if (this != &__x) if (this != &__x)
{ {
...@@ -775,16 +780,16 @@ namespace std ...@@ -775,16 +780,16 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
_M_insert(_Base_ptr __x, _Base_ptr __p, const _Val& __v) _M_insert(_Base_ptr __x, _Base_ptr __p, const _Val& __v)
{ {
_Link_type __z = _M_create_node(__v); _Link_type __z = _M_create_node(__v);
bool __insert_left; bool __insert_left;
__insert_left = __x != 0 || __p == _M_end() __insert_left = (__x != 0 || __p == _M_end()
|| _M_impl._M_key_compare(_KeyOfValue()(__v), || _M_impl._M_key_compare(_KeyOfValue()(__v),
_S_key(__p)); _S_key(__p)));
_Rb_tree_insert_and_rebalance(__insert_left, __z, __p, _Rb_tree_insert_and_rebalance(__insert_left, __z, __p,
this->_M_impl._M_header); this->_M_impl._M_header);
...@@ -794,8 +799,8 @@ namespace std ...@@ -794,8 +799,8 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
insert_equal(const _Val& __v) insert_equal(const _Val& __v)
{ {
_Link_type __x = _M_begin(); _Link_type __x = _M_begin();
...@@ -812,8 +817,8 @@ namespace std ...@@ -812,8 +817,8 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
void void
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
swap(_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __t) swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t)
{ {
if (_M_root() == 0) if (_M_root() == 0)
{ {
...@@ -856,9 +861,9 @@ namespace std ...@@ -856,9 +861,9 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
pair<typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator, pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
bool> _Compare, _Alloc>::iterator, bool>
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
insert_unique(const _Val& __v) insert_unique(const _Val& __v)
{ {
_Link_type __x = _M_begin(); _Link_type __x = _M_begin();
...@@ -877,8 +882,8 @@ namespace std ...@@ -877,8 +882,8 @@ namespace std
else else
--__j; --__j;
if (_M_impl._M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v))) if (_M_impl._M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v)))
return pair<iterator,bool>(_M_insert(__x, __y, __v), true); return pair<iterator, bool>(_M_insert(__x, __y, __v), true);
return pair<iterator,bool>(__j, false); return pair<iterator, bool>(__j, false);
} }
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
...@@ -929,8 +934,8 @@ namespace std ...@@ -929,8 +934,8 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
insert_equal(iterator __position, const _Val& __v) insert_equal(iterator __position, const _Val& __v)
{ {
if (__position._M_node == _M_leftmost()) if (__position._M_node == _M_leftmost())
...@@ -977,10 +982,10 @@ namespace std ...@@ -977,10 +982,10 @@ namespace std
typename _Cmp, typename _Alloc> typename _Cmp, typename _Alloc>
template<class _II> template<class _II>
void void
_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>:: _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::
insert_equal(_II __first, _II __last) insert_equal(_II __first, _II __last)
{ {
for ( ; __first != __last; ++__first) for (; __first != __last; ++__first)
insert_equal(*__first); insert_equal(*__first);
} }
...@@ -988,20 +993,22 @@ namespace std ...@@ -988,20 +993,22 @@ namespace std
typename _Cmp, typename _Alloc> typename _Cmp, typename _Alloc>
template<class _II> template<class _II>
void void
_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>:: _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::
insert_unique(_II __first, _II __last) insert_unique(_II __first, _II __last)
{ {
for ( ; __first != __last; ++__first) for (; __first != __last; ++__first)
insert_unique(*__first); insert_unique(*__first);
} }
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
inline void inline void
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::erase(iterator __position) _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
erase(iterator __position)
{ {
_Link_type __y = static_cast< _Link_type __y =
_Link_type>(_Rb_tree_rebalance_for_erase(__position._M_node, static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
(__position._M_node,
this->_M_impl._M_header)); this->_M_impl._M_header));
destroy_node(__y); destroy_node(__y);
--_M_impl._M_node_count; --_M_impl._M_node_count;
...@@ -1009,8 +1016,9 @@ namespace std ...@@ -1009,8 +1016,9 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::size_type typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::erase(const _Key& __x) _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
erase(const _Key& __x)
{ {
pair<iterator,iterator> __p = equal_range(__x); pair<iterator,iterator> __p = equal_range(__x);
size_type __n = std::distance(__p.first, __p.second); size_type __n = std::distance(__p.first, __p.second);
...@@ -1021,7 +1029,7 @@ namespace std ...@@ -1021,7 +1029,7 @@ namespace std
template<typename _Key, typename _Val, typename _KoV, template<typename _Key, typename _Val, typename _KoV,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type
_Rb_tree<_Key,_Val,_KoV,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::
_M_copy(_Const_Link_type __x, _Link_type __p) _M_copy(_Const_Link_type __x, _Link_type __p)
{ {
// Structural copy. __x and __p must be non-null. // Structural copy. __x and __p must be non-null.
...@@ -1057,7 +1065,8 @@ namespace std ...@@ -1057,7 +1065,8 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
void void
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::_M_erase(_Link_type __x) _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
_M_erase(_Link_type __x)
{ {
// Erase without rebalancing. // Erase without rebalancing.
while (__x != 0) while (__x != 0)
...@@ -1072,7 +1081,7 @@ namespace std ...@@ -1072,7 +1081,7 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
void void
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
{ {
if (__first == begin() && __last == end()) if (__first == begin() && __last == end())
...@@ -1084,7 +1093,7 @@ namespace std ...@@ -1084,7 +1093,7 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
void void
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
erase(const _Key* __first, const _Key* __last) erase(const _Key* __first, const _Key* __last)
{ {
while (__first != __last) while (__first != __last)
...@@ -1093,8 +1102,9 @@ namespace std ...@@ -1093,8 +1102,9 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::find(const _Key& __k) _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
find(const _Key& __k)
{ {
_Link_type __x = _M_begin(); // Current node. _Link_type __x = _M_begin(); // Current node.
_Link_type __y = _M_end(); // Last node which is not less than __k. _Link_type __y = _M_end(); // Last node which is not less than __k.
...@@ -1107,13 +1117,14 @@ namespace std ...@@ -1107,13 +1117,14 @@ namespace std
iterator __j = iterator(__y); iterator __j = iterator(__y);
return (__j == end() return (__j == end()
|| _M_impl._M_key_compare(__k, _S_key(__j._M_node))) ? end() : __j; || _M_impl._M_key_compare(__k,
_S_key(__j._M_node))) ? end() : __j;
} }
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
find(const _Key& __k) const find(const _Key& __k) const
{ {
_Const_Link_type __x = _M_begin(); // Current node. _Const_Link_type __x = _M_begin(); // Current node.
...@@ -1128,13 +1139,14 @@ namespace std ...@@ -1128,13 +1139,14 @@ namespace std
} }
const_iterator __j = const_iterator(__y); const_iterator __j = const_iterator(__y);
return (__j == end() return (__j == end()
|| _M_impl._M_key_compare(__k, _S_key(__j._M_node))) ? end() : __j; || _M_impl._M_key_compare(__k,
_S_key(__j._M_node))) ? end() : __j;
} }
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::size_type typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
count(const _Key& __k) const count(const _Key& __k) const
{ {
pair<const_iterator, const_iterator> __p = equal_range(__k); pair<const_iterator, const_iterator> __p = equal_range(__k);
...@@ -1144,8 +1156,8 @@ namespace std ...@@ -1144,8 +1156,8 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
lower_bound(const _Key& __k) lower_bound(const _Key& __k)
{ {
_Link_type __x = _M_begin(); // Current node. _Link_type __x = _M_begin(); // Current node.
...@@ -1162,8 +1174,8 @@ namespace std ...@@ -1162,8 +1174,8 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
lower_bound(const _Key& __k) const lower_bound(const _Key& __k) const
{ {
_Const_Link_type __x = _M_begin(); // Current node. _Const_Link_type __x = _M_begin(); // Current node.
...@@ -1180,8 +1192,8 @@ namespace std ...@@ -1180,8 +1192,8 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
upper_bound(const _Key& __k) upper_bound(const _Key& __k)
{ {
_Link_type __x = _M_begin(); // Current node. _Link_type __x = _M_begin(); // Current node.
...@@ -1198,8 +1210,8 @@ namespace std ...@@ -1198,8 +1210,8 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
upper_bound(const _Key& __k) const upper_bound(const _Key& __k) const
{ {
_Const_Link_type __x = _M_begin(); // Current node. _Const_Link_type __x = _M_begin(); // Current node.
...@@ -1217,10 +1229,10 @@ namespace std ...@@ -1217,10 +1229,10 @@ namespace std
template<typename _Key, typename _Val, typename _KeyOfValue, template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc> typename _Compare, typename _Alloc>
inline inline
pair<typename _Rb_tree<_Key,_Val,_KeyOfValue, pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
_Compare,_Alloc>::iterator, _Compare, _Alloc>::iterator,
typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator>
_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
equal_range(const _Key& __k) equal_range(const _Key& __k)
{ return pair<iterator, iterator>(lower_bound(__k), upper_bound(__k)); } { return pair<iterator, iterator>(lower_bound(__k), upper_bound(__k)); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment