int AtomSet::operator< (const AtomSet& atomset2) const { if (this->size() < atomset2.size()) // < { return true; } else if (this->size() > atomset2.size()) // > { return false; } else // same size, they can still be < or >= { // find first mismatch std::pair<AtomSet::const_iterator, AtomSet::const_iterator> result; result = std::mismatch(this->begin(), this->end(), atomset2.begin()); // no mismatch: ==, otw. check if the found mismatch is < or >= return result.first == this->end() ? false : *result.first < *result.second; } }
bool AtomSet::operator== (const AtomSet& atomset2) const { return ((this->size() == atomset2.size()) && std::equal(this->begin(), this->end(), atomset2.begin())); }