From 42a27024e950a9eb30f7ca3f24d32a96e0afef59 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 6 Jan 2006 19:11:06 +0000 Subject: [PATCH] stl_tree.h (_Rb_tree<>::insert_unique): Rename to _M_insert_unique. 2006-01-06 Paolo Carlini * include/bits/stl_tree.h (_Rb_tree<>::insert_unique): Rename to _M_insert_unique. (_Rb_tree<>::insert_equal): Rename to _M_insert_equal. * include/bits/stl_map.h (class map<>): Update callers. * include/bits/stl_set.h (class set<>): Likewise. * include/bits/stl_multimap.h (class multimap<>): Likewise. * include/bits/stl_multiset.h (class multiset<>): Likewise. From-SVN: r109424 --- libstdc++-v3/ChangeLog | 10 ++ libstdc++-v3/include/bits/stl_map.h | 12 +-- libstdc++-v3/include/bits/stl_multimap.h | 12 +-- libstdc++-v3/include/bits/stl_multiset.h | 12 +-- libstdc++-v3/include/bits/stl_set.h | 12 +-- libstdc++-v3/include/bits/stl_tree.h | 122 +++++++++++------------ 6 files changed, 95 insertions(+), 85 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 963e6e4e95a..820d7c15833 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2006-01-06 Paolo Carlini + + * include/bits/stl_tree.h (_Rb_tree<>::insert_unique): Rename + to _M_insert_unique. + (_Rb_tree<>::insert_equal): Rename to _M_insert_equal. + * include/bits/stl_map.h (class map<>): Update callers. + * include/bits/stl_set.h (class set<>): Likewise. + * include/bits/stl_multimap.h (class multimap<>): Likewise. + * include/bits/stl_multiset.h (class multiset<>): Likewise. + 2006-01-06 Paolo Carlini * include/bits/stl_bvector.h (vector::erase(iterator, diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index a1cfafb850a..aad7600e6a6 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -1,6 +1,6 @@ // Map implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -186,7 +186,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) template map(_InputIterator __first, _InputIterator __last) : _M_t(_Compare(), allocator_type()) - { _M_t.insert_unique(__first, __last); } + { _M_t._M_insert_unique(__first, __last); } /** * @brief Builds a %map from a range. @@ -203,7 +203,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) map(_InputIterator __first, _InputIterator __last, const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, __a) - { _M_t.insert_unique(__first, __last); } + { _M_t._M_insert_unique(__first, __last); } // FIXME There is no dtor declared, but we should have something generated // by Doxygen. I don't know what tags to add to this paragraph to make @@ -393,7 +393,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) */ std::pair insert(const value_type& __x) - { return _M_t.insert_unique(__x); } + { return _M_t._M_insert_unique(__x); } /** * @brief Attempts to insert a std::pair into the %map. @@ -417,7 +417,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) */ iterator insert(iterator position, const value_type& __x) - { return _M_t.insert_unique(position, __x); } + { return _M_t._M_insert_unique(position, __x); } /** * @brief A template function that attemps to insert a range of elements. @@ -430,7 +430,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) template void insert(_InputIterator __first, _InputIterator __last) - { _M_t.insert_unique(__first, __last); } + { _M_t._M_insert_unique(__first, __last); } /** * @brief Erases an element from a %map. diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index 4adf65ba836..41e93a2ef30 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -1,6 +1,6 @@ // Multimap implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -200,7 +200,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) template multimap(_InputIterator __first, _InputIterator __last) : _M_t(_Compare(), allocator_type()) - { _M_t.insert_equal(__first, __last); } + { _M_t._M_insert_equal(__first, __last); } /** * @brief Builds a %multimap from a range. @@ -218,7 +218,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, __a) - { _M_t.insert_equal(__first, __last); } + { _M_t._M_insert_equal(__first, __last); } // FIXME There is no dtor declared, but we should have something generated // by Doxygen. I don't know what tags to add to this paragraph to make @@ -352,7 +352,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) */ iterator insert(const value_type& __x) - { return _M_t.insert_equal(__x); } + { return _M_t._M_insert_equal(__x); } /** * @brief Inserts a std::pair into the %multimap. @@ -376,7 +376,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) */ iterator insert(iterator __position, const value_type& __x) - { return _M_t.insert_equal(__position, __x); } + { return _M_t._M_insert_equal(__position, __x); } /** * @brief A template function that attemps to insert a range of elements. @@ -389,7 +389,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) template void insert(_InputIterator __first, _InputIterator __last) - { _M_t.insert_equal(__first, __last); } + { _M_t._M_insert_equal(__first, __last); } /** * @brief Erases an element from a %multimap. diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index f685b4f6e63..dd6e976117c 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -1,6 +1,6 @@ // Multiset implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -167,7 +167,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) template multiset(_InputIterator __first, _InputIterator __last) : _M_t(_Compare(), allocator_type()) - { _M_t.insert_equal(__first, __last); } + { _M_t._M_insert_equal(__first, __last); } /** * @brief Builds a %multiset from a range. @@ -185,7 +185,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, __a) - { _M_t.insert_equal(__first, __last); } + { _M_t._M_insert_equal(__first, __last); } /** * @brief %Multiset copy constructor. @@ -306,7 +306,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) */ iterator insert(const value_type& __x) - { return _M_t.insert_equal(__x); } + { return _M_t._M_insert_equal(__x); } /** * @brief Inserts an element into the %multiset. @@ -330,7 +330,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) */ iterator insert(iterator __position, const value_type& __x) - { return _M_t.insert_equal(__position, __x); } + { return _M_t._M_insert_equal(__position, __x); } /** * @brief A template function that attemps to insert a range of elements. @@ -343,7 +343,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) template void insert(_InputIterator __first, _InputIterator __last) - { _M_t.insert_equal(__first, __last); } + { _M_t._M_insert_equal(__first, __last); } /** * @brief Erases an element from a %multiset. diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index 042e95fc20f..ed362f13c1e 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -1,6 +1,6 @@ // Set implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -177,7 +177,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) template set(_InputIterator __first, _InputIterator __last) : _M_t(_Compare(), allocator_type()) - { _M_t.insert_unique(__first, __last); } + { _M_t._M_insert_unique(__first, __last); } /** * @brief Builds a %set from a range. @@ -195,7 +195,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, __a) - { _M_t.insert_unique(__first, __last); } + { _M_t._M_insert_unique(__first, __last); } /** * @brief Set copy constructor. @@ -318,7 +318,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) insert(const value_type& __x) { std::pair __p = - _M_t.insert_unique(__x); + _M_t._M_insert_unique(__x); return std::pair(__p.first, __p.second); } @@ -343,7 +343,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) */ iterator insert(iterator __position, const value_type& __x) - { return _M_t.insert_unique(__position, __x); } + { return _M_t._M_insert_unique(__position, __x); } /** * @brief A template function that attemps to insert a range of elements. @@ -356,7 +356,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) template void insert(_InputIterator __first, _InputIterator __last) - { _M_t.insert_unique(__first, __last); } + { _M_t._M_insert_unique(__first, __last); } /** * @brief Erases an element from a %set. diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 01a8bad81c9..031e37f44fb 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -651,31 +651,31 @@ _GLIBCXX_BEGIN_NAMESPACE(std) swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t); // Insert/erase. - pair - insert_unique(const value_type& __x); + pair + _M_insert_unique(const value_type& __x); iterator - insert_equal(const value_type& __x); + _M_insert_equal(const value_type& __x); iterator - insert_unique(iterator __position, const value_type& __x); + _M_insert_unique(iterator __position, const value_type& __x); const_iterator - insert_unique(const_iterator __position, const value_type& __x); + _M_insert_unique(const_iterator __position, const value_type& __x); iterator - insert_equal(iterator __position, const value_type& __x); + _M_insert_equal(iterator __position, const value_type& __x); const_iterator - insert_equal(const_iterator __position, const value_type& __x); + _M_insert_equal(const_iterator __position, const value_type& __x); template void - insert_unique(_InputIterator __first, _InputIterator __last); + _M_insert_unique(_InputIterator __first, _InputIterator __last); template void - insert_equal(_InputIterator __first, _InputIterator __last); + _M_insert_equal(_InputIterator __first, _InputIterator __last); void erase(iterator __position); @@ -856,7 +856,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - insert_equal(const _Val& __v) + _M_insert_equal(const _Val& __v) { _Link_type __x = _M_begin(); _Link_type __y = _M_end(); @@ -876,43 +876,43 @@ _GLIBCXX_BEGIN_NAMESPACE(std) swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t) { if (_M_root() == 0) - { - if (__t._M_root() != 0) { - _M_root() = __t._M_root(); - _M_leftmost() = __t._M_leftmost(); - _M_rightmost() = __t._M_rightmost(); - _M_root()->_M_parent = _M_end(); - - __t._M_root() = 0; - __t._M_leftmost() = __t._M_end(); - __t._M_rightmost() = __t._M_end(); + if (__t._M_root() != 0) + { + _M_root() = __t._M_root(); + _M_leftmost() = __t._M_leftmost(); + _M_rightmost() = __t._M_rightmost(); + _M_root()->_M_parent = _M_end(); + + __t._M_root() = 0; + __t._M_leftmost() = __t._M_end(); + __t._M_rightmost() = __t._M_end(); + } } - } else if (__t._M_root() == 0) - { - __t._M_root() = _M_root(); - __t._M_leftmost() = _M_leftmost(); - __t._M_rightmost() = _M_rightmost(); - __t._M_root()->_M_parent = __t._M_end(); - - _M_root() = 0; - _M_leftmost() = _M_end(); - _M_rightmost() = _M_end(); - } + { + __t._M_root() = _M_root(); + __t._M_leftmost() = _M_leftmost(); + __t._M_rightmost() = _M_rightmost(); + __t._M_root()->_M_parent = __t._M_end(); + + _M_root() = 0; + _M_leftmost() = _M_end(); + _M_rightmost() = _M_end(); + } else - { - std::swap(_M_root(),__t._M_root()); - std::swap(_M_leftmost(),__t._M_leftmost()); - std::swap(_M_rightmost(),__t._M_rightmost()); - - _M_root()->_M_parent = _M_end(); - __t._M_root()->_M_parent = __t._M_end(); - } + { + std::swap(_M_root(),__t._M_root()); + std::swap(_M_leftmost(),__t._M_leftmost()); + std::swap(_M_rightmost(),__t._M_rightmost()); + + _M_root()->_M_parent = _M_end(); + __t._M_root()->_M_parent = __t._M_end(); + } // No need to swap header's color as it does not change. std::swap(this->_M_impl._M_node_count, __t._M_impl._M_node_count); std::swap(this->_M_impl._M_key_compare, __t._M_impl._M_key_compare); - + // _GLIBCXX_RESOLVE_LIB_DEFECTS // 431. Swapping containers with unequal allocators. std::__alloc_swap<_Node_allocator>:: @@ -924,7 +924,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) pair::iterator, bool> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - insert_unique(const _Val& __v) + _M_insert_unique(const _Val& __v) { _Link_type __x = _M_begin(); _Link_type __y = _M_end(); @@ -950,7 +950,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - insert_unique(iterator __position, const _Val& __v) + _M_insert_unique(iterator __position, const _Val& __v) { // end() if (__position._M_node == _M_end()) @@ -960,7 +960,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _KeyOfValue()(__v))) return _M_insert(0, _M_rightmost(), __v); else - return insert_unique(__v).first; + return _M_insert_unique(__v).first; } else if (_M_impl._M_key_compare(_KeyOfValue()(__v), _S_key(__position._M_node))) @@ -979,7 +979,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __position._M_node, __v); } else - return insert_unique(__v).first; + return _M_insert_unique(__v).first; } else if (_M_impl._M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__v))) @@ -997,7 +997,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return _M_insert(__after._M_node, __after._M_node, __v); } else - return insert_unique(__v).first; + return _M_insert_unique(__v).first; } else return __position; // Equivalent keys. @@ -1007,7 +1007,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - insert_unique(const_iterator __position, const _Val& __v) + _M_insert_unique(const_iterator __position, const _Val& __v) { // end() if (__position._M_node == _M_end()) @@ -1017,7 +1017,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _KeyOfValue()(__v))) return _M_insert(0, _M_rightmost(), __v); else - return const_iterator(insert_unique(__v).first); + return const_iterator(_M_insert_unique(__v).first); } else if (_M_impl._M_key_compare(_KeyOfValue()(__v), _S_key(__position._M_node))) @@ -1036,7 +1036,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __position._M_node, __v); } else - return const_iterator(insert_unique(__v).first); + return const_iterator(_M_insert_unique(__v).first); } else if (_M_impl._M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__v))) @@ -1054,7 +1054,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return _M_insert(__after._M_node, __after._M_node, __v); } else - return const_iterator(insert_unique(__v).first); + return const_iterator(_M_insert_unique(__v).first); } else return __position; // Equivalent keys. @@ -1064,7 +1064,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - insert_equal(iterator __position, const _Val& __v) + _M_insert_equal(iterator __position, const _Val& __v) { // end() if (__position._M_node == _M_end()) @@ -1074,7 +1074,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _S_key(_M_rightmost()))) return _M_insert(0, _M_rightmost(), __v); else - return insert_equal(__v); + return _M_insert_equal(__v); } else if (!_M_impl._M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__v))) @@ -1093,7 +1093,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __position._M_node, __v); } else - return insert_equal(__v); + return _M_insert_equal(__v); } else { @@ -1110,7 +1110,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return _M_insert(__after._M_node, __after._M_node, __v); } else - return insert_equal(__v); + return _M_insert_equal(__v); } } @@ -1118,7 +1118,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: - insert_equal(const_iterator __position, const _Val& __v) + _M_insert_equal(const_iterator __position, const _Val& __v) { // end() if (__position._M_node == _M_end()) @@ -1128,7 +1128,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _S_key(_M_rightmost()))) return _M_insert(0, _M_rightmost(), __v); else - return const_iterator(insert_equal(__v)); + return const_iterator(_M_insert_equal(__v)); } else if (!_M_impl._M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__v))) @@ -1147,7 +1147,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __position._M_node, __v); } else - return const_iterator(insert_equal(__v)); + return const_iterator(_M_insert_equal(__v)); } else { @@ -1164,7 +1164,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return _M_insert(__after._M_node, __after._M_node, __v); } else - return const_iterator(insert_equal(__v)); + return const_iterator(_M_insert_equal(__v)); } } @@ -1173,10 +1173,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template void _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>:: - insert_equal(_II __first, _II __last) + _M_insert_equal(_II __first, _II __last) { for (; __first != __last; ++__first) - insert_equal(end(), *__first); + _M_insert_equal(end(), *__first); } template void _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>:: - insert_unique(_II __first, _II __last) + _M_insert_unique(_II __first, _II __last) { for (; __first != __last; ++__first) - insert_unique(end(), *__first); + _M_insert_unique(end(), *__first); } template