41 typedef std::set<int, std::less<int>, std::allocator<int> >
Set;
42 typedef std::ostream_iterator<int, char, std::char_traits<char> > os_iter;
44 int a1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
45 int a2[] = { 2, 4, 6, 8, 10, 12 };
46 int a3[] = { 3, 5, 7, 8 };
51 Set other (a3, a3 +
sizeof a3 /
sizeof *a3);
54 std::cout <<
"The set: ";
55 std::copy (all.begin (), all.end (), os_iter (std::cout,
" "));
57 bool answer = std::includes (all.begin (), all.end (),
58 other.begin (), other.end ());
60 std::cout << std::endl << (answer ?
"INCLUDES " :
"DOES NOT INCLUDE ");
61 std::copy (other.begin (), other.end (), os_iter (std::cout,
" "));
63 answer = std::includes (all.begin (), all.end (),
64 even.begin (), even.end ());
66 std::cout <<
", and" << std::endl
67 << (answer ?
"INCLUDES" :
"DOES NOT INCLUDE ");
69 std::copy (even.begin (), even.end (), os_iter (std::cout,
" "));
71 std::cout << std::endl << std::endl;
std::set< double, std::less< double >, std::allocator< double > > Set