41#ifdef PB_DS_CLASS_C_DEC
44template<
typename Pred>
47split(Pred pred, PB_DS_CLASS_C_DEC& other)
49 PB_DS_ASSERT_VALID((*
this))
52 typename entry_pred<value_type, Pred, _Alloc, simple_value>::type
55 const size_type left = partition(pred_t(pred));
56 _GLIBCXX_DEBUG_ASSERT(m_size >= left);
58 const size_type ersd = m_size - left;
59 _GLIBCXX_DEBUG_ASSERT(m_size >= ersd);
61 const size_type new_size = resize_policy::get_new_size_for_arbitrary(left);
62 const size_type other_actual_size = other.get_new_size_for_arbitrary(ersd);
64 entry_pointer a_entries = 0;
65 entry_pointer a_other_entries = 0;
69 a_entries = s_entry_allocator.allocate(new_size);
70 a_other_entries = s_entry_allocator.allocate(other_actual_size);
75 s_entry_allocator.deallocate(a_entries, new_size);
77 if (a_other_entries != 0)
78 s_entry_allocator.deallocate(a_other_entries, other_actual_size);
80 __throw_exception_again;
83 for (size_type i = 0; i < other.m_size; ++i)
84 erase_at(other.m_a_entries, i, s_no_throw_copies_ind);
86 _GLIBCXX_DEBUG_ASSERT(new_size >= left);
87 std::copy(m_a_entries, m_a_entries + left, a_entries);
88 std::copy(m_a_entries + left, m_a_entries + m_size, a_other_entries);
90 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
91 s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);
93 m_actual_size = new_size;
94 other.m_actual_size = other_actual_size;
99 m_a_entries = a_entries;
100 other.m_a_entries = a_other_entries;
105 resize_policy::notify_arbitrary(m_actual_size);
106 other.notify_arbitrary(other.m_actual_size);
108 PB_DS_ASSERT_VALID((*
this))
109 PB_DS_ASSERT_VALID(other)
115join(PB_DS_CLASS_C_DEC& other)
117 PB_DS_ASSERT_VALID((*
this))
118 PB_DS_ASSERT_VALID(other)
120 const size_type len = m_size + other.m_size;
121 const size_type new_size = resize_policy::get_new_size_for_arbitrary(len);
123 entry_pointer a_entries = 0;
124 entry_pointer a_other_entries = 0;
128 a_entries = s_entry_allocator.allocate(new_size);
129 a_other_entries = s_entry_allocator.allocate(resize_policy::min_size);
134 s_entry_allocator.deallocate(a_entries, new_size);
136 if (a_other_entries != 0)
137 s_entry_allocator.deallocate(a_other_entries, resize_policy::min_size);
139 __throw_exception_again;
142 std::copy(m_a_entries, m_a_entries + m_size, a_entries);
143 std::copy(other.m_a_entries, other.m_a_entries + other.m_size,
146 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
147 m_a_entries = a_entries;
149 m_actual_size = new_size;
150 resize_policy::notify_arbitrary(new_size);
153 s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);
154 other.m_a_entries = a_other_entries;
156 other.m_actual_size = resize_policy::min_size;
157 other.notify_arbitrary(resize_policy::min_size);
160 PB_DS_ASSERT_VALID((*
this))
161 PB_DS_ASSERT_VALID(other)
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).