43 typename PB_DS_CLASS_C_DEC::head_allocator
44 PB_DS_CLASS_C_DEC::s_head_allocator;
47 typename PB_DS_CLASS_C_DEC::inode_allocator
48 PB_DS_CLASS_C_DEC::s_inode_allocator;
51 typename PB_DS_CLASS_C_DEC::leaf_allocator
52 PB_DS_CLASS_C_DEC::s_leaf_allocator;
56 PB_DS_PAT_TRIE_NAME() :
57 m_p_head(s_head_allocator.allocate(1)),
61 PB_DS_ASSERT_VALID((*
this))
66 PB_DS_PAT_TRIE_NAME(
const access_traits& r_access_traits) :
67 synth_access_traits(r_access_traits),
68 m_p_head(s_head_allocator.allocate(1)),
72 PB_DS_ASSERT_VALID((*
this))
77 PB_DS_PAT_TRIE_NAME(
const PB_DS_CLASS_C_DEC& other) :
81 synth_access_traits(other),
83 m_p_head(s_head_allocator.allocate(1)),
87 m_size = other.m_size;
88 PB_DS_ASSERT_VALID(other)
89 if (other.m_p_head->m_p_parent == 0)
91 PB_DS_ASSERT_VALID((*
this))
96 m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent);
100 s_head_allocator.deallocate(m_p_head, 1);
101 __throw_exception_again;
104 m_p_head->m_p_min = leftmost_descendant(m_p_head->m_p_parent);
105 m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);
106 m_p_head->m_p_parent->m_p_parent = m_p_head;
107 PB_DS_ASSERT_VALID((*
this))
113 swap(PB_DS_CLASS_C_DEC& other)
115 PB_DS_ASSERT_VALID((*
this))
116 PB_DS_ASSERT_VALID(other)
118 std::swap((access_traits& )(*this), (access_traits& )other);
119 PB_DS_ASSERT_VALID((*this))
120 PB_DS_ASSERT_VALID(other)
126 value_swap(PB_DS_CLASS_C_DEC& other)
128 _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
129 std::swap(m_p_head, other.m_p_head);
130 std::swap(m_size, other.m_size);
135 ~PB_DS_PAT_TRIE_NAME()
138 s_head_allocator.deallocate(m_p_head, 1);
146 new (m_p_head) head();
147 m_p_head->m_p_parent = 0;
148 m_p_head->m_p_min = m_p_head;
149 m_p_head->m_p_max = m_p_head;
154 template<
typename It>
157 copy_from_range(It first_it, It last_it)
159 while (first_it != last_it)
160 insert(*(first_it++));
164 typename PB_DS_CLASS_C_DEC::node_pointer
166 recursive_copy_node(node_const_pointer p_ncp)
168 _GLIBCXX_DEBUG_ASSERT(p_ncp != 0);
169 if (p_ncp->m_type == leaf_node)
171 leaf_const_pointer p_other_lf =
static_cast<leaf_const_pointer
>(p_ncp);
172 leaf_pointer p_new_lf = s_leaf_allocator.allocate(1);
173 cond_dealtor cond(p_new_lf);
174 new (p_new_lf) leaf(p_other_lf->value());
175 apply_update(p_new_lf, (node_update*)
this);
176 cond.set_no_action_dtor();
180 _GLIBCXX_DEBUG_ASSERT(p_ncp->m_type == i_node);
181 node_pointer a_p_children[inode::arr_size];
182 size_type child_i = 0;
183 inode_const_pointer p_icp =
static_cast<inode_const_pointer
>(p_ncp);
185 typename inode::const_iterator child_it = p_icp->begin();
190 while (child_it != p_icp->end())
192 a_p_children[child_i] = recursive_copy_node(*(child_it));
196 p_ret = s_inode_allocator.allocate(1);
200 while (child_i-- > 0)
201 clear_imp(a_p_children[child_i]);
202 __throw_exception_again;
205 new (p_ret) inode(p_icp->get_e_ind(), pref_begin(a_p_children[0]));
208 _GLIBCXX_DEBUG_ASSERT(child_i >= 1);
210 p_ret->add_child(a_p_children[child_i], pref_begin(a_p_children[child_i]),
211 pref_end(a_p_children[child_i]),
this);
212 while (child_i-- > 0);
213 apply_update(p_ret, (node_update*)
this);