本文整理汇总了C++中QueryData::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryData::begin方法的具体用法?C++ QueryData::begin怎么用?C++ QueryData::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryData
的用法示例。
在下文中一共展示了QueryData::begin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: diff
DiffResults diff(const QueryData& old_, const QueryData& new_) {
DiffResults r;
QueryData overlap;
for (const auto& i : new_) {
auto item = std::find(old_.begin(), old_.end(), i);
if (item != old_.end()) {
overlap.push_back(i);
} else {
r.added.push_back(i);
}
}
std::multiset<Row> overlap_set(overlap.begin(), overlap.end());
std::multiset<Row> old_set(old_.begin(), old_.end());
std::set_difference(old_set.begin(),
old_set.end(),
overlap_set.begin(),
overlap_set.end(),
std::back_inserter(r.removed));
return r;
}
示例2: addUniqueRowToQueryData
bool addUniqueRowToQueryData(QueryData& q, const Row& r) {
if (std::find(q.begin(), q.end(), r) != q.end()) {
return false;
}
q.push_back(r);
return true;
}
示例3: pidsFromContext
QueryData pidsFromContext(const QueryContext& context, bool all) {
QueryData procs;
if (context.hasConstraint("pid", EQUALS)) {
context.forEachConstraint(
"pid", EQUALS, ([&procs](const std::string& expr) {
auto proc = SQL::selectAllFrom("processes", "pid", EQUALS, expr);
procs.insert(procs.end(), procs.begin(), procs.end());
}));
} else if (!all) {
procs = SQL::selectAllFrom(
"processes", "pid", EQUALS, std::to_string(platformGetPid()));
} else {
procs = SQL::selectAllFrom("processes");
}
return procs;
}