Standard C++ Library Class Reference
 //
 // Try equal_range variants 
 //
 pair<iterator,iterator> p1 = 
 equal_range(v1.begin(),v1.end(),3);
 // p1 = (v1.begin() + 4,v1.begin() + 5)
 pair<iterator,iterator> p2 = 
 equal_range(v1.begin(),v1.end(),2,less<int>()); 
 // p2 = (v1.begin() + 4,v1.begin() + 5) 
 // Output results
 cout << endl << "The equal range for 3 is: "
 << "( " << *p1.first << " , " 
 << *p1.second << " ) " << endl << endl;
 cout << endl << "The equal range for 2 is: "
 << "( " << *p2.first << " , " 
 << *p2.second << " ) " << endl; 
 return 0;
 }
Output :
The equal range for 3 is: ( 3 , 4 )
The equal range for 2 is: ( 2 , 3 )
Warnings
If your compiler does not support default template parameters then you need to always supply
the Allocator template argument. For instance you'll have to write:
vector<int,allocator>
instead of:
vector<int>
See Also
binary_function, lower_bound, upper_bound










