Skip to content

Commit ca32200

Browse files
committed
Add IsSubset type function.
1 parent 8b01c00 commit ca32200

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src_comb/COMB_Vectors.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ bool IsSubset(std::vector<T> const &S1, std::vector<T> const &S2) {
6262
return true;
6363
}
6464

65+
template <typename T>
66+
bool IsSubsetUnorderedSet(std::unordered_set<T> const &S1, std::unordered_set<T> const &S2) {
67+
for (auto &eVal : S2) {
68+
if (S1.count(eVal) == 0) {
69+
return false;
70+
}
71+
}
72+
return true;
73+
}
74+
6575
// V1 and V2 should have no repetition
6676
template <typename T>
6777
bool IsEqualSet(std::vector<T> const &V1, std::vector<T> const &V2) {

0 commit comments

Comments
 (0)