47 for (size_type i = 0; i < m_size; ++i)
48 erase_at(m_a_entries, i, s_no_throw_copies_ind);
52 const size_type new_size = resize_policy::get_new_size_for_arbitrary(0);
53 entry_pointer new_entries = s_entry_allocator.allocate(new_size);
54 resize_policy::notify_arbitrary(new_size);
55 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
56 m_actual_size = new_size;
57 m_a_entries = new_entries;
63 PB_DS_ASSERT_VALID((*
this))
69 erase_at(entry_pointer a_entries, size_type i,
false_type)
71 a_entries[i]->~value_type();
72 s_value_allocator.deallocate(a_entries[i], 1);
78 erase_at(entry_pointer, size_type,
true_type)
86 PB_DS_ASSERT_VALID((*
this))
87 _GLIBCXX_DEBUG_ASSERT(!empty());
90 erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);
91 resize_for_erase_if_needed();
92 _GLIBCXX_DEBUG_ASSERT(m_size > 0);
95 PB_DS_ASSERT_VALID((*this))
99 template<typename Pred>
100 typename PB_DS_CLASS_C_DEC::size_type
104 PB_DS_ASSERT_VALID((*
this))
106 typedef typename entry_pred<value_type, Pred, _Alloc, simple_value>::type
109 const size_type
left = partition(pred_t(pred));
110 _GLIBCXX_DEBUG_ASSERT(m_size >=
left);
111 const size_type ersd = m_size - left;
112 for (size_type i = left; i < m_size; ++i)
113 erase_at(m_a_entries, i, s_no_throw_copies_ind);
117 const size_type new_size =
118 resize_policy::get_new_size_for_arbitrary(left);
120 entry_pointer new_entries = s_entry_allocator.allocate(new_size);
121 std::copy(m_a_entries, m_a_entries + left, new_entries);
122 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
123 m_actual_size = new_size;
124 resize_policy::notify_arbitrary(m_actual_size);
131 PB_DS_ASSERT_VALID((*
this))
138 erase(point_iterator it)
140 PB_DS_ASSERT_VALID((*
this))
141 _GLIBCXX_DEBUG_ASSERT(!empty());
143 const size_type fix_pos = it.m_p_e - m_a_entries;
144 std::swap(*it.m_p_e, m_a_entries[m_size - 1]);
145 erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);
146 resize_for_erase_if_needed();
148 _GLIBCXX_DEBUG_ASSERT(m_size > 0);
150 _GLIBCXX_DEBUG_ASSERT(fix_pos <= m_size);
152 if (fix_pos != m_size)
153 fix(m_a_entries + fix_pos);
155 PB_DS_ASSERT_VALID((*this))
161 resize_for_erase_if_needed()
163 if (!resize_policy::resize_needed_for_shrink(m_size))
168 const size_type new_size = resize_policy::get_new_size_for_shrink();
169 entry_pointer new_entries = s_entry_allocator.allocate(new_size);
170 resize_policy::notify_shrink_resize();
172 _GLIBCXX_DEBUG_ASSERT(m_size > 0);
173 std::copy(m_a_entries, m_a_entries + m_size - 1, new_entries);
174 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
175 m_actual_size = new_size;
176 m_a_entries = new_entries;
183 template<
typename Pred>
184 typename PB_DS_CLASS_C_DEC::size_type
189 size_type
right = m_size - 1;
191 while (right + 1 != left)
193 _GLIBCXX_DEBUG_ASSERT(left <= m_size);
195 if (!pred(m_a_entries[left]))
197 else if (pred(m_a_entries[right]))
201 _GLIBCXX_DEBUG_ASSERT(left < right);
202 std::swap(m_a_entries[left], m_a_entries[right]);
ios_base & right(ios_base &__base)
Calls base.setf(ios_base::right, ios_base::adjustfield).
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).