31
|
1 |
|
|
2 |
// STLport regression testsuite component.
|
|
3 |
// To compile as a separate example, please #define MAIN.
|
|
4 |
|
|
5 |
#include <algorithm>
|
|
6 |
#include <vector>
|
|
7 |
#include <iostream>
|
|
8 |
|
|
9 |
#ifdef MAIN
|
|
10 |
#define lwrbnd1_test main
|
|
11 |
#endif
|
|
12 |
|
|
13 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
14 |
using namespace std;
|
|
15 |
#endif
|
|
16 |
int lwrbnd1_test(int, char**)
|
|
17 |
{
|
|
18 |
cout<<"Results of lwrbnd1_test:"<<endl;
|
|
19 |
std::vector <int> v1(20);
|
|
20 |
for(int i = 0; i < v1.size(); i++)
|
|
21 |
{
|
|
22 |
v1[i] = i/4;
|
|
23 |
cout << v1[i] << ' ';
|
|
24 |
}
|
|
25 |
std::vector <int>::iterator location = lower_bound(v1.begin(), v1.end(), 3);
|
|
26 |
cout
|
|
27 |
<< "\n3 can be inserted at index: "
|
|
28 |
<<(location - v1.begin())
|
|
29 |
<< endl;
|
|
30 |
if ((location - v1.begin()) == 12)
|
|
31 |
return 0;
|
|
32 |
else
|
|
33 |
return 1;
|
|
34 |
}
|