#include #include #include #include int the_alphas[] = { 9, 4, 3, 2, 22, 13, 7, 140, 95, 278 }; int the_betas[] = { 8, 3, 4, 1, 278, 94, 15, 7, 19, 200 }; const int the_alphas_size = sizeof(the_alphas) / sizeof(the_alphas[0]); const int the_betas_size = sizeof(the_betas) / sizeof(the_betas[0]); int main(int argc, char** argv) { std::set alphas(the_alphas, the_alphas + the_alphas_size); std::set betas(the_betas, the_betas + the_betas_size); std::set results; std::set_intersection(alphas.begin(), alphas.end(), betas.begin(), betas.end(), std::inserter(results, results.begin())); std::cout << "set_intersection: "; std::copy(results.begin(), results.end(), std::ostream_iterator(std::cout, " ")); std::cout << std::endl; return 0; }