42 template<
typename Pred>
45 split(Pred pred, PB_DS_CLASS_C_DEC& other)
47 PB_DS_ASSERT_VALID((*
this))
50 typename entry_pred<value_type, Pred, _Alloc, simple_value>::type
53 const size_type
left = partition(pred_t(pred));
54 _GLIBCXX_DEBUG_ASSERT(m_size >=
left);
56 const size_type ersd = m_size -
left;
57 _GLIBCXX_DEBUG_ASSERT(m_size >= ersd);
59 const size_type new_size = resize_policy::get_new_size_for_arbitrary(
left);
60 const size_type other_actual_size = other.get_new_size_for_arbitrary(ersd);
62 entry_pointer a_entries = 0;
63 entry_pointer a_other_entries = 0;
67 a_entries = s_entry_allocator.allocate(new_size);
68 a_other_entries = s_entry_allocator.allocate(other_actual_size);
73 s_entry_allocator.deallocate(a_entries, new_size);
75 if (a_other_entries != 0)
76 s_entry_allocator.deallocate(a_other_entries, other_actual_size);
78 __throw_exception_again;
81 for (size_type i = 0; i < other.m_size; ++i)
82 erase_at(other.m_a_entries, i, s_no_throw_copies_ind);
84 _GLIBCXX_DEBUG_ASSERT(new_size >=
left);
85 std::copy(m_a_entries, m_a_entries +
left, a_entries);
86 std::copy(m_a_entries +
left, m_a_entries + m_size, a_other_entries);
88 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
89 s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);
91 m_actual_size = new_size;
92 other.m_actual_size = other_actual_size;
97 m_a_entries = a_entries;
98 other.m_a_entries = a_other_entries;
103 resize_policy::notify_arbitrary(m_actual_size);
104 other.notify_arbitrary(other.m_actual_size);
106 PB_DS_ASSERT_VALID((*
this))
107 PB_DS_ASSERT_VALID(other)
113 join(PB_DS_CLASS_C_DEC& other)
115 PB_DS_ASSERT_VALID((*
this))
116 PB_DS_ASSERT_VALID(other)
118 const size_type len = m_size + other.m_size;
119 const size_type new_size = resize_policy::get_new_size_for_arbitrary(len);
121 entry_pointer a_entries = 0;
122 entry_pointer a_other_entries = 0;
126 a_entries = s_entry_allocator.allocate(new_size);
127 a_other_entries = s_entry_allocator.allocate(resize_policy::min_size);
132 s_entry_allocator.deallocate(a_entries, new_size);
134 if (a_other_entries != 0)
135 s_entry_allocator.deallocate(a_other_entries, resize_policy::min_size);
137 __throw_exception_again;
140 std::copy(m_a_entries, m_a_entries + m_size, a_entries);
141 std::copy(other.m_a_entries, other.m_a_entries + other.m_size,
144 s_entry_allocator.deallocate(m_a_entries, m_actual_size);
145 m_a_entries = a_entries;
147 m_actual_size = new_size;
148 resize_policy::notify_arbitrary(new_size);
151 s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);
152 other.m_a_entries = a_other_entries;
154 other.m_actual_size = resize_policy::min_size;
155 other.notify_arbitrary(resize_policy::min_size);
158 PB_DS_ASSERT_VALID((*
this))
159 PB_DS_ASSERT_VALID(other)
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).