I'm trying intersect two STL sets but I can't achieve it.
In the next code I show how I'm trying it, I want the intersection of set1 and set2. How can get it in another set(set3 in code)?
Any example will be highly-regarded!
I have tried other examples, for example http://www.sgi.com/tech/stl/set.html or http://www.sgi.com/tech/stl/set_intersection.html
Neither the next code nor the two examples above compile with my compiler (Dev-C++).
Thanks!
Code: Select all
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>
#include <cassert>
#include <list>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
int main ()
{
set<int> set1, set2, set3;
set_intersection(set1.begin(), set1.end(), set2.begin(), set2.end(), set3.begin());
}