Standard C++ Library Class Reference
Complexity
At most ((last1 - first1) + (last2 - first2)) * 2 -1 comparisons are performed.
Example
//
// includes.cpp 
//
 #include <algorithm>
 #include <set>
 #include <iostream.h>
 int main()
 {
 //Initialize some sets
 int a1[10] = {1,2,3,4,5,6,7,8,9,10};
 int a2[6] = {2,4,6,8,10,12};
 int a3[4] = {3,5,7,8};
 set<int, less<int> > all(a1, a1+10), even(a2, a2+6), 
 small(a3,a3+4);
 //Demonstrate includes
 cout << "The set: ";
 copy(all.begin(),all.end(),
 ostream_iterator<int>(cout," "));
 bool answer = includes(all.begin(), all.end(), 
 small.begin(), small.end());
 cout << endl 
 << (answer ? "INCLUDES " : "DOES NOT INCLUDE ");
 copy(small.begin(),small.end(),
 ostream_iterator<int>(cout," "));
 answer = includes(all.begin(), all.end(), 
 even.begin(), even.end());
 cout << ", and" << endl 
 << (answer ? "INCLUDES" : "DOES NOT INCLUDE ");
 copy(even.begin(),even.end(),
 ostream_iterator<int>(cout," "));
 cout << endl << endl;
 return 0;
 }
Output :
The set: 1 2 3 4 5 6 7 8 9 10
INCLUDES 3 5 7 8 , and
DOES NOT INCLUDE 2 4 6 8 10 12










