41 #ifdef PB_DS_CLASS_C_DEC
48 for (size_type i = 0; i < m_size; ++i)
49 erase_at(m_a_entries, i, s_no_throw_copies_ind);
53 const size_type new_size = resize_policy::get_new_size_for_arbitrary(0);
54 entry_pointer new_entries = s_entry_allocator.allocate(new_size);
55 resize_policy::notify_arbitrary(new_size);
56 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
57 m_actual_size = new_size;
58 m_a_entries = new_entries;
64 PB_DS_ASSERT_VALID((*
this))
70 erase_at(entry_pointer a_entries, size_type i,
false_type)
72 a_entries[i]->~value_type();
73 s_value_allocator.deallocate(a_entries[i], 1);
79 erase_at(entry_pointer, size_type,
true_type)
87 PB_DS_ASSERT_VALID((*
this))
88 _GLIBCXX_DEBUG_ASSERT(!
empty());
91 erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);
92 resize_for_erase_if_needed();
93 _GLIBCXX_DEBUG_ASSERT(m_size > 0);
96 PB_DS_ASSERT_VALID((*this))
100 template<typename Pred>
101 typename PB_DS_CLASS_C_DEC::size_type
105 PB_DS_ASSERT_VALID((*
this))
107 typedef typename entry_pred<value_type, Pred, _Alloc, simple_value>::type
110 const size_type
left = partition(pred_t(pred));
111 _GLIBCXX_DEBUG_ASSERT(m_size >=
left);
112 const size_type ersd = m_size -
left;
113 for (size_type i =
left; i < m_size; ++i)
114 erase_at(m_a_entries, i, s_no_throw_copies_ind);
118 const size_type new_size =
119 resize_policy::get_new_size_for_arbitrary(
left);
121 entry_pointer new_entries = s_entry_allocator.allocate(new_size);
122 std::copy(m_a_entries, m_a_entries +
left, new_entries);
123 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
124 m_a_entries = new_entries;
125 m_actual_size = new_size;
126 resize_policy::notify_arbitrary(m_actual_size);
133 PB_DS_ASSERT_VALID((*
this))
140 erase(point_iterator it)
142 PB_DS_ASSERT_VALID((*
this))
143 _GLIBCXX_DEBUG_ASSERT(!
empty());
145 const size_type fix_pos = it.m_p_e - m_a_entries;
146 std::
swap(*it.m_p_e, m_a_entries[m_size - 1]);
147 erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);
148 resize_for_erase_if_needed();
150 _GLIBCXX_DEBUG_ASSERT(m_size > 0);
152 _GLIBCXX_DEBUG_ASSERT(fix_pos <= m_size);
154 if (fix_pos != m_size)
155 fix(m_a_entries + fix_pos);
157 PB_DS_ASSERT_VALID((*this))
163 resize_for_erase_if_needed()
165 if (!resize_policy::resize_needed_for_shrink(m_size))
170 const size_type new_size = resize_policy::get_new_size_for_shrink();
171 entry_pointer new_entries = s_entry_allocator.allocate(new_size);
172 resize_policy::notify_shrink_resize();
174 _GLIBCXX_DEBUG_ASSERT(m_size > 0);
175 std::copy(m_a_entries, m_a_entries + m_size - 1, new_entries);
176 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
177 m_actual_size = new_size;
178 m_a_entries = new_entries;
185 template<
typename Pred>
186 typename PB_DS_CLASS_C_DEC::size_type
191 size_type
right = m_size - 1;
195 _GLIBCXX_DEBUG_ASSERT(
left <= m_size);
197 if (!pred(m_a_entries[
left]))
199 else if (pred(m_a_entries[
right]))
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
void swap(shared_lock< _Mutex > &__x, shared_lock< _Mutex > &__y) noexcept
Swap specialization for shared_lock.
ISO C++ entities toplevel namespace is std.
ios_base & right(ios_base &__base)
Calls base.setf(ios_base::right, ios_base::adjustfield).
constexpr auto empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
Return whether a container is empty.
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).