diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index cef5af5e698e..8e8365aca3fe 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2004-02-01 Paolo Carlini + + * include/bits/stl_algo.h: Additional minor tweaks. + * include/bits/stl_map.h: Likewise. + * include/bits/stl_multimap.h: Likewise. + * include/bits/stl_multiset.h: Likewise. + * include/bits/stl_set.h: Likewise. + * include/bits/stl_tree.h: Likewise. + 2004-02-01 Paolo Carlini * include/bits/vector.tcc (vector::_M_insert_aux(iterator)): diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 1ea8902fbef9..f33d4e3042f2 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -82,7 +82,7 @@ namespace std * @ingroup SGIextensions */ template - inline const _Tp& + inline const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) { // concept requirements @@ -167,8 +167,7 @@ namespace std template inline _InputIterator find(_InputIterator __first, _InputIterator __last, - const _Tp& __val, - input_iterator_tag) + const _Tp& __val, input_iterator_tag) { while (__first != __last && !(*__first == __val)) ++__first; @@ -183,8 +182,7 @@ namespace std template inline _InputIterator find_if(_InputIterator __first, _InputIterator __last, - _Predicate __pred, - input_iterator_tag) + _Predicate __pred, input_iterator_tag) { while (__first != __last && !__pred(*__first)) ++__first; @@ -199,8 +197,7 @@ namespace std template _RandomAccessIterator find(_RandomAccessIterator __first, _RandomAccessIterator __last, - const _Tp& __val, - random_access_iterator_tag) + const _Tp& __val, random_access_iterator_tag) { typename iterator_traits<_RandomAccessIterator>::difference_type __trip_count = (__last - __first) >> 2; @@ -252,8 +249,7 @@ namespace std template _RandomAccessIterator find_if(_RandomAccessIterator __first, _RandomAccessIterator __last, - _Predicate __pred, - random_access_iterator_tag) + _Predicate __pred, random_access_iterator_tag) { typename iterator_traits<_RandomAccessIterator>::difference_type __trip_count = (__last - __first) >> 2; diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index e86f4888af99..6cb0845267e7 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -92,10 +92,10 @@ namespace __gnu_norm { // concept requirements __glibcxx_class_requires(_Tp, _SGIAssignableConcept) - __glibcxx_class_requires4(_Compare, bool, _Key, _Key, - _BinaryFunctionConcept) + __glibcxx_class_requires4(_Compare, bool, _Key, _Key, + _BinaryFunctionConcept) - public: + public: typedef _Key key_type; typedef _Tp mapped_type; typedef pair value_type; @@ -109,7 +109,7 @@ namespace __gnu_norm _Compare comp; value_compare(_Compare __c) - : comp(__c) { } + : comp(__c) { } public: bool operator()(const value_type& __x, const value_type& __y) const @@ -613,11 +613,14 @@ namespace __gnu_norm { return _M_t.equal_range(__x); } template - friend bool operator== (const map<_K1,_T1,_C1,_A1>&, - const map<_K1,_T1,_C1,_A1>&); + friend bool + operator== (const map<_K1,_T1,_C1,_A1>&, + const map<_K1,_T1,_C1,_A1>&); + template - friend bool operator< (const map<_K1,_T1,_C1,_A1>&, - const map<_K1,_T1,_C1,_A1>&); + friend bool + operator< (const map<_K1,_T1,_C1,_A1>&, + const map<_K1,_T1,_C1,_A1>&); }; /** diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index cfd28ef3ad71..4f442b8c32c1 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -70,15 +70,17 @@ namespace __gnu_norm template , typename _Alloc = allocator > > - class multimap; + class multimap; template - inline bool operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, - const multimap<_Key,_Tp,_Compare,_Alloc>& __y); + inline bool + operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, + const multimap<_Key,_Tp,_Compare,_Alloc>& __y); template - inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, - const multimap<_Key,_Tp,_Compare,_Alloc>& __y); + inline bool + operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, + const multimap<_Key,_Tp,_Compare,_Alloc>& __y); /** * @brief A standard container made up of (key,value) pairs, which can be @@ -123,7 +125,7 @@ namespace __gnu_norm _Compare comp; value_compare(_Compare __c) - : comp(__c) { } + : comp(__c) { } public: bool operator()(const value_type& __x, const value_type& __y) const diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index c72d9938ddc0..f085a0059cc1 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -69,15 +69,17 @@ namespace __gnu_norm // Forward declaration of operators < and ==, needed for friend declaration. template , class _Alloc = allocator<_Key> > - class multiset; + class multiset; template - inline bool operator==(const multiset<_Key,_Compare,_Alloc>& __x, - const multiset<_Key,_Compare,_Alloc>& __y); + inline bool + operator==(const multiset<_Key,_Compare,_Alloc>& __x, + const multiset<_Key,_Compare,_Alloc>& __y); template - inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x, - const multiset<_Key,_Compare,_Alloc>& __y); + inline bool + operator<(const multiset<_Key,_Compare,_Alloc>& __x, + const multiset<_Key,_Compare,_Alloc>& __y); /** * @brief A standard container made up of elements, which can be retrieved diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index 1e45f99df679..75fa7f5c3ef7 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -68,7 +68,7 @@ namespace __gnu_norm // Forward declarations of operators < and ==, needed for friend declaration. template, class _Alloc = allocator<_Key> > - class set; + class set; template inline bool @@ -111,7 +111,7 @@ namespace __gnu_norm __glibcxx_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept) - public: + public: // typedefs: //@{ /// Public typedefs. diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 9eeccaba0342..f0d36b729412 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -289,7 +289,7 @@ namespace std { return _M_node != __x._M_node; } _Base_ptr _M_node; - }; + }; template inline bool @@ -325,7 +325,7 @@ namespace std template > class _Rb_tree - : protected _Alloc::template rebind<_Rb_tree_node<_Val> >::other + : protected _Alloc::template rebind<_Rb_tree_node<_Val> >::other { typedef typename _Alloc::template rebind<_Rb_tree_node<_Val> >::other _Node_allocator; @@ -505,27 +505,27 @@ namespace std public: // allocation/deallocation _Rb_tree() - : _Node_allocator(allocator_type()), - _M_node_count(0), - _M_key_compare() + : _Node_allocator(allocator_type()), + _M_node_count(0), + _M_key_compare() { _M_empty_initialize(); } _Rb_tree(const _Compare& __comp) - : _Node_allocator(allocator_type()), - _M_node_count(0), - _M_key_compare(__comp) + : _Node_allocator(allocator_type()), + _M_node_count(0), + _M_key_compare(__comp) { _M_empty_initialize(); } _Rb_tree(const _Compare& __comp, const allocator_type& __a) - : _Node_allocator(__a), - _M_node_count(0), - _M_key_compare(__comp) + : _Node_allocator(__a), + _M_node_count(0), + _M_key_compare(__comp) { _M_empty_initialize(); } _Rb_tree(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x) - : _Node_allocator(__x.get_allocator()), - _M_node_count(0), - _M_key_compare(__x._M_key_compare) + : _Node_allocator(__x.get_allocator()), + _M_node_count(0), + _M_key_compare(__x._M_key_compare) { if (__x._M_root() == 0) _M_empty_initialize(); @@ -539,7 +539,8 @@ namespace std _M_node_count = __x._M_node_count; } - ~_Rb_tree() { _M_erase(_M_begin()); } + ~_Rb_tree() + { _M_erase(_M_begin()); } _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& operator=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x); @@ -722,14 +723,14 @@ namespace std inline bool operator<=(const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __x, const _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>& __y) - { return !(__y < __x); } + { 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) - { return !(__x < __y); } + { return !(__x < __y); } template @@ -1205,14 +1206,14 @@ namespace std template - inline - pair::const_iterator, - typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::const_iterator> - _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc> - ::equal_range(const _Key& __k) const - { return pair(lower_bound(__k), - upper_bound(__k)); } + inline + pair::const_iterator, + typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::const_iterator> + _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>:: + equal_range(const _Key& __k) const + { return pair(lower_bound(__k), + upper_bound(__k)); } unsigned int _Rb_tree_black_count(const _Rb_tree_node_base* __node, @@ -1223,37 +1224,37 @@ namespace std bool _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::__rb_verify() const { - if (_M_node_count == 0 || begin() == end()) - return _M_node_count == 0 && begin() == end() - && this->_M_header._M_left == _M_end() - && this->_M_header._M_right == _M_end(); + if (_M_node_count == 0 || begin() == end()) + return _M_node_count == 0 && begin() == end() + && this->_M_header._M_left == _M_end() + && this->_M_header._M_right == _M_end(); - unsigned int __len = _Rb_tree_black_count(_M_leftmost(), _M_root()); - for (const_iterator __it = begin(); __it != end(); ++__it) - { - _Const_Link_type __x = static_cast<_Const_Link_type>(__it._M_node); - _Const_Link_type __L = _S_left(__x); - _Const_Link_type __R = _S_right(__x); + unsigned int __len = _Rb_tree_black_count(_M_leftmost(), _M_root()); + for (const_iterator __it = begin(); __it != end(); ++__it) + { + _Const_Link_type __x = static_cast<_Const_Link_type>(__it._M_node); + _Const_Link_type __L = _S_left(__x); + _Const_Link_type __R = _S_right(__x); - if (__x->_M_color == _S_red) - if ((__L && __L->_M_color == _S_red) - || (__R && __R->_M_color == _S_red)) + if (__x->_M_color == _S_red) + if ((__L && __L->_M_color == _S_red) + || (__R && __R->_M_color == _S_red)) + return false; + + if (__L && _M_key_compare(_S_key(__x), _S_key(__L))) return false; - - if (__L && _M_key_compare(_S_key(__x), _S_key(__L))) - return false; - if (__R && _M_key_compare(_S_key(__R), _S_key(__x))) - return false; - - if (!__L && !__R && _Rb_tree_black_count(__x, _M_root()) != __len) - return false; - } + if (__R && _M_key_compare(_S_key(__R), _S_key(__x))) + return false; + + if (!__L && !__R && _Rb_tree_black_count(__x, _M_root()) != __len) + return false; + } - if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root())) - return false; - if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root())) - return false; - return true; + if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root())) + return false; + if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root())) + return false; + return true; } } // namespace std