Esempio n. 1
0
void DataFlowUtil::setIntersect(Assignments& dest, const Assignments& src) {
  Assignments result;
  for (Assignments::const_iterator i = src.begin(); i != src.end(); ++i) {
    const Assignment& test = *i;
    if (src.count(test) > 0 && dest.count(test) > 0) {
      result.insert(test);
    }
  }
  // rewrite the destination
  dest = result;
}
Esempio n. 2
0
//
// Determine if 2 sets contain the same elements.
//
bool DataFlowUtil::setEquals(const Assignments& a, const Assignments& b) {
  // make sure sets are the same length
  if (a.size() != b.size()) {
    return false;
  }

  // ensure they contain the same elements
  for (Assignments::const_iterator i = a.begin(); i != a.end(); ++i) {
    const Assignment& test = *i;
    if (b.count(test) < 1) {
      return false;
    }
  }
  return true;
}