bool is_subset_of()

in include/FlatSet.h [73:89]


  bool is_subset_of(const FlatSet& other) const {
    // This is optimized for `this.size() << other.size()`.
    auto it = m_vector.begin(), end = m_vector.end();
    auto other_it = other.m_vector.begin(), other_end = other.m_vector.end();
    while (it != end) {
      if (std::distance(it, end) > std::distance(other_it, other_end)) {
        return false;
      }
      other_it = std::lower_bound(other_it, other_end, *it, Compare());
      if (other_it == other_end || !Equal()(*it, *other_it)) {
        return false;
      }
      ++it;
      ++other_it;
    }
    return true;
  }