void Options::OptionsSetUnion(const OptionSet &set_a, const OptionSet &set_b, OptionSet &union_set) { OptionSet::const_iterator pos; OptionSet::iterator pos_union; // Put all the elements of set_a into the union. for (pos = set_a.begin(); pos != set_a.end(); ++pos) union_set.insert(*pos); // Put all the elements of set_b that are not already there into the union. for (pos = set_b.begin(); pos != set_b.end(); ++pos) { pos_union = union_set.find(*pos); if (pos_union == union_set.end()) union_set.insert(*pos); } }
size_t Options::OptionsSetDiff(const OptionSet &set_a, const OptionSet &set_b, OptionSet &diffs) { size_t num_diffs = 0; OptionSet::const_iterator pos_a; OptionSet::const_iterator pos_b; for (pos_a = set_a.begin(); pos_a != set_a.end(); ++pos_a) { pos_b = set_b.find(*pos_a); if (pos_b == set_b.end()) { ++num_diffs; diffs.insert(*pos_a); } } return num_diffs; }