Mega Code Archive

 
Categories / C++ Tutorial / Set Multiset
 

Equal_range

#include <iostream> #include <set> #include <algorithm> using namespace std; int main() {    const int SIZE = 10;    int a[ SIZE ] = { 7, 22, 9, 1, 18, 30, 100, 22, 85, 13 };    typedef multiset< int, less< int > > ims;    ims intMultiset;    // ims for "integer multiset"    pair< ims::const_iterator, ims::const_iterator > p;    p = intMultiset.equal_range( 22 );    cout << "\nUsing equal_range of 22"         << "\n   Lower bound: " << *( p.first )         << "\n   Upper bound: " << *( p.second );    cout << endl;    return 0; }