Example #1
0
 void write(RawWriter & raw_writer, State & state, const native_type & t) const {
     // TODO verify overflow
     native_index_type sz = static_cast<native_index_type>(t.size());
     index_format().write(raw_writer, state, sz);
     for (const auto & v : t) {
         value_format().write(raw_writer, state, v);
     }
 }
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);
    }
}