本文整理汇总了C++中Hash::upper_bound方法的典型用法代码示例。如果您正苦于以下问题:C++ Hash::upper_bound方法的具体用法?C++ Hash::upper_bound怎么用?C++ Hash::upper_bound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hash
的用法示例。
在下文中一共展示了Hash::upper_bound方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
int
da_build_dump(da_build_t* builder, char* tmpfile, FILE* lexfile)
{
Hash::iterator i, last;
Hash* entries = builder->entries;
char** keys = new char*[entries->size()];
size_t* lens = new size_t[entries->size()];
long* vals = new long[entries->size()];
int size = 0;
std::vector<long> lex_indices;
std::cerr << entries->size() << " entries" << std::endl;
i = entries->begin();
while (i != entries->end()) {
const std::string& key = i->first;
last = entries->upper_bound(key);
lex_indices.clear();
for (; i != last; i++) {
lex_indices.push_back(i->second);
}
lens[size] = key.size();
keys[size] = (char*) key.data();
vals[size] = redump_lex(lens[size], lex_indices, tmpfile, lexfile);
if (vals[size] < 0) {
std::cerr << "Unexpected error at " << key << std::endl;
cha_exit_perror((char*)"build darts file");
}
size++;
}
std::cerr << size << " keys" << std::endl;
DoubleArrayL da;
da.build(size, (const char**) keys, lens, vals);
da.save(builder->path->c_str(), "wb");
return builder->entries->size();
}