66 #if __cplusplus >= 201103L 
   70 namespace std _GLIBCXX_VISIBILITY(default)
 
   72 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   90   enum _Rb_tree_color { _S_red = 
false, _S_black = 
true };
 
   92   struct _Rb_tree_node_base
 
   94     typedef _Rb_tree_node_base* _Base_ptr;
 
   95     typedef const _Rb_tree_node_base* _Const_Base_ptr;
 
   97     _Rb_tree_color  _M_color;
 
  103     _S_minimum(_Base_ptr __x) _GLIBCXX_NOEXCEPT
 
  105       while (__x->_M_left != 0) __x = __x->_M_left;
 
  109     static _Const_Base_ptr
 
  110     _S_minimum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT
 
  112       while (__x->_M_left != 0) __x = __x->_M_left;
 
  117     _S_maximum(_Base_ptr __x) _GLIBCXX_NOEXCEPT
 
  119       while (__x->_M_right != 0) __x = __x->_M_right;
 
  123     static _Const_Base_ptr
 
  124     _S_maximum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT
 
  126       while (__x->_M_right != 0) __x = __x->_M_right;
 
  131   template<
typename _Val>
 
  132     struct _Rb_tree_node : 
public _Rb_tree_node_base
 
  134       typedef _Rb_tree_node<_Val>* _Link_type;
 
  136 #if __cplusplus < 201103L 
  147       __gnu_cxx::__aligned_buffer<_Val> _M_storage;
 
  151       { 
return _M_storage._M_ptr(); }
 
  155       { 
return _M_storage._M_ptr(); }
 
  159   _GLIBCXX_PURE _Rb_tree_node_base*
 
  160   _Rb_tree_increment(_Rb_tree_node_base* __x) 
throw ();
 
  162   _GLIBCXX_PURE 
const _Rb_tree_node_base*
 
  163   _Rb_tree_increment(
const _Rb_tree_node_base* __x) 
throw ();
 
  165   _GLIBCXX_PURE _Rb_tree_node_base*
 
  166   _Rb_tree_decrement(_Rb_tree_node_base* __x) 
throw ();
 
  168   _GLIBCXX_PURE 
const _Rb_tree_node_base*
 
  169   _Rb_tree_decrement(
const _Rb_tree_node_base* __x) 
throw ();
 
  171   template<
typename _Tp>
 
  172     struct _Rb_tree_iterator
 
  174       typedef _Tp  value_type;
 
  175       typedef _Tp& reference;
 
  176       typedef _Tp* pointer;
 
  178       typedef bidirectional_iterator_tag iterator_category;
 
  179       typedef ptrdiff_t                  difference_type;
 
  181       typedef _Rb_tree_iterator<_Tp>        _Self;
 
  182       typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
 
  183       typedef _Rb_tree_node<_Tp>*           _Link_type;
 
  185       _Rb_tree_iterator() _GLIBCXX_NOEXCEPT
 
  189       _Rb_tree_iterator(_Link_type __x) _GLIBCXX_NOEXCEPT
 
  194       { 
return *
static_cast<_Link_type
>(_M_node)->_M_valptr(); }
 
  197       operator->() const _GLIBCXX_NOEXCEPT
 
  198       { 
return static_cast<_Link_type
> (_M_node)->_M_valptr(); }
 
  201       operator++() _GLIBCXX_NOEXCEPT
 
  203     _M_node = _Rb_tree_increment(_M_node);
 
  208       operator++(
int) _GLIBCXX_NOEXCEPT
 
  211     _M_node = _Rb_tree_increment(_M_node);
 
  216       operator--() _GLIBCXX_NOEXCEPT
 
  218     _M_node = _Rb_tree_decrement(_M_node);
 
  223       operator--(
int) _GLIBCXX_NOEXCEPT
 
  226     _M_node = _Rb_tree_decrement(_M_node);
 
  231       operator==(
const _Self& __x) 
const _GLIBCXX_NOEXCEPT
 
  232       { 
return _M_node == __x._M_node; }
 
  235       operator!=(
const _Self& __x) 
const _GLIBCXX_NOEXCEPT
 
  236       { 
return _M_node != __x._M_node; }
 
  241   template<
typename _Tp>
 
  242     struct _Rb_tree_const_iterator
 
  244       typedef _Tp        value_type;
 
  245       typedef const _Tp& reference;
 
  246       typedef const _Tp* pointer;
 
  248       typedef _Rb_tree_iterator<_Tp> iterator;
 
  250       typedef bidirectional_iterator_tag iterator_category;
 
  251       typedef ptrdiff_t                  difference_type;
 
  253       typedef _Rb_tree_const_iterator<_Tp>        _Self;
 
  254       typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr;
 
  255       typedef const _Rb_tree_node<_Tp>*           _Link_type;
 
  257       _Rb_tree_const_iterator() _GLIBCXX_NOEXCEPT
 
  261       _Rb_tree_const_iterator(_Link_type __x) _GLIBCXX_NOEXCEPT
 
  264       _Rb_tree_const_iterator(
const iterator& __it) _GLIBCXX_NOEXCEPT
 
  265       : _M_node(__it._M_node) { }
 
  268       _M_const_cast() const _GLIBCXX_NOEXCEPT
 
  269       { 
return iterator(static_cast<typename iterator::_Link_type>
 
  270             (const_cast<typename iterator::_Base_ptr>(_M_node))); }
 
  274       { 
return *
static_cast<_Link_type
>(_M_node)->_M_valptr(); }
 
  277       operator->() const _GLIBCXX_NOEXCEPT
 
  278       { 
return static_cast<_Link_type
>(_M_node)->_M_valptr(); }
 
  281       operator++() _GLIBCXX_NOEXCEPT
 
  283     _M_node = _Rb_tree_increment(_M_node);
 
  288       operator++(
int) _GLIBCXX_NOEXCEPT
 
  291     _M_node = _Rb_tree_increment(_M_node);
 
  296       operator--() _GLIBCXX_NOEXCEPT
 
  298     _M_node = _Rb_tree_decrement(_M_node);
 
  303       operator--(
int) _GLIBCXX_NOEXCEPT
 
  306     _M_node = _Rb_tree_decrement(_M_node);
 
  311       operator==(
const _Self& __x) 
const _GLIBCXX_NOEXCEPT
 
  312       { 
return _M_node == __x._M_node; }
 
  315       operator!=(
const _Self& __x) 
const _GLIBCXX_NOEXCEPT
 
  316       { 
return _M_node != __x._M_node; }
 
  321   template<
typename _Val>
 
  323     operator==(
const _Rb_tree_iterator<_Val>& __x,
 
  324                const _Rb_tree_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
 
  325     { 
return __x._M_node == __y._M_node; }
 
  327   template<
typename _Val>
 
  329     operator!=(
const _Rb_tree_iterator<_Val>& __x,
 
  330                const _Rb_tree_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
 
  331     { 
return __x._M_node != __y._M_node; }
 
  334   _Rb_tree_insert_and_rebalance(
const bool __insert_left,
 
  335                                 _Rb_tree_node_base* __x,
 
  336                                 _Rb_tree_node_base* __p,
 
  337                                 _Rb_tree_node_base& __header) 
throw ();
 
  340   _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* 
const __z,
 
  341                    _Rb_tree_node_base& __header) 
throw ();
 
  344   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
  345            typename _Compare, 
typename _Alloc = allocator<_Val> >
 
  349         rebind<_Rb_tree_node<_Val> >::other _Node_allocator;
 
  354       typedef _Rb_tree_node_base*       _Base_ptr;
 
  355       typedef const _Rb_tree_node_base*     _Const_Base_ptr;
 
  358       typedef _Key              key_type;
 
  359       typedef _Val              value_type;
 
  360       typedef value_type*           pointer;
 
  361       typedef const value_type*         const_pointer;
 
  362       typedef value_type&           reference;
 
  363       typedef const value_type&         const_reference;
 
  364       typedef _Rb_tree_node<_Val>*      _Link_type;
 
  365       typedef const _Rb_tree_node<_Val>*    _Const_Link_type;
 
  366       typedef size_t                size_type;
 
  367       typedef ptrdiff_t             difference_type;
 
  368       typedef _Alloc                allocator_type;
 
  371       _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
 
  372       { 
return *
static_cast<_Node_allocator*
>(&this->_M_impl); }
 
  374       const _Node_allocator&
 
  375       _M_get_Node_allocator() const _GLIBCXX_NOEXCEPT
 
  376       { 
return *
static_cast<const _Node_allocator*
>(&this->_M_impl); }
 
  379       get_allocator() const _GLIBCXX_NOEXCEPT
 
  380       { 
return allocator_type(_M_get_Node_allocator()); }
 
  388       _M_put_node(_Link_type __p) _GLIBCXX_NOEXCEPT
 
  391 #if __cplusplus < 201103L 
  393       _M_create_node(
const value_type& __x)
 
  395     _Link_type __tmp = _M_get_node();
 
  397       { get_allocator().construct(__tmp->_M_valptr(), __x); }
 
  401         __throw_exception_again;
 
  407       _M_destroy_node(_Link_type __p)
 
  409     get_allocator().destroy(__p->_M_valptr());
 
  413       template<
typename... _Args>
 
  415         _M_create_node(_Args&&... __args)
 
  417       _Link_type __tmp = _M_get_node();
 
  420           ::new(__tmp) _Rb_tree_node<_Val>;
 
  421           _Alloc_traits::construct(_M_get_Node_allocator(),
 
  423                        std::
forward<_Args>(__args)...);
 
  428           __throw_exception_again;
 
  434       _M_destroy_node(_Link_type __p) noexcept
 
  436     _Alloc_traits::destroy(_M_get_Node_allocator(), __p->_M_valptr());
 
  437     __p->~_Rb_tree_node<_Val>();
 
  443       _M_clone_node(_Const_Link_type __x)
 
  445     _Link_type __tmp = _M_create_node(*__x->_M_valptr());
 
  446     __tmp->_M_color = __x->_M_color;
 
  453       template<
typename _Key_compare, 
 
  454            bool _Is_pod_comparator = __is_pod(_Key_compare)>
 
  455         struct _Rb_tree_impl : 
public _Node_allocator
 
  457       _Key_compare      _M_key_compare;
 
  458       _Rb_tree_node_base    _M_header;
 
  459       size_type         _M_node_count; 
 
  462       : _Node_allocator(), _M_key_compare(), _M_header(),
 
  466       _Rb_tree_impl(
const _Key_compare& __comp, 
const _Node_allocator& __a)
 
  467       : _Node_allocator(__a), _M_key_compare(__comp), _M_header(),
 
  471 #if __cplusplus >= 201103L 
  472       _Rb_tree_impl(
const _Key_compare& __comp, _Node_allocator&& __a)
 
  473       : _Node_allocator(std::move(__a)), _M_key_compare(__comp),
 
  474         _M_header(), _M_node_count(0)
 
  482         this->_M_header._M_color = _S_red;
 
  483         this->_M_header._M_parent = 0;
 
  484         this->_M_header._M_left = &this->_M_header;
 
  485         this->_M_header._M_right = &this->_M_header;
 
  489       _Rb_tree_impl<_Compare> _M_impl;
 
  493       _M_root() _GLIBCXX_NOEXCEPT
 
  494       { 
return this->_M_impl._M_header._M_parent; }
 
  497       _M_root() const _GLIBCXX_NOEXCEPT
 
  498       { 
return this->_M_impl._M_header._M_parent; }
 
  501       _M_leftmost() _GLIBCXX_NOEXCEPT
 
  502       { 
return this->_M_impl._M_header._M_left; }
 
  505       _M_leftmost() const _GLIBCXX_NOEXCEPT
 
  506       { 
return this->_M_impl._M_header._M_left; }
 
  509       _M_rightmost() _GLIBCXX_NOEXCEPT
 
  510       { 
return this->_M_impl._M_header._M_right; }
 
  513       _M_rightmost() const _GLIBCXX_NOEXCEPT
 
  514       { 
return this->_M_impl._M_header._M_right; }
 
  517       _M_begin() _GLIBCXX_NOEXCEPT
 
  518       { 
return static_cast<_Link_type
>(this->_M_impl._M_header._M_parent); }
 
  521       _M_begin() const _GLIBCXX_NOEXCEPT
 
  523     return static_cast<_Const_Link_type
> 
  524       (this->_M_impl._M_header._M_parent);
 
  528       _M_end() _GLIBCXX_NOEXCEPT
 
  529       { 
return static_cast<_Link_type
>(&this->_M_impl._M_header); }
 
  532       _M_end() const _GLIBCXX_NOEXCEPT
 
  533       { 
return static_cast<_Const_Link_type
>(&this->_M_impl._M_header); }
 
  535       static const_reference
 
  536       _S_value(_Const_Link_type __x)
 
  537       { 
return *__x->_M_valptr(); }
 
  540       _S_key(_Const_Link_type __x)
 
  541       { 
return _KeyOfValue()(_S_value(__x)); }
 
  544       _S_left(_Base_ptr __x) _GLIBCXX_NOEXCEPT
 
  545       { 
return static_cast<_Link_type
>(__x->_M_left); }
 
  547       static _Const_Link_type
 
  548       _S_left(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT
 
  549       { 
return static_cast<_Const_Link_type
>(__x->_M_left); }
 
  552       _S_right(_Base_ptr __x) _GLIBCXX_NOEXCEPT
 
  553       { 
return static_cast<_Link_type
>(__x->_M_right); }
 
  555       static _Const_Link_type
 
  556       _S_right(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT
 
  557       { 
return static_cast<_Const_Link_type
>(__x->_M_right); }
 
  559       static const_reference
 
  560       _S_value(_Const_Base_ptr __x)
 
  561       { 
return *
static_cast<_Const_Link_type
>(__x)->_M_valptr(); }
 
  564       _S_key(_Const_Base_ptr __x)
 
  565       { 
return _KeyOfValue()(_S_value(__x)); }
 
  568       _S_minimum(_Base_ptr __x) _GLIBCXX_NOEXCEPT
 
  569       { 
return _Rb_tree_node_base::_S_minimum(__x); }
 
  571       static _Const_Base_ptr
 
  572       _S_minimum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT
 
  573       { 
return _Rb_tree_node_base::_S_minimum(__x); }
 
  576       _S_maximum(_Base_ptr __x) _GLIBCXX_NOEXCEPT
 
  577       { 
return _Rb_tree_node_base::_S_maximum(__x); }
 
  579       static _Const_Base_ptr
 
  580       _S_maximum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT
 
  581       { 
return _Rb_tree_node_base::_S_maximum(__x); }
 
  584       typedef _Rb_tree_iterator<value_type>       iterator;
 
  585       typedef _Rb_tree_const_iterator<value_type> const_iterator;
 
  591       pair<_Base_ptr, _Base_ptr>
 
  592       _M_get_insert_unique_pos(
const key_type& __k);
 
  594       pair<_Base_ptr, _Base_ptr>
 
  595       _M_get_insert_equal_pos(
const key_type& __k);
 
  597       pair<_Base_ptr, _Base_ptr>
 
  598       _M_get_insert_hint_unique_pos(const_iterator __pos,
 
  599                     const key_type& __k);
 
  601       pair<_Base_ptr, _Base_ptr>
 
  602       _M_get_insert_hint_equal_pos(const_iterator __pos,
 
  603                    const key_type& __k);
 
  605 #if __cplusplus >= 201103L 
  606       template<
typename _Arg>
 
  608         _M_insert_(_Base_ptr __x, _Base_ptr __y, _Arg&& __v);
 
  611       _M_insert_node(_Base_ptr __x, _Base_ptr __y, _Link_type __z);
 
  613       template<
typename _Arg>
 
  615         _M_insert_lower(_Base_ptr __y, _Arg&& __v);
 
  617       template<
typename _Arg>
 
  619         _M_insert_equal_lower(_Arg&& __x);
 
  622       _M_insert_lower_node(_Base_ptr __p, _Link_type __z);
 
  625       _M_insert_equal_lower_node(_Link_type __z);
 
  628       _M_insert_(_Base_ptr __x, _Base_ptr __y,
 
  629          const value_type& __v);
 
  634       _M_insert_lower(_Base_ptr __y, 
const value_type& __v);
 
  637       _M_insert_equal_lower(
const value_type& __x);
 
  641       _M_copy(_Const_Link_type __x, _Link_type __p);
 
  644       _M_erase(_Link_type __x);
 
  647       _M_lower_bound(_Link_type __x, _Link_type __y,
 
  651       _M_lower_bound(_Const_Link_type __x, _Const_Link_type __y,
 
  652              const _Key& __k) 
const;
 
  655       _M_upper_bound(_Link_type __x, _Link_type __y,
 
  659       _M_upper_bound(_Const_Link_type __x, _Const_Link_type __y,
 
  660              const _Key& __k) 
const;
 
  666       _Rb_tree(
const _Compare& __comp,
 
  667            const allocator_type& __a = allocator_type())
 
  668       : _M_impl(__comp, _Node_allocator(__a)) { }
 
  670       _Rb_tree(
const _Rb_tree& __x)
 
  671       : _M_impl(__x._M_impl._M_key_compare,
 
  672             _Alloc_traits::_S_select_on_copy(__x._M_get_Node_allocator()))
 
  674     if (__x._M_root() != 0)
 
  676         _M_root() = _M_copy(__x._M_begin(), _M_end());
 
  677         _M_leftmost() = _S_minimum(_M_root());
 
  678         _M_rightmost() = _S_maximum(_M_root());
 
  679         _M_impl._M_node_count = __x._M_impl._M_node_count;
 
  683 #if __cplusplus >= 201103L 
  684       _Rb_tree(
const allocator_type& __a)
 
  685       : _M_impl(_Compare(), _Node_allocator(__a))
 
  688       _Rb_tree(
const _Rb_tree& __x, 
const allocator_type& __a)
 
  689       : _M_impl(__x._M_impl._M_key_compare, _Node_allocator(__a))
 
  691     if (__x._M_root() != 0)
 
  693         _M_root() = _M_copy(__x._M_begin(), _M_end());
 
  694         _M_leftmost() = _S_minimum(_M_root());
 
  695         _M_rightmost() = _S_maximum(_M_root());
 
  696         _M_impl._M_node_count = __x._M_impl._M_node_count;
 
  700       _Rb_tree(_Rb_tree&& __x)
 
  701       : _Rb_tree(std::move(__x), std::move(__x._M_get_Node_allocator()))
 
  704       _Rb_tree(_Rb_tree&& __x, 
const allocator_type& __a)
 
  705       : _Rb_tree(std::move(__x), _Node_allocator(__a))
 
  708       _Rb_tree(_Rb_tree&& __x, _Node_allocator&& __a);
 
  711       ~_Rb_tree() _GLIBCXX_NOEXCEPT
 
  712       { _M_erase(_M_begin()); }
 
  715       operator=(
const _Rb_tree& __x);
 
  720       { 
return _M_impl._M_key_compare; }
 
  723       begin() _GLIBCXX_NOEXCEPT
 
  725     return iterator(static_cast<_Link_type>
 
  726             (this->_M_impl._M_header._M_left));
 
  730       begin() const _GLIBCXX_NOEXCEPT
 
  732     return const_iterator(static_cast<_Const_Link_type>
 
  733                   (this->_M_impl._M_header._M_left));
 
  737       end() _GLIBCXX_NOEXCEPT
 
  738       { 
return iterator(static_cast<_Link_type>(&this->_M_impl._M_header)); }
 
  741       end() const _GLIBCXX_NOEXCEPT
 
  743     return const_iterator(static_cast<_Const_Link_type>
 
  744                   (&this->_M_impl._M_header));
 
  748       rbegin() _GLIBCXX_NOEXCEPT
 
  749       { 
return reverse_iterator(
end()); }
 
  751       const_reverse_iterator
 
  752       rbegin() const _GLIBCXX_NOEXCEPT
 
  753       { 
return const_reverse_iterator(
end()); }
 
  756       rend() _GLIBCXX_NOEXCEPT
 
  757       { 
return reverse_iterator(
begin()); }
 
  759       const_reverse_iterator
 
  760       rend() const _GLIBCXX_NOEXCEPT
 
  761       { 
return const_reverse_iterator(
begin()); }
 
  764       empty() const _GLIBCXX_NOEXCEPT
 
  765       { 
return _M_impl._M_node_count == 0; }
 
  768       size() const _GLIBCXX_NOEXCEPT 
 
  769       { 
return _M_impl._M_node_count; }
 
  772       max_size() const _GLIBCXX_NOEXCEPT
 
  776 #if __cplusplus >= 201103L 
  777       swap(_Rb_tree& __t) noexcept(_Alloc_traits::_S_nothrow_swap());
 
  783 #if __cplusplus >= 201103L 
  784       template<
typename _Arg>
 
  786         _M_insert_unique(_Arg&& __x);
 
  788       template<
typename _Arg>
 
  790         _M_insert_equal(_Arg&& __x);
 
  792       template<
typename _Arg>
 
  794         _M_insert_unique_(const_iterator __position, _Arg&& __x);
 
  796       template<
typename _Arg>
 
  798         _M_insert_equal_(const_iterator __position, _Arg&& __x);
 
  800       template<
typename... _Args>
 
  802     _M_emplace_unique(_Args&&... __args);
 
  804       template<
typename... _Args>
 
  806     _M_emplace_equal(_Args&&... __args);
 
  808       template<
typename... _Args>
 
  810     _M_emplace_hint_unique(const_iterator __pos, _Args&&... __args);
 
  812       template<
typename... _Args>
 
  814     _M_emplace_hint_equal(const_iterator __pos, _Args&&... __args);
 
  817       _M_insert_unique(
const value_type& __x);
 
  820       _M_insert_equal(
const value_type& __x);
 
  823       _M_insert_unique_(const_iterator __position, 
const value_type& __x);
 
  826       _M_insert_equal_(const_iterator __position, 
const value_type& __x);
 
  829       template<
typename _InputIterator>
 
  831         _M_insert_unique(_InputIterator __first, _InputIterator __last);
 
  833       template<
typename _InputIterator>
 
  835         _M_insert_equal(_InputIterator __first, _InputIterator __last);
 
  839       _M_erase_aux(const_iterator __position);
 
  842       _M_erase_aux(const_iterator __first, const_iterator __last);
 
  845 #if __cplusplus >= 201103L 
  848       _GLIBCXX_ABI_TAG_CXX11
 
  850       erase(const_iterator __position)
 
  852     const_iterator __result = __position;
 
  854     _M_erase_aux(__position);
 
  855     return __result._M_const_cast();
 
  859       _GLIBCXX_ABI_TAG_CXX11
 
  861       erase(iterator __position)
 
  863     iterator __result = __position;
 
  865     _M_erase_aux(__position);
 
  870       erase(iterator __position)
 
  871       { _M_erase_aux(__position); }
 
  874       erase(const_iterator __position)
 
  875       { _M_erase_aux(__position); }
 
  878       erase(
const key_type& __x);
 
  880 #if __cplusplus >= 201103L 
  883       _GLIBCXX_ABI_TAG_CXX11
 
  885       erase(const_iterator __first, const_iterator __last)
 
  887     _M_erase_aux(__first, __last);
 
  888     return __last._M_const_cast();
 
  892       erase(iterator __first, iterator __last)
 
  893       { _M_erase_aux(__first, __last); }
 
  896       erase(const_iterator __first, const_iterator __last)
 
  897       { _M_erase_aux(__first, __last); }
 
  900       erase(
const key_type* __first, 
const key_type* __last);
 
  903       clear() _GLIBCXX_NOEXCEPT
 
  905         _M_erase(_M_begin());
 
  906         _M_leftmost() = _M_end();
 
  908         _M_rightmost() = _M_end();
 
  909         _M_impl._M_node_count = 0;
 
  914       find(
const key_type& __k);
 
  917       find(
const key_type& __k) 
const;
 
  920       count(
const key_type& __k) 
const;
 
  923       lower_bound(
const key_type& __k)
 
  924       { 
return _M_lower_bound(_M_begin(), _M_end(), __k); }
 
  927       lower_bound(
const key_type& __k)
 const 
  928       { 
return _M_lower_bound(_M_begin(), _M_end(), __k); }
 
  931       upper_bound(
const key_type& __k)
 
  932       { 
return _M_upper_bound(_M_begin(), _M_end(), __k); }
 
  935       upper_bound(
const key_type& __k)
 const 
  936       { 
return _M_upper_bound(_M_begin(), _M_end(), __k); }
 
  938       pair<iterator, iterator>
 
  939       equal_range(
const key_type& __k);
 
  941       pair<const_iterator, const_iterator>
 
  942       equal_range(
const key_type& __k) 
const;
 
  948 #if __cplusplus >= 201103L 
  950       _M_move_assign(_Rb_tree&);
 
  954   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
  955            typename _Compare, 
typename _Alloc>
 
  957     operator==(
const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
 
  958            const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
 
  960       return __x.size() == __y.size()
 
  961          && 
std::equal(__x.begin(), __x.end(), __y.begin());
 
  964   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
  965            typename _Compare, 
typename _Alloc>
 
  967     operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
 
  968           const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
 
  971                       __y.begin(), __y.end());
 
  974   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
  975            typename _Compare, 
typename _Alloc>
 
  977     operator!=(
const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
 
  978            const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
 
  979     { 
return !(__x == __y); }
 
  981   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
  982            typename _Compare, 
typename _Alloc>
 
  984     operator>(
const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
 
  985           const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
 
  986     { 
return __y < __x; }
 
  988   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
  989            typename _Compare, 
typename _Alloc>
 
  991     operator<=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
 
  992            const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
 
  993     { 
return !(__y < __x); }
 
  995   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
  996            typename _Compare, 
typename _Alloc>
 
  998     operator>=(
const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
 
  999            const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
 
 1000     { 
return !(__x < __y); }
 
 1002   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1003            typename _Compare, 
typename _Alloc>
 
 1005     swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
 
 1006      _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
 
 1009 #if __cplusplus >= 201103L 
 1010   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1011            typename _Compare, 
typename _Alloc>
 
 1012     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1013     _Rb_tree(_Rb_tree&& __x, _Node_allocator&& __a)
 
 1014     : _M_impl(__x._M_impl._M_key_compare, std::move(__a))
 
 1016       if (__x._M_root() != 0)
 
 1018       if (!_Alloc_traits::_S_always_equal()
 
 1019           && __x._M_get_Node_allocator() != __a)
 
 1021           _M_root() = _M_copy(__x._M_begin(), _M_end());
 
 1022           _M_leftmost() = _S_minimum(_M_root());
 
 1023           _M_rightmost() = _S_maximum(_M_root());
 
 1024           _M_impl._M_node_count = __x._M_impl._M_node_count;
 
 1028           _M_root() = __x._M_root();
 
 1029           _M_leftmost() = __x._M_leftmost();
 
 1030           _M_rightmost() = __x._M_rightmost();
 
 1031           _M_root()->_M_parent = _M_end();
 
 1034           __x._M_leftmost() = __x._M_end();
 
 1035           __x._M_rightmost() = __x._M_end();
 
 1037           this->_M_impl._M_node_count = __x._M_impl._M_node_count;
 
 1038           __x._M_impl._M_node_count = 0;
 
 1043   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1044            typename _Compare, 
typename _Alloc>
 
 1046     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1047     _M_move_assign(_Rb_tree& __x)
 
 1049       if (_Alloc_traits::_S_propagate_on_move_assign()
 
 1050       || _Alloc_traits::_S_always_equal()
 
 1051       || _M_get_Node_allocator() == __x._M_get_Node_allocator())
 
 1054       if (__x._M_root() != 0)
 
 1056           _M_root() = __x._M_root();
 
 1057           _M_leftmost() = __x._M_leftmost();
 
 1058           _M_rightmost() = __x._M_rightmost();
 
 1059           _M_root()->_M_parent = _M_end();
 
 1062           __x._M_leftmost() = __x._M_end();
 
 1063           __x._M_rightmost() = __x._M_end();
 
 1065           this->_M_impl._M_node_count = __x._M_impl._M_node_count;
 
 1066           __x._M_impl._M_node_count = 0;
 
 1068       if (_Alloc_traits::_S_propagate_on_move_assign())
 
 1069         std::__alloc_on_move(_M_get_Node_allocator(),
 
 1070                  __x._M_get_Node_allocator());
 
 1077   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1078            typename _Compare, 
typename _Alloc>
 
 1079     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&
 
 1080     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1081     operator=(
const _Rb_tree& __x)
 
 1087 #if __cplusplus >= 201103L 
 1088       if (_Alloc_traits::_S_propagate_on_copy_assign())
 
 1090           auto& __this_alloc = this->_M_get_Node_allocator();
 
 1091           auto& __that_alloc = __x._M_get_Node_allocator();
 
 1092           if (!_Alloc_traits::_S_always_equal()
 
 1093           && __this_alloc != __that_alloc)
 
 1095           std::__alloc_on_copy(__this_alloc, __that_alloc);
 
 1099       _M_impl._M_key_compare = __x._M_impl._M_key_compare;
 
 1100       if (__x._M_root() != 0)
 
 1102           _M_root() = _M_copy(__x._M_begin(), _M_end());
 
 1103           _M_leftmost() = _S_minimum(_M_root());
 
 1104           _M_rightmost() = _S_maximum(_M_root());
 
 1105           _M_impl._M_node_count = __x._M_impl._M_node_count;
 
 1111   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1112            typename _Compare, 
typename _Alloc>
 
 1113 #if __cplusplus >= 201103L 
 1114     template<
typename _Arg>
 
 1116     typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
 
 1117     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1118 #if __cplusplus >= 201103L 
 1119     _M_insert_(_Base_ptr __x, _Base_ptr __p, _Arg&& __v)
 
 1121     _M_insert_(_Base_ptr __x, _Base_ptr __p, 
const _Val& __v)
 
 1124       bool __insert_left = (__x != 0 || __p == _M_end()
 
 1125                 || _M_impl._M_key_compare(_KeyOfValue()(__v),
 
 1128       _Link_type __z = _M_create_node(_GLIBCXX_FORWARD(_Arg, __v));
 
 1130       _Rb_tree_insert_and_rebalance(__insert_left, __z, __p,
 
 1131                     this->_M_impl._M_header);
 
 1132       ++_M_impl._M_node_count;
 
 1133       return iterator(__z);
 
 1136   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1137            typename _Compare, 
typename _Alloc>
 
 1138 #if __cplusplus >= 201103L 
 1139     template<
typename _Arg>
 
 1141     typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
 
 1142     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1143 #if __cplusplus >= 201103L 
 1144     _M_insert_lower(_Base_ptr __p, _Arg&& __v)
 
 1146     _M_insert_lower(_Base_ptr __p, 
const _Val& __v)
 
 1149       bool __insert_left = (__p == _M_end()
 
 1150                 || !_M_impl._M_key_compare(_S_key(__p),
 
 1151                                _KeyOfValue()(__v)));
 
 1153       _Link_type __z = _M_create_node(_GLIBCXX_FORWARD(_Arg, __v));
 
 1155       _Rb_tree_insert_and_rebalance(__insert_left, __z, __p,
 
 1156                     this->_M_impl._M_header);
 
 1157       ++_M_impl._M_node_count;
 
 1158       return iterator(__z);
 
 1161   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1162            typename _Compare, 
typename _Alloc>
 
 1163 #if __cplusplus >= 201103L 
 1164     template<
typename _Arg>
 
 1166     typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
 
 1167     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1168 #if __cplusplus >= 201103L 
 1169     _M_insert_equal_lower(_Arg&& __v)
 
 1171     _M_insert_equal_lower(
const _Val& __v)
 
 1174       _Link_type __x = _M_begin();
 
 1175       _Link_type __y = _M_end();
 
 1179       __x = !_M_impl._M_key_compare(_S_key(__x), _KeyOfValue()(__v)) ?
 
 1180             _S_left(__x) : _S_right(__x);
 
 1182       return _M_insert_lower(__y, _GLIBCXX_FORWARD(_Arg, __v));
 
 1185   template<
typename _Key, 
typename _Val, 
typename _KoV,
 
 1186            typename _Compare, 
typename _Alloc>
 
 1187     typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type
 
 1188     _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::
 
 1189     _M_copy(_Const_Link_type __x, _Link_type __p)
 
 1192       _Link_type __top = _M_clone_node(__x);
 
 1193       __top->_M_parent = __p;
 
 1198         __top->_M_right = _M_copy(_S_right(__x), __top);
 
 1204           _Link_type __y = _M_clone_node(__x);
 
 1206           __y->_M_parent = __p;
 
 1208         __y->_M_right = _M_copy(_S_right(__x), __y);
 
 1216       __throw_exception_again;
 
 1221   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1222            typename _Compare, 
typename _Alloc>
 
 1224     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1225     _M_erase(_Link_type __x)
 
 1230       _M_erase(_S_right(__x));
 
 1231       _Link_type __y = _S_left(__x);
 
 1232       _M_destroy_node(__x);
 
 1237   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1238            typename _Compare, 
typename _Alloc>
 
 1239     typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1240               _Compare, _Alloc>::iterator
 
 1241     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1242     _M_lower_bound(_Link_type __x, _Link_type __y,
 
 1246     if (!_M_impl._M_key_compare(_S_key(__x), __k))
 
 1247       __y = __x, __x = _S_left(__x);
 
 1249       __x = _S_right(__x);
 
 1250       return iterator(__y);
 
 1253   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1254            typename _Compare, 
typename _Alloc>
 
 1255     typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1256               _Compare, _Alloc>::const_iterator
 
 1257     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1258     _M_lower_bound(_Const_Link_type __x, _Const_Link_type __y,
 
 1259            const _Key& __k)
 const 
 1262     if (!_M_impl._M_key_compare(_S_key(__x), __k))
 
 1263       __y = __x, __x = _S_left(__x);
 
 1265       __x = _S_right(__x);
 
 1266       return const_iterator(__y);
 
 1269   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1270            typename _Compare, 
typename _Alloc>
 
 1271     typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1272               _Compare, _Alloc>::iterator
 
 1273     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1274     _M_upper_bound(_Link_type __x, _Link_type __y,
 
 1278     if (_M_impl._M_key_compare(__k, _S_key(__x)))
 
 1279       __y = __x, __x = _S_left(__x);
 
 1281       __x = _S_right(__x);
 
 1282       return iterator(__y);
 
 1285   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1286            typename _Compare, 
typename _Alloc>
 
 1287     typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1288               _Compare, _Alloc>::const_iterator
 
 1289     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1290     _M_upper_bound(_Const_Link_type __x, _Const_Link_type __y,
 
 1291            const _Key& __k)
 const 
 1294     if (_M_impl._M_key_compare(__k, _S_key(__x)))
 
 1295       __y = __x, __x = _S_left(__x);
 
 1297       __x = _S_right(__x);
 
 1298       return const_iterator(__y);
 
 1301   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1302            typename _Compare, 
typename _Alloc>
 
 1303     pair<
typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1304                _Compare, _Alloc>::iterator,
 
 1305      typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1306                _Compare, _Alloc>::iterator>
 
 1307     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1308     equal_range(
const _Key& __k)
 
 1310       _Link_type __x = _M_begin();
 
 1311       _Link_type __y = _M_end();
 
 1314       if (_M_impl._M_key_compare(_S_key(__x), __k))
 
 1315         __x = _S_right(__x);
 
 1316       else if (_M_impl._M_key_compare(__k, _S_key(__x)))
 
 1317         __y = __x, __x = _S_left(__x);
 
 1320           _Link_type __xu(__x), __yu(__y);
 
 1321           __y = __x, __x = _S_left(__x);
 
 1322           __xu = _S_right(__xu);
 
 1323           return pair<iterator,
 
 1324                   iterator>(_M_lower_bound(__x, __y, __k),
 
 1325                     _M_upper_bound(__xu, __yu, __k));
 
 1328       return pair<iterator, iterator>(iterator(__y),
 
 1332   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1333            typename _Compare, 
typename _Alloc>
 
 1334     pair<
typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1335                _Compare, _Alloc>::const_iterator,
 
 1336      typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1337                _Compare, _Alloc>::const_iterator>
 
 1338     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1339     equal_range(
const _Key& __k)
 const 
 1341       _Const_Link_type __x = _M_begin();
 
 1342       _Const_Link_type __y = _M_end();
 
 1345       if (_M_impl._M_key_compare(_S_key(__x), __k))
 
 1346         __x = _S_right(__x);
 
 1347       else if (_M_impl._M_key_compare(__k, _S_key(__x)))
 
 1348         __y = __x, __x = _S_left(__x);
 
 1351           _Const_Link_type __xu(__x), __yu(__y);
 
 1352           __y = __x, __x = _S_left(__x);
 
 1353           __xu = _S_right(__xu);
 
 1354           return pair<const_iterator,
 
 1355                   const_iterator>(_M_lower_bound(__x, __y, __k),
 
 1356                       _M_upper_bound(__xu, __yu, __k));
 
 1359       return pair<const_iterator, const_iterator>(const_iterator(__y),
 
 1360                           const_iterator(__y));
 
 1363   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1364            typename _Compare, 
typename _Alloc>
 
 1367     swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t)
 
 1368 #if __cplusplus >= 201103L 
 1369     noexcept(_Alloc_traits::_S_nothrow_swap())
 
 1374       if (__t._M_root() != 0)
 
 1376           _M_root() = __t._M_root();
 
 1377           _M_leftmost() = __t._M_leftmost();
 
 1378           _M_rightmost() = __t._M_rightmost();
 
 1379           _M_root()->_M_parent = _M_end();
 
 1382           __t._M_leftmost() = __t._M_end();
 
 1383           __t._M_rightmost() = __t._M_end();
 
 1386       else if (__t._M_root() == 0)
 
 1388       __t._M_root() = _M_root();
 
 1389       __t._M_leftmost() = _M_leftmost();
 
 1390       __t._M_rightmost() = _M_rightmost();
 
 1391       __t._M_root()->_M_parent = __t._M_end();
 
 1394       _M_leftmost() = _M_end();
 
 1395       _M_rightmost() = _M_end();
 
 1400       std::swap(_M_leftmost(),__t._M_leftmost());
 
 1401       std::swap(_M_rightmost(),__t._M_rightmost());
 
 1403       _M_root()->_M_parent = _M_end();
 
 1404       __t._M_root()->_M_parent = __t._M_end();
 
 1407       std::swap(this->_M_impl._M_node_count, __t._M_impl._M_node_count);
 
 1408       std::swap(this->_M_impl._M_key_compare, __t._M_impl._M_key_compare);
 
 1410       _Alloc_traits::_S_on_swap(_M_get_Node_allocator(),
 
 1411                 __t._M_get_Node_allocator());
 
 1414   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1415            typename _Compare, 
typename _Alloc>
 
 1416     pair<
typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1417                _Compare, _Alloc>::_Base_ptr,
 
 1418      typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1419                _Compare, _Alloc>::_Base_ptr>
 
 1420     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1421     _M_get_insert_unique_pos(
const key_type& __k)
 
 1423       typedef pair<_Base_ptr, _Base_ptr> _Res;
 
 1424       _Link_type __x = _M_begin();
 
 1425       _Link_type __y = _M_end();
 
 1430       __comp = _M_impl._M_key_compare(__k, _S_key(__x));
 
 1431       __x = __comp ? _S_left(__x) : _S_right(__x);
 
 1433       iterator __j = iterator(__y);
 
 1437         return _Res(__x, __y);
 
 1441       if (_M_impl._M_key_compare(_S_key(__j._M_node), __k))
 
 1442     return _Res(__x, __y);
 
 1443       return _Res(__j._M_node, 0);
 
 1446   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1447            typename _Compare, 
typename _Alloc>
 
 1448     pair<
typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1449                _Compare, _Alloc>::_Base_ptr,
 
 1450      typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1451                _Compare, _Alloc>::_Base_ptr>
 
 1452     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1453     _M_get_insert_equal_pos(
const key_type& __k)
 
 1455       typedef pair<_Base_ptr, _Base_ptr> _Res;
 
 1456       _Link_type __x = _M_begin();
 
 1457       _Link_type __y = _M_end();
 
 1461       __x = _M_impl._M_key_compare(__k, _S_key(__x)) ?
 
 1462             _S_left(__x) : _S_right(__x);
 
 1464       return _Res(__x, __y);
 
 1467   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1468            typename _Compare, 
typename _Alloc>
 
 1469 #if __cplusplus >= 201103L 
 1470     template<
typename _Arg>
 
 1472     pair<
typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1473                _Compare, _Alloc>::iterator, 
bool>
 
 1474     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1475 #if __cplusplus >= 201103L 
 1476     _M_insert_unique(_Arg&& __v)
 
 1478     _M_insert_unique(
const _Val& __v)
 
 1481       typedef pair<iterator, bool> _Res;
 
 1482       pair<_Base_ptr, _Base_ptr> __res
 
 1483     = _M_get_insert_unique_pos(_KeyOfValue()(__v));
 
 1486     return _Res(_M_insert_(__res.first, __res.second,
 
 1487                    _GLIBCXX_FORWARD(_Arg, __v)),
 
 1490       return _Res(iterator(static_cast<_Link_type>(__res.first)), 
false);
 
 1493   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1494            typename _Compare, 
typename _Alloc>
 
 1495 #if __cplusplus >= 201103L 
 1496     template<
typename _Arg>
 
 1498     typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
 
 1499     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1500 #if __cplusplus >= 201103L 
 1501     _M_insert_equal(_Arg&& __v)
 
 1503     _M_insert_equal(
const _Val& __v)
 
 1506       pair<_Base_ptr, _Base_ptr> __res
 
 1507     = _M_get_insert_equal_pos(_KeyOfValue()(__v));
 
 1508       return _M_insert_(__res.first, __res.second, _GLIBCXX_FORWARD(_Arg, __v));
 
 1511   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1512            typename _Compare, 
typename _Alloc>
 
 1513     pair<
typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1514                _Compare, _Alloc>::_Base_ptr,
 
 1515          typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1516                _Compare, _Alloc>::_Base_ptr>
 
 1517     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1518     _M_get_insert_hint_unique_pos(const_iterator __position,
 
 1519                   const key_type& __k)
 
 1521       iterator __pos = __position._M_const_cast();
 
 1522       typedef pair<_Base_ptr, _Base_ptr> _Res;
 
 1525       if (__pos._M_node == _M_end())
 
 1528           && _M_impl._M_key_compare(_S_key(_M_rightmost()), __k))
 
 1529         return _Res(0, _M_rightmost());
 
 1531         return _M_get_insert_unique_pos(__k);
 
 1533       else if (_M_impl._M_key_compare(__k, _S_key(__pos._M_node)))
 
 1536       iterator __before = __pos;
 
 1537       if (__pos._M_node == _M_leftmost()) 
 
 1538         return _Res(_M_leftmost(), _M_leftmost());
 
 1539       else if (_M_impl._M_key_compare(_S_key((--__before)._M_node), __k))
 
 1541           if (_S_right(__before._M_node) == 0)
 
 1542         return _Res(0, __before._M_node);
 
 1544         return _Res(__pos._M_node, __pos._M_node);
 
 1547         return _M_get_insert_unique_pos(__k);
 
 1549       else if (_M_impl._M_key_compare(_S_key(__pos._M_node), __k))
 
 1552       iterator __after = __pos;
 
 1553       if (__pos._M_node == _M_rightmost())
 
 1554         return _Res(0, _M_rightmost());
 
 1555       else if (_M_impl._M_key_compare(__k, _S_key((++__after)._M_node)))
 
 1557           if (_S_right(__pos._M_node) == 0)
 
 1558         return _Res(0, __pos._M_node);
 
 1560         return _Res(__after._M_node, __after._M_node);
 
 1563         return _M_get_insert_unique_pos(__k);
 
 1567     return _Res(__pos._M_node, 0);
 
 1570   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1571            typename _Compare, 
typename _Alloc>
 
 1572 #if __cplusplus >= 201103L 
 1573     template<
typename _Arg>
 
 1575     typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
 
 1576     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1577 #if __cplusplus >= 201103L 
 1578     _M_insert_unique_(const_iterator __position, _Arg&& __v)
 
 1580     _M_insert_unique_(const_iterator __position, 
const _Val& __v)
 
 1583       pair<_Base_ptr, _Base_ptr> __res
 
 1584     = _M_get_insert_hint_unique_pos(__position, _KeyOfValue()(__v));
 
 1587     return _M_insert_(__res.first, __res.second,
 
 1588               _GLIBCXX_FORWARD(_Arg, __v));
 
 1589       return iterator(static_cast<_Link_type>(__res.first));
 
 1592   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1593            typename _Compare, 
typename _Alloc>
 
 1594     pair<
typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1595                _Compare, _Alloc>::_Base_ptr,
 
 1596          typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1597                _Compare, _Alloc>::_Base_ptr>
 
 1598     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1599     _M_get_insert_hint_equal_pos(const_iterator __position, 
const key_type& __k)
 
 1601       iterator __pos = __position._M_const_cast();
 
 1602       typedef pair<_Base_ptr, _Base_ptr> _Res;
 
 1605       if (__pos._M_node == _M_end())
 
 1608           && !_M_impl._M_key_compare(__k, _S_key(_M_rightmost())))
 
 1609         return _Res(0, _M_rightmost());
 
 1611         return _M_get_insert_equal_pos(__k);
 
 1613       else if (!_M_impl._M_key_compare(_S_key(__pos._M_node), __k))
 
 1616       iterator __before = __pos;
 
 1617       if (__pos._M_node == _M_leftmost()) 
 
 1618         return _Res(_M_leftmost(), _M_leftmost());
 
 1619       else if (!_M_impl._M_key_compare(__k, _S_key((--__before)._M_node)))
 
 1621           if (_S_right(__before._M_node) == 0)
 
 1622         return _Res(0, __before._M_node);
 
 1624         return _Res(__pos._M_node, __pos._M_node);
 
 1627         return _M_get_insert_equal_pos(__k);
 
 1632       iterator __after = __pos;
 
 1633       if (__pos._M_node == _M_rightmost())
 
 1634         return _Res(0, _M_rightmost());
 
 1635       else if (!_M_impl._M_key_compare(_S_key((++__after)._M_node), __k))
 
 1637           if (_S_right(__pos._M_node) == 0)
 
 1638         return _Res(0, __pos._M_node);
 
 1640         return _Res(__after._M_node, __after._M_node);
 
 1647   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1648            typename _Compare, 
typename _Alloc>
 
 1649 #if __cplusplus >= 201103L 
 1650     template<
typename _Arg>
 
 1652     typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
 
 1653     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1654 #if __cplusplus >= 201103L 
 1655     _M_insert_equal_(const_iterator __position, _Arg&& __v)
 
 1657     _M_insert_equal_(const_iterator __position, 
const _Val& __v)
 
 1660       pair<_Base_ptr, _Base_ptr> __res
 
 1661     = _M_get_insert_hint_equal_pos(__position, _KeyOfValue()(__v));
 
 1664     return _M_insert_(__res.first, __res.second,
 
 1665               _GLIBCXX_FORWARD(_Arg, __v));
 
 1667       return _M_insert_equal_lower(_GLIBCXX_FORWARD(_Arg, __v));
 
 1670 #if __cplusplus >= 201103L 
 1671   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1672            typename _Compare, 
typename _Alloc>
 
 1673     typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
 
 1674     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1675     _M_insert_node(_Base_ptr __x, _Base_ptr __p, _Link_type __z)
 
 1677       bool __insert_left = (__x != 0 || __p == _M_end()
 
 1678                 || _M_impl._M_key_compare(_S_key(__z),
 
 1681       _Rb_tree_insert_and_rebalance(__insert_left, __z, __p,
 
 1682                     this->_M_impl._M_header);
 
 1683       ++_M_impl._M_node_count;
 
 1684       return iterator(__z);
 
 1687   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1688            typename _Compare, 
typename _Alloc>
 
 1689     typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
 
 1690     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1691     _M_insert_lower_node(_Base_ptr __p, _Link_type __z)
 
 1693       bool __insert_left = (__p == _M_end()
 
 1694                 || !_M_impl._M_key_compare(_S_key(__p),
 
 1697       _Rb_tree_insert_and_rebalance(__insert_left, __z, __p,
 
 1698                     this->_M_impl._M_header);
 
 1699       ++_M_impl._M_node_count;
 
 1700       return iterator(__z);
 
 1703   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1704            typename _Compare, 
typename _Alloc>
 
 1705     typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
 
 1706     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1707     _M_insert_equal_lower_node(_Link_type __z)
 
 1709       _Link_type __x = _M_begin();
 
 1710       _Link_type __y = _M_end();
 
 1714       __x = !_M_impl._M_key_compare(_S_key(__x), _S_key(__z)) ?
 
 1715             _S_left(__x) : _S_right(__x);
 
 1717       return _M_insert_lower_node(__y, __z);
 
 1720   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1721            typename _Compare, 
typename _Alloc>
 
 1722     template<
typename... _Args>
 
 1723       pair<
typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1724                  _Compare, _Alloc>::iterator, 
bool>
 
 1725       _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1726       _M_emplace_unique(_Args&&... __args)
 
 1728     _Link_type __z = _M_create_node(std::forward<_Args>(__args)...);
 
 1732         typedef pair<iterator, bool> _Res;
 
 1733         auto __res = _M_get_insert_unique_pos(_S_key(__z));
 
 1735           return _Res(_M_insert_node(__res.first, __res.second, __z), 
true);
 
 1737         _M_destroy_node(__z);
 
 1738         return _Res(iterator(static_cast<_Link_type>(__res.first)), 
false);
 
 1742         _M_destroy_node(__z);
 
 1743         __throw_exception_again;
 
 1747   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1748            typename _Compare, 
typename _Alloc>
 
 1749     template<
typename... _Args>
 
 1750       typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
 
 1751       _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1752       _M_emplace_equal(_Args&&... __args)
 
 1754     _Link_type __z = _M_create_node(std::forward<_Args>(__args)...);
 
 1758         auto __res = _M_get_insert_equal_pos(_S_key(__z));
 
 1759         return _M_insert_node(__res.first, __res.second, __z);
 
 1763         _M_destroy_node(__z);
 
 1764         __throw_exception_again;
 
 1768   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1769            typename _Compare, 
typename _Alloc>
 
 1770     template<
typename... _Args>
 
 1771       typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
 
 1772       _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1773       _M_emplace_hint_unique(const_iterator __pos, _Args&&... __args)
 
 1775     _Link_type __z = _M_create_node(std::forward<_Args>(__args)...);
 
 1779         auto __res = _M_get_insert_hint_unique_pos(__pos, _S_key(__z));
 
 1782           return _M_insert_node(__res.first, __res.second, __z);
 
 1784         _M_destroy_node(__z);
 
 1785         return iterator(static_cast<_Link_type>(__res.first));
 
 1789         _M_destroy_node(__z);
 
 1790         __throw_exception_again;
 
 1794   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1795            typename _Compare, 
typename _Alloc>
 
 1796     template<
typename... _Args>
 
 1797       typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
 
 1798       _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1799       _M_emplace_hint_equal(const_iterator __pos, _Args&&... __args)
 
 1801     _Link_type __z = _M_create_node(std::forward<_Args>(__args)...);
 
 1805         auto __res = _M_get_insert_hint_equal_pos(__pos, _S_key(__z));
 
 1808           return _M_insert_node(__res.first, __res.second, __z);
 
 1810         return _M_insert_equal_lower_node(__z);
 
 1814         _M_destroy_node(__z);
 
 1815         __throw_exception_again;
 
 1820   template<
typename _Key, 
typename _Val, 
typename _KoV,
 
 1821            typename _Cmp, 
typename _Alloc>
 
 1824       _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::
 
 1825       _M_insert_unique(_II __first, _II __last)
 
 1827     for (; __first != __last; ++__first)
 
 1828       _M_insert_unique_(
end(), *__first);
 
 1831   template<
typename _Key, 
typename _Val, 
typename _KoV,
 
 1832            typename _Cmp, 
typename _Alloc>
 
 1835       _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::
 
 1836       _M_insert_equal(_II __first, _II __last)
 
 1838     for (; __first != __last; ++__first)
 
 1839       _M_insert_equal_(
end(), *__first);
 
 1842   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1843            typename _Compare, 
typename _Alloc>
 
 1845     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1846     _M_erase_aux(const_iterator __position)
 
 1849     static_cast<_Link_type
>(_Rb_tree_rebalance_for_erase
 
 1850                 (const_cast<_Base_ptr>(__position._M_node),
 
 1851                  this->_M_impl._M_header));
 
 1852       _M_destroy_node(__y);
 
 1853       --_M_impl._M_node_count;
 
 1856   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1857            typename _Compare, 
typename _Alloc>
 
 1859     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1860     _M_erase_aux(const_iterator __first, const_iterator __last)
 
 1862       if (__first == 
begin() && __last == 
end())
 
 1865     while (__first != __last)
 
 1869   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1870            typename _Compare, 
typename _Alloc>
 
 1871     typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
 
 1872     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1873     erase(
const _Key& __x)
 
 1875       pair<iterator, iterator> __p = equal_range(__x);
 
 1876       const size_type __old_size = 
size();
 
 1877       erase(__p.first, __p.second);
 
 1878       return __old_size - 
size();
 
 1881   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1882            typename _Compare, 
typename _Alloc>
 
 1884     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1885     erase(
const _Key* __first, 
const _Key* __last)
 
 1887       while (__first != __last)
 
 1891   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1892            typename _Compare, 
typename _Alloc>
 
 1893     typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1894               _Compare, _Alloc>::iterator
 
 1895     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1896     find(
const _Key& __k)
 
 1898       iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k);
 
 1899       return (__j == 
end()
 
 1900           || _M_impl._M_key_compare(__k,
 
 1901                     _S_key(__j._M_node))) ? 
end() : __j;
 
 1904   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1905            typename _Compare, 
typename _Alloc>
 
 1906     typename _Rb_tree<_Key, _Val, _KeyOfValue,
 
 1907               _Compare, _Alloc>::const_iterator
 
 1908     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
 
 1909     find(
const _Key& __k)
 const 
 1911       const_iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k);
 
 1912       return (__j == 
end()
 
 1913           || _M_impl._M_key_compare(__k, 
 
 1914                     _S_key(__j._M_node))) ? 
end() : __j;
 
 1917   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1918            typename _Compare, 
typename _Alloc>
 
 1919     typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type
 
 1921     count(
const _Key& __k)
 const 
 1923       pair<const_iterator, const_iterator> __p = equal_range(__k);
 
 1928   _GLIBCXX_PURE 
unsigned int 
 1929   _Rb_tree_black_count(
const _Rb_tree_node_base* __node,
 
 1930                        const _Rb_tree_node_base* __root) 
throw ();
 
 1932   template<
typename _Key, 
typename _Val, 
typename _KeyOfValue,
 
 1933            typename _Compare, 
typename _Alloc>
 
 1935     _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::__rb_verify()
 const 
 1937       if (_M_impl._M_node_count == 0 || 
begin() == 
end())
 
 1938     return _M_impl._M_node_count == 0 && 
begin() == 
end()
 
 1939            && this->_M_impl._M_header._M_left == _M_end()
 
 1940            && this->_M_impl._M_header._M_right == _M_end();
 
 1942       unsigned int __len = _Rb_tree_black_count(_M_leftmost(), _M_root());
 
 1943       for (const_iterator __it = 
begin(); __it != 
end(); ++__it)
 
 1945       _Const_Link_type __x = 
static_cast<_Const_Link_type
>(__it._M_node);
 
 1946       _Const_Link_type __L = _S_left(__x);
 
 1947       _Const_Link_type __R = _S_right(__x);
 
 1949       if (__x->_M_color == _S_red)
 
 1950         if ((__L && __L->_M_color == _S_red)
 
 1951         || (__R && __R->_M_color == _S_red))
 
 1954       if (__L && _M_impl._M_key_compare(_S_key(__x), _S_key(__L)))
 
 1956       if (__R && _M_impl._M_key_compare(_S_key(__R), _S_key(__x)))
 
 1959       if (!__L && !__R && _Rb_tree_black_count(__x, _M_root()) != __len)
 
 1963       if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root()))
 
 1965       if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root()))
 
 1970 _GLIBCXX_END_NAMESPACE_VERSION
 
Uniform interface to C++98 and C++0x allocators. 
 
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list. 
 
constexpr size_t size() const noexcept
Returns the total number of bits. 
 
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic. 
 
static void deallocate(_Alloc &__a, pointer __p, size_type __n)
Deallocate memory. 
 
bool equal(_II1 __first1, _II1 __last1, _II2 __first2)
Tests a range for element-wise equality. 
 
size_t count() const noexcept
Returns the number of bits which are set. 
 
static size_type max_size(const _Alloc &__a) noexcept
The maximum supported allocation size. 
 
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue. 
 
static pointer allocate(_Alloc &__a, size_type __n)
Allocate memory. 
 
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
 
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers. 
 
complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y. 
 
_Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof. 
 
bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, _Compare __comp)
Performs dictionary comparison on ranges.