#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"
ims::const_iterator result = intMultiset.find( 15 ); // find returns iterator
if ( result != intMultiset.end() ) // if iterator not at end
cout << "Found value 15\n"; // found search value 15
result = intMultiset.find( 20 );
if ( result == intMultiset.end() ) // will be true hence
cout << "Did not find value 20\n"; // did not find 20
return 0;
}
|