46 for (size_type i = 0; i < m_size; ++i)
47 erase_at(m_a_entries, i, s_no_throw_copies_ind);
51 const size_type new_size = resize_policy::get_new_size_for_arbitrary(0);
52 entry_pointer new_entries = s_entry_allocator.allocate(new_size);
53 resize_policy::notify_arbitrary(new_size);
54 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
55 m_actual_size = new_size;
56 m_a_entries = new_entries;
62 PB_DS_ASSERT_VALID((*
this))
68 erase_at(entry_pointer a_entries, size_type i,
false_type)
70 a_entries[i]->~value_type();
71 s_value_allocator.deallocate(a_entries[i], 1);
77 erase_at(entry_pointer, size_type,
true_type)
85 PB_DS_ASSERT_VALID((*
this))
86 _GLIBCXX_DEBUG_ASSERT(!empty());
89 erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);
90 resize_for_erase_if_needed();
91 _GLIBCXX_DEBUG_ASSERT(m_size > 0);
94 PB_DS_ASSERT_VALID((*this))
98 template<typename Pred>
99 typename PB_DS_CLASS_C_DEC::size_type
103 PB_DS_ASSERT_VALID((*
this))
105 typedef typename entry_pred<value_type, Pred, _Alloc, simple_value>::type
108 const size_type
left = partition(pred_t(pred));
109 _GLIBCXX_DEBUG_ASSERT(m_size >=
left);
110 const size_type ersd = m_size -
left;
111 for (size_type i =
left; i < m_size; ++i)
112 erase_at(m_a_entries, i, s_no_throw_copies_ind);
116 const size_type new_size =
117 resize_policy::get_new_size_for_arbitrary(
left);
119 entry_pointer new_entries = s_entry_allocator.allocate(new_size);
120 std::copy(m_a_entries, m_a_entries +
left, new_entries);
121 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
122 m_actual_size = new_size;
123 resize_policy::notify_arbitrary(m_actual_size);
130 PB_DS_ASSERT_VALID((*
this))
137 erase(point_iterator it)
139 PB_DS_ASSERT_VALID((*
this))
140 _GLIBCXX_DEBUG_ASSERT(!empty());
142 const size_type fix_pos = it.m_p_e - m_a_entries;
143 std::swap(*it.m_p_e, m_a_entries[m_size - 1]);
144 erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);
145 resize_for_erase_if_needed();
147 _GLIBCXX_DEBUG_ASSERT(m_size > 0);
149 _GLIBCXX_DEBUG_ASSERT(fix_pos <= m_size);
151 if (fix_pos != m_size)
152 fix(m_a_entries + fix_pos);
154 PB_DS_ASSERT_VALID((*this))
160 resize_for_erase_if_needed()
162 if (!resize_policy::resize_needed_for_shrink(m_size))
167 const size_type new_size = resize_policy::get_new_size_for_shrink();
168 entry_pointer new_entries = s_entry_allocator.allocate(new_size);
169 resize_policy::notify_shrink_resize();
171 _GLIBCXX_DEBUG_ASSERT(m_size > 0);
172 std::copy(m_a_entries, m_a_entries + m_size - 1, new_entries);
173 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
174 m_actual_size = new_size;
175 m_a_entries = new_entries;
182 template<
typename Pred>
183 typename PB_DS_CLASS_C_DEC::size_type
188 size_type
right = m_size - 1;
192 _GLIBCXX_DEBUG_ASSERT(
left <= m_size);
194 if (!pred(m_a_entries[
left]))
196 else if (pred(m_a_entries[
right]))
201 std::swap(m_a_entries[
left], m_a_entries[
right]);
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
ISO C++ entities toplevel namespace is std.
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
ios_base & right(ios_base &__base)
Calls base.setf(ios_base::right, ios_base::adjustfield).