It's pretty simple, I'd like to put the intersection of two sets into another set. The problem I have is with the output iterator. I don't know how to define one for std::set :/
Here is my code up to now :
Unfortunately the examples I found on my standard reference site all use the algorithms for C style arrays and the output iterator is always an ostream :/Code:#include <set> #include <map> #include <algorithm> using namespace std; int main() { set<long> Source, Target, Intersection Source.insert(10); Source.insert(20); Target.insert(5); Target.insert(10); set_intersection(Source.begin(), Source.end(), Target.begin(), Target.end(), ???); return 0; }




Reply With Quote