本文整理汇总了C++中boost::unordered_map::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ unordered_map::empty方法的具体用法?C++ unordered_map::empty怎么用?C++ unordered_map::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::unordered_map
的用法示例。
在下文中一共展示了unordered_map::empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_db_torrents_sql
void read_db_torrents_sql()
{
try
{
if (!m_config.m_auto_register)
{
Csql_result result = Csql_query(m_database, "select info_hash, @fid from @files where flags & 1").execute();
while (Csql_row row = result.fetch_row())
{
m_torrents.erase(to_array<char, 20>(row[0]));
Csql_query(m_database, "delete from @files where @fid = ?")(row[1]).execute();
}
}
if (m_config.m_auto_register && !m_torrents.empty())
return;
Csql_result result = Csql_query(m_database, "select info_hash, @completed, @fid, ctime from @files where @fid >= ?")(m_fid_end).execute();
// m_torrents.reserve(m_torrents.size() + result.size());
while (Csql_row row = result.fetch_row())
{
m_fid_end = std::max<int>(m_fid_end, row[2].i() + 1);
if (row[0].size() != 20 || find_torrent(row[0].s()))
continue;
t_torrent& file = m_torrents[to_array<char, 20>(row[0])];
if (file.fid)
continue;
file.completed = row[1].i();
file.dirty = false;
file.fid = row[2].i();
file.ctime = row[3].i();
}
}
catch (bad_query&)
{
}
}
示例2: it
inline void operator<< (object::with_zone& o, const boost::unordered_map<K,V>& v)
{
o.type = type::MAP;
if(v.empty()) {
o.via.map.ptr = NULL;
o.via.map.size = 0;
} else {
object_kv* p = (object_kv*)o.zone->malloc(sizeof(object_kv)*v.size());
object_kv* const pend = p + v.size();
o.via.map.ptr = p;
o.via.map.size = v.size();
typename boost::unordered_map<K,V>::const_iterator it(v.begin());
do {
p->key = object(it->first, o.zone);
p->val = object(it->second, o.zone);
++p;
++it;
} while(p < pend);
}
}