本文整理汇总了C++中hash_map::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ hash_map::empty方法的具体用法?C++ hash_map::empty怎么用?C++ hash_map::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hash_map
的用法示例。
在下文中一共展示了hash_map::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
SatProblem cnf;
cnf.parse(stdin);
size_t count = 0;
while (count < 100) {
cerr << "count = " << count << endl;
equivalences.clear();
implications.clear();
for (size_t i = 0; i < cnf.clauses.size(); ++i) {
if (cnf.clauses[i].size() == 0) {
abort();
} else if (cnf.clauses[i].size() == 1) {
addEquivalence(cnf.clauses[i][0], TRUE);
addEquivalence(invert(cnf.clauses[i][0]), FALSE);
} else if (cnf.clauses[i].size() == 2) {
implications[invert(cnf.clauses[i][0])].push_back(cnf.clauses[i][1]);
implications[invert(cnf.clauses[i][1])].push_back(cnf.clauses[i][0]);
} else {
// Do nothing
}
}
done.clear();
for (hash_map<Lit, vector<Lit> >::const_iterator i = implications.begin();
i != implications.end(); ++i) {
vector<Lit> stack;
// cerr << "Exploring " << i->first << endl;
explore(i->first, stack);
}
vector<Clause> oldClauses = cnf.clauses;
cnf.clauses.clear();
for (size_t i = 0; i < oldClauses.size(); ++i) {
Clause cl = oldClauses[i];
for (size_t j = 0; j < cl.size(); ++j) {
cl[j] = normalize(cl[j]);
}
cnf.addClause(cl);
}
for (size_t i = 0; i < cnf.interfaceVariables.size(); ++i) {
InterfaceVariable& iv = cnf.interfaceVariables[i];
for (size_t j = 0; j < iv.second.size(); ++j) {
Lit oldLit = iv.second[j];
Lit newLit = normalize(oldLit);
iv.second[j] = newLit;
}
}
if (equivalences.empty()) break; // No changes
++count;
}
cnf.unparse(stdout);
return 0;
}