43 template<
typename Pred>
46 split(Pred pred, PB_DS_CLASS_C_DEC& other)
48 PB_DS_ASSERT_VALID((*
this))
51 typename entry_pred<value_type, Pred, _Alloc, simple_value>::type
54 const size_type
left = partition(pred_t(pred));
55 _GLIBCXX_DEBUG_ASSERT(m_size >=
left);
57 const size_type ersd = m_size - left;
58 _GLIBCXX_DEBUG_ASSERT(m_size >= ersd);
60 const size_type new_size = resize_policy::get_new_size_for_arbitrary(left);
61 const size_type other_actual_size = other.get_new_size_for_arbitrary(ersd);
63 entry_pointer a_entries = 0;
64 entry_pointer a_other_entries = 0;
68 a_entries = s_entry_allocator.allocate(new_size);
69 a_other_entries = s_entry_allocator.allocate(other_actual_size);
74 s_entry_allocator.deallocate(a_entries, new_size);
76 if (a_other_entries != 0)
77 s_entry_allocator.deallocate(a_other_entries, other_actual_size);
79 __throw_exception_again;
82 for (size_type i = 0; i < other.m_size; ++i)
83 erase_at(other.m_a_entries, i, s_no_throw_copies_ind);
85 _GLIBCXX_DEBUG_ASSERT(new_size >= left);
86 std::copy(m_a_entries, m_a_entries + left, a_entries);
87 std::copy(m_a_entries + left, m_a_entries + m_size, a_other_entries);
89 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
90 s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);
92 m_actual_size = new_size;
93 other.m_actual_size = other_actual_size;
98 m_a_entries = a_entries;
99 other.m_a_entries = a_other_entries;
104 resize_policy::notify_arbitrary(m_actual_size);
105 other.notify_arbitrary(other.m_actual_size);
107 PB_DS_ASSERT_VALID((*
this))
108 PB_DS_ASSERT_VALID(other)
114 join(PB_DS_CLASS_C_DEC& other)
116 PB_DS_ASSERT_VALID((*
this))
117 PB_DS_ASSERT_VALID(other)
119 const size_type len = m_size + other.m_size;
120 const size_type new_size = resize_policy::get_new_size_for_arbitrary(len);
122 entry_pointer a_entries = 0;
123 entry_pointer a_other_entries = 0;
127 a_entries = s_entry_allocator.allocate(new_size);
128 a_other_entries = s_entry_allocator.allocate(resize_policy::min_size);
133 s_entry_allocator.deallocate(a_entries, new_size);
135 if (a_other_entries != 0)
136 s_entry_allocator.deallocate(a_other_entries, resize_policy::min_size);
138 __throw_exception_again;
141 std::copy(m_a_entries, m_a_entries + m_size, a_entries);
142 std::copy(other.m_a_entries, other.m_a_entries + other.m_size,
145 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
146 m_a_entries = a_entries;
148 m_actual_size = new_size;
149 resize_policy::notify_arbitrary(new_size);
152 s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);
153 other.m_a_entries = a_other_entries;
155 other.m_actual_size = resize_policy::min_size;
156 other.notify_arbitrary(resize_policy::min_size);
159 PB_DS_ASSERT_VALID((*
this))
160 PB_DS_ASSERT_VALID(other)
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).