31
|
1 |
|
|
2 |
// STLport regression testsuite component.
|
|
3 |
// To compile as a separate example, please #define MAIN.
|
|
4 |
|
|
5 |
#include <iostream>
|
|
6 |
#include <set>
|
|
7 |
|
|
8 |
#ifdef MAIN
|
|
9 |
#define mset4_test main
|
|
10 |
#endif
|
|
11 |
|
|
12 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
13 |
using namespace std;
|
|
14 |
#endif
|
|
15 |
int mset4_test(int, char**)
|
|
16 |
{
|
|
17 |
cout<<"Results of mset4_test:"<<endl;
|
|
18 |
int array [] = { 3, 6, 1, 2, 3, 2, 6, 7, 9 };
|
|
19 |
int failures = 0;
|
|
20 |
typedef multiset<int, less<int> > mset;
|
|
21 |
mset s(array, array + 9);
|
|
22 |
pair<mset::const_iterator, mset::const_iterator> p = s.equal_range(3);
|
|
23 |
cout << "lower bound = " << *(p.first) << endl;
|
|
24 |
if (*(p.first) != 3)
|
|
25 |
failures++;
|
|
26 |
cout << "upper bound = " << *(p.second) << endl;
|
|
27 |
if (*(p.second) != 6)
|
|
28 |
failures++;
|
|
29 |
return failures;
|
|
30 |
}
|