Skip to content

Instantly share code, notes, and snippets.

@iamben
Created July 28, 2009 08:43
Show Gist options
  • Save iamben/157021 to your computer and use it in GitHub Desktop.
Save iamben/157021 to your computer and use it in GitHub Desktop.
ker
#include <iostream>
#include <algorithm>
#include <iterator>
#include <set>
using namespace std;
int main ()
{
int a[] = { 1 , 2 , 3 , 5 };
int b[] = { 2 , 3 , 4 };
set<int> out;
set<int> first( a , a + 4 );
set<int> second( b , b + 3 );
set_difference( first.begin() , first.end() ,
second.begin() , second.end() ,
inserter( out , out.begin() )
);
//output
copy( out.begin() , out.end() , ostream_iterator<int>( cout , " " ) );
cout << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment