std::set<FormId> Plugin::OverlapFormIDs(const Plugin& plugin) const { set<FormId> formIds(getFormIds()); set<FormId> otherFormIds(plugin.getFormIds()); set<FormId> overlap; set_intersection(begin(formIds), end(formIds), begin(otherFormIds), end(otherFormIds), inserter(overlap, end(overlap))); return overlap; }
bool Plugin::DoFormIDsOverlap(const Plugin& plugin) const { //Basically std::set_intersection except with an early exit instead of an append to results. set<FormId> formIds(getFormIds()); set<FormId> otherFormIds(plugin.getFormIds()); auto i = begin(formIds); auto j = begin(otherFormIds); auto iend = end(formIds); auto jend = end(otherFormIds); while (i != iend && j != jend) { if (*i < *j) ++i; else if (*j < *i) ++j; else return true; } return false; }