Lines Matching defs:S1
43 template <class S1Ty, class S2Ty> bool set_union(S1Ty &S1, const S2Ty &S2) {
47 if (S1.insert(E).second)
55 /// is nicer to use. Functionally, this iterates through S1, removing
58 template <class S1Ty, class S2Ty> void set_intersect(S1Ty &S1, const S2Ty &S2) {
61 S1.remove_if(Pred);
64 for (typename S1Ty::iterator I = S1.begin(); I != S1.end(); I = Next) {
67 S1.erase(I); // Erase element if not in S2
73 S1Ty set_intersection_impl(const S1Ty &S1, const S2Ty &S2) {
75 for (const auto &E : S1)
83 S1Ty set_intersection(const S1Ty &S1, const S2Ty &S2) {
84 if (S1.size() < S2.size())
85 return set_intersection_impl(S1, S2);
87 return set_intersection_impl(S2, S1);
93 S1Ty set_difference(const S1Ty &S1, const S2Ty &S2) {
95 for (const auto &E : S1)
106 template <class S1Ty, class S2Ty> void set_subtract(S1Ty &S1, const S2Ty &S2) {
107 // If S1 is smaller than S2, iterate on S1 provided that S2 supports efficient
110 using ElemTy = decltype(*S1.begin());
114 if (S1.size() < S2.size()) {
115 S1.remove_if(Pred);
119 if (S1.size() < S2.size()) {
121 for (typename S1Ty::iterator SI = S1.begin(), SE = S1.end(); SI != SE;
125 S1.erase(SI);
133 S1.erase(E);
140 void set_subtract(S1Ty &S1, const S2Ty &S2, S1Ty &Removed, S1Ty &Remaining) {
142 if (S1.erase(E))
151 bool set_is_subset(const S1Ty &S1, const S2Ty &S2) {
152 if (S1.size() > S2.size())
154 for (const auto It : S1)