---- main.cpp ----
#include <iostream>
#include <map>
int main()
{
using namespace std;
int a[] = { 1, 3, 5, 600, 600, 123, 145 };
int b[] = { 3, 3, 1, 600, 5000, 145 };
map<int, pair<bool, bool> > m;
for (int i = 0; i < sizeof(a) / sizeof(a[0]); ++i)
{
pair<bool, bool>& p = m[a[i]];
p.first = true;
}
for (int i = 0; i < sizeof(b) / sizeof(b[0]); ++i)
{
pair<bool, bool>& p = m[b[i]];
p.second = true;
}
for (map<int, pair<bool, bool> >::const_iterator cit = m.begin(); cit !=
m.end(); ++cit)
{
int key = cit->first;
pair<bool, bool> const& p = cit->second;
cout << key << " " << p.first << " " << p.second << endl;
}
return 0;
}
/* Output:
1 1 1
3 1 1
5 1 0
123 1 0
145 1 1
600 1 1
5000 0 1
thus:
1 is in a and b
3 is in a and b
5 is in a not b
....
5000 is not in a but in b
etc etc
*/
--------------------