44 insert(const_reference r_value)
46 PB_DS_ASSERT_VALID((*
this))
47 std::pair<point_iterator,
bool> ins_pair = insert_leaf_imp(r_value);
48 ins_pair.first.m_p_nd->m_special = false;
49 PB_DS_ASSERT_VALID((*this))
50 splay(ins_pair.first.m_p_nd);
51 PB_DS_ASSERT_VALID((*this))
56 inline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator,
bool>
58 insert_leaf_imp(const_reference r_value)
60 _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid(__FILE__,
62 if (base_type::m_size == 0)
63 return std::
make_pair(base_type::insert_imp_empty(r_value), true);
65 node_pointer p_nd = base_type::m_p_head->m_p_parent;
66 node_pointer p_pot = base_type::m_p_head;
69 if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), PB_DS_V2F(r_value)))
71 if (!Cmp_Fn::operator()(PB_DS_V2F(r_value), PB_DS_V2F(p_nd->m_value)))
76 p_nd = p_nd->m_p_left;
79 p_nd = p_nd->m_p_right;
81 if (p_pot == base_type::m_p_head)
82 return std::make_pair(base_type::insert_leaf_new(r_value, base_type::m_p_head->m_p_right,
false),
true);
84 PB_DS_CHECK_KEY_DOES_NOT_EXIST(PB_DS_V2F(r_value))
86 p_nd = p_pot->m_p_left;
88 return (std::
make_pair(base_type::insert_leaf_new(r_value, p_pot, true), true));
90 while (p_nd->m_p_right != 0)
91 p_nd = p_nd->m_p_right;
93 return std::
make_pair(this->insert_leaf_new(r_value, p_nd, false), true);
constexpr pair< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > make_pair(_T1 &&__x, _T2 &&__y)
A convenience wrapper for creating a pair from two objects.
Struct holding two objects of arbitrary type.