Standard C++ Library Class Reference
  // Try upper_bound variants
 iterator it3 = upper_bound(v1.begin(),v1.end(),3);
 // it3 = vector + 5 
 iterator it4 = 
 upper_bound(v1.begin(),v1.end(),2,less<int>());
 // it4 = v1.begin() + 5 
 cout << endl << endl
 << "The upper and lower bounds of 3: ( "
 << *it1 << " , " << *it3 << " ]" << endl;
 cout << endl << endl
 << "The upper and lower bounds of 2: ( "
 << *it2 << " , " << *it4 << " ]" << endl;
 return 0;
 }
Output :
The upper and lower bounds of 3: ( 3 , 4 ]
The upper and lower bounds of 2: ( 2 , 3 ]
Warning
If your compiler does not support default template parameters, then you need to always supply
the Allocator template argument. For instance, you will need to write :
vector<int, allocator>
instead of :
vector<int>
See Also
lower_bound, equal_range










