#include <iostream> #include <algorithm> #include <set> #include <string> #include <vector> #include <utility> #include <cstdlib> #include <ctime> using namespace std; template<typename T> void _intersection(const set<T> &a,const set<T> &b,set<T>& res) { set_intersection(a.begin(), a.end(), b.begin(), b.end(), inserter(res, res.begin())); } template<typename T> void _union(const set<T> &a,const set<T> &b,set<T>& res) { set_union(a.begin(), a.end(), b.begin(), b.end(), inserter(res, res.begin())); } template<typename T> void _difference(const set<T> &a,const set<T> &b,set<T>& res) { set_difference(a.begin(), a.end(), b.begin(), b.end(), inserter(res, res.begin())); } template<typename T> void _symmetric_differencee(const set<T> &a,const set<T> &b,set<T>& res) { set_symmetric_difference(a.begin(), a.end(), b.begin(), b.end(), inserter(res, res.begin())); } template<typename T> void print(const set<T> &s) { for (auto &it:s) { cout<<it<<" "; } cout<<endl; } struct concept_table{ vector<pair<int,int>> item; int min_limit; int id; } bool find(const concept_table& tb,int val) { for (auto &it:tb ) { if (it.first==val) { return true; } } return false; } int main() { set<int> srcPart; set<int> dstPart; srcPart.insert(1); srcPart.insert(2); srcPart.insert(3); srcPart.insert(4); srcPart.insert(5); dstPart.insert(3); dstPart.insert(4); dstPart.insert(5); dstPart.insert(6); dstPart.insert(7); set<int> intersection; set<int> convergence; set<int> diff1; set<int> diff2; set<int> diff3; //_intersection(srcPart,dstPart,intersection); _intersection(dstPart,srcPart,intersection); //_union(srcPart,dstPart,convergence); _union(dstPart,srcPart,convergence); _difference(srcPart,dstPart,diff1); _difference(dstPart,srcPart,diff2); _symmetric_differencee(dstPart,srcPart,diff3); print(intersection); print(convergence); print(diff1); print(diff2); print(diff3); set<string> t1; set<string> t2; set<string> t3; string str1; string str2; auto x=str1<str2; concept_table ct1; concept_table ct2; concept_table ct3; for (auto i = 0; i < 1000; i++) { int randomNum = rand() % 10 + 1; } _union(t1,t2,t3); return 0; }