stl_tree.h (_Rb_tree<>::insert_unique): Rename to _M_insert_unique.

2006-01-06  Paolo Carlini  <pcarlini@suse.de>

	* 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
This commit is contained in:
Paolo Carlini 2006-01-06 19:11:06 +00:00 committed by Paolo Carlini
parent 8479d5f123
commit 42a27024e9
6 changed files with 95 additions and 85 deletions

View File

@ -1,3 +1,13 @@
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* 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 <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,

View File

@ -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 <typename _InputIterator>
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<iterator,bool>
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 <typename _InputIterator>
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.

View File

@ -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 <typename _InputIterator>
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 <typename _InputIterator>
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.

View File

@ -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 <class _InputIterator>
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 <class _InputIterator>
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.

View File

@ -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<class _InputIterator>
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<typename _Rep_type::iterator, bool> __p =
_M_t.insert_unique(__x);
_M_t._M_insert_unique(__x);
return std::pair<iterator, bool>(__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<class _InputIterator>
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.

View File

@ -651,31 +651,31 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t);
// Insert/erase.
pair<iterator,bool>
insert_unique(const value_type& __x);
pair<iterator, bool>
_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<typename _InputIterator>
void
insert_unique(_InputIterator __first, _InputIterator __last);
_M_insert_unique(_InputIterator __first, _InputIterator __last);
template<typename _InputIterator>
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<typename _Rb_tree<_Key, _Val, _KeyOfValue,
_Compare, _Alloc>::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<class _II>
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<typename _Key, typename _Val, typename _KoV,
@ -1184,10 +1184,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<class _II>
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<typename _Key, typename _Val, typename _KeyOfValue,