From f4f2716464e1e0c06cbb49cb56833e0c9153b3b3 Mon Sep 17 00:00:00 2001 From: paolo Date: Sun, 3 Oct 2004 15:50:32 +0000 Subject: 2004-10-03 Paolo Carlini * include/bits/stl_list.h: Trivial formatting fixes. * include/bits/stl_tree.h: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@88451 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 5 ++ libstdc++-v3/include/bits/stl_list.h | 22 ++--- libstdc++-v3/include/bits/stl_tree.h | 164 +++++++++++++++++++---------------- 3 files changed, 104 insertions(+), 87 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8167ae06427..bbf654d0f00 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2004-10-03 Paolo Carlini + + * include/bits/stl_list.h: Trivial formatting fixes. + * include/bits/stl_tree.h: Likewise. + 2004-10-03 Paolo Carlini * include/bits/sstream.tcc (seekpos): In case of success, just diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index c46fd7400a7..07185dd3efd 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -888,7 +888,7 @@ namespace _GLIBCXX_STD */ void 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 @@ -1115,7 +1115,7 @@ namespace _GLIBCXX_STD _InputIterator __first, _InputIterator __last, __false_type) { - for ( ; __first != __last; ++__first) + for (; __first != __last; ++__first) _M_insert(__pos, *__first); } @@ -1124,7 +1124,7 @@ namespace _GLIBCXX_STD void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x) { - for ( ; __n > 0; --__n) + for (; __n > 0; --__n) _M_insert(__pos, __x); } @@ -1132,7 +1132,7 @@ namespace _GLIBCXX_STD // Moves the elements from [first,last) before position. void _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. void @@ -1165,9 +1165,9 @@ namespace _GLIBCXX_STD */ template 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 __end2 = __y.end(); @@ -1194,32 +1194,32 @@ namespace _GLIBCXX_STD */ template 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(), __y.begin(), __y.end()); } /// Based on operator== template 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); } /// Based on operator< template 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; } /// Based on operator< template 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); } /// Based on operator< template 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); } /// See std::list::swap(). diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 8ddb8984c16..5e21ccdbb42 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -461,8 +461,10 @@ namespace std _Const_Link_type _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 _M_end() @@ -550,7 +552,7 @@ namespace std : _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) { if (__x._M_root() != 0) @@ -565,8 +567,8 @@ namespace std ~_Rb_tree() { _M_erase(_M_begin()); } - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& - operator=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x); + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& + operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x); // Accessors. _Compare @@ -579,7 +581,10 @@ namespace std const_iterator 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 end() @@ -618,7 +623,7 @@ namespace std { return size_type(-1); } void - swap(_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __t); + swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t); // Insert/erase. pair @@ -699,8 +704,8 @@ namespace std template inline bool - operator==(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, - const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) + operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { return __x.size() == __y.size() && equal(__x.begin(), __x.end(), __y.begin()); @@ -709,8 +714,8 @@ namespace std template inline bool - operator<(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, - const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) + operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { return lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); @@ -719,43 +724,43 @@ namespace std template inline bool - operator!=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, - const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) + operator!=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { return !(__x == __y); } template inline bool - operator>(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, - const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) + operator>(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { return __y < __x; } template inline bool - operator<=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, - const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) + operator<=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { return !(__y < __x); } template inline bool - operator>=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, - const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) + operator>=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { return !(__x < __y); } template inline void - swap(_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) + swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) { __x.swap(__y); } template - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: - operator=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x) + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x) { if (this != &__x) { @@ -775,16 +780,16 @@ namespace std template - typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_insert(_Base_ptr __x, _Base_ptr __p, const _Val& __v) { _Link_type __z = _M_create_node(__v); bool __insert_left; - __insert_left = __x != 0 || __p == _M_end() - || _M_impl._M_key_compare(_KeyOfValue()(__v), - _S_key(__p)); + __insert_left = (__x != 0 || __p == _M_end() + || _M_impl._M_key_compare(_KeyOfValue()(__v), + _S_key(__p))); _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, this->_M_impl._M_header); @@ -794,8 +799,8 @@ namespace std template - typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: insert_equal(const _Val& __v) { _Link_type __x = _M_begin(); @@ -812,8 +817,8 @@ namespace std template void - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: - swap(_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __t) + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t) { if (_M_root() == 0) { @@ -856,9 +861,9 @@ namespace std template - pair::iterator, - bool> - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + pair::iterator, bool> + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: insert_unique(const _Val& __v) { _Link_type __x = _M_begin(); @@ -877,8 +882,8 @@ namespace std else --__j; if (_M_impl._M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v))) - return pair(_M_insert(__x, __y, __v), true); - return pair(__j, false); + return pair(_M_insert(__x, __y, __v), true); + return pair(__j, false); } template - typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: insert_equal(iterator __position, const _Val& __v) { if (__position._M_node == _M_leftmost()) @@ -977,10 +982,10 @@ namespace std typename _Cmp, typename _Alloc> template void - _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>:: + _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>:: insert_equal(_II __first, _II __last) { - for ( ; __first != __last; ++__first) + for (; __first != __last; ++__first) insert_equal(*__first); } @@ -988,29 +993,32 @@ namespace std typename _Cmp, typename _Alloc> template void - _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>:: + _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>:: insert_unique(_II __first, _II __last) { - for ( ; __first != __last; ++__first) + for (; __first != __last; ++__first) insert_unique(*__first); } template 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>(_Rb_tree_rebalance_for_erase(__position._M_node, - this->_M_impl._M_header)); + _Link_type __y = + static_cast<_Link_type>(_Rb_tree_rebalance_for_erase + (__position._M_node, + this->_M_impl._M_header)); destroy_node(__y); --_M_impl._M_node_count; } template - typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::size_type - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::erase(const _Key& __x) + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + erase(const _Key& __x) { pair __p = equal_range(__x); size_type __n = std::distance(__p.first, __p.second); @@ -1021,7 +1029,7 @@ namespace std template 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) { // Structural copy. __x and __p must be non-null. @@ -1057,7 +1065,8 @@ namespace std template 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. while (__x != 0) @@ -1072,7 +1081,7 @@ namespace std template void - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: erase(iterator __first, iterator __last) { if (__first == begin() && __last == end()) @@ -1084,7 +1093,7 @@ namespace std template void - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: erase(const _Key* __first, const _Key* __last) { while (__first != __last) @@ -1093,8 +1102,9 @@ namespace std template - typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::find(const _Key& __k) + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + find(const _Key& __k) { _Link_type __x = _M_begin(); // Current node. _Link_type __y = _M_end(); // Last node which is not less than __k. @@ -1106,14 +1116,15 @@ namespace std __x = _S_right(__x); iterator __j = iterator(__y); - return (__j == end() - || _M_impl._M_key_compare(__k, _S_key(__j._M_node))) ? end() : __j; + return (__j == end() + || _M_impl._M_key_compare(__k, + _S_key(__j._M_node))) ? end() : __j; } template - typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: find(const _Key& __k) const { _Const_Link_type __x = _M_begin(); // Current node. @@ -1127,14 +1138,15 @@ namespace std __x = _S_right(__x); } const_iterator __j = const_iterator(__y); - return (__j == end() - || _M_impl._M_key_compare(__k, _S_key(__j._M_node))) ? end() : __j; + return (__j == end() + || _M_impl._M_key_compare(__k, + _S_key(__j._M_node))) ? end() : __j; } template - typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::size_type - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: count(const _Key& __k) const { pair __p = equal_range(__k); @@ -1144,8 +1156,8 @@ namespace std template - typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: lower_bound(const _Key& __k) { _Link_type __x = _M_begin(); // Current node. @@ -1162,8 +1174,8 @@ namespace std template - typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: lower_bound(const _Key& __k) const { _Const_Link_type __x = _M_begin(); // Current node. @@ -1180,8 +1192,8 @@ namespace std template - typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: upper_bound(const _Key& __k) { _Link_type __x = _M_begin(); // Current node. @@ -1198,8 +1210,8 @@ namespace std template - typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::const_iterator - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: upper_bound(const _Key& __k) const { _Const_Link_type __x = _M_begin(); // Current node. @@ -1217,10 +1229,10 @@ namespace std template inline - pair::iterator, - typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator> - _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>:: + pair::iterator, + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator> + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: equal_range(const _Key& __k) { return pair(lower_bound(__k), upper_bound(__k)); } -- cgit v1.2.3