PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: cmp(const Cntnr& r_c, const native_type& r_native_c, const std::string& r_call_fn) { m_alloc.set_throw_prob(1); const size_t size = r_c.size(); const size_t native_size = r_native_c.size(); PB_DS_THROW_IF_FAILED( size == native_size, static_cast<unsigned long>(size) << " " << static_cast<unsigned long>(native_size), & r_c, & r_native_c); const bool empty = r_c.empty(); const bool native_empty = r_native_c.empty(); PB_DS_THROW_IF_FAILED( empty == native_empty, empty << " " << native_empty, & r_c, & r_native_c); try { basic_cmp_(r_c, r_native_c); cmp_(r_c, r_native_c); } catch(...) { PB_DS_THROW_IF_FAILED( false, "call-fn: " + r_call_fn, & r_c, & r_native_c); } }
PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: split_join_imp(pb_ds::detail::true_type) { PB_DS_TRACE("split_join"); bool done = true; PB_DS_SET_DESTRUCT_PRINT try { m_alloc.set_throw_prob(0); Cntnr lhs(*m_p_c); Cntnr rhs; native_type native_lhs(m_native_c); native_type native_rhs; const key_type k = test_traits::generate_key(m_g, m_m); m_alloc.set_throw_prob(m_tp); lhs.split(k, rhs); typename native_type::const_iterator it = native_lhs.upper_bound(test_traits::native_key(k)); while (!native_lhs.empty()&& it != native_lhs.end()) { native_rhs.insert(*it); typename native_type::const_iterator next_it = it; ++next_it; native_lhs.erase(test_traits::extract_native_key(*it)); it = next_it; } PB_DS_COND_COMPARE(lhs, native_lhs); PB_DS_COND_COMPARE(rhs, native_rhs); m_alloc.set_throw_prob(m_tp); if (m_g.get_prob() < 0.5) lhs.swap(rhs); lhs.join(rhs); PB_DS_THROW_IF_FAILED( rhs.size() == 0, static_cast<unsigned long>(rhs.size()), m_p_c, & m_native_c); PB_DS_THROW_IF_FAILED( rhs.empty(), static_cast<unsigned long>(rhs.size()), m_p_c, & m_native_c); m_p_c->swap(lhs); } catch(__gnu_cxx::forced_exception_error& ) { done = false; PB_DS_THROW_IF_FAILED( container_traits::split_join_can_throw, container_traits::split_join_can_throw, m_p_c, & m_native_c); } PB_DS_COND_COMPARE(*m_p_c, m_native_c); PB_DS_CANCEL_DESTRUCT_PRINT return (done); }