summaryrefslogtreecommitdiff
path: root/src/desktop/rule/utils/SetUtils.hpp
blob: 75fd47394891225cfa922ee5c7b61c6510b3dcba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#pragma once

#include <unordered_set>

namespace Desktop::Rule {
    template <class T>
    bool setsIntersect(const std::unordered_set<T>& A, const std::unordered_set<T>& B) {
        if (A.size() > B.size())
            return setsIntersect(B, A);

        for (const auto& e : A) {
            if (B.contains(e))
                return true;
        }
        return false;
    }
};