31
|
1 |
|
|
2 |
// STLport regression testsuite component.
|
|
3 |
// To compile as a separate example, please #define MAIN.
|
|
4 |
|
|
5 |
#include <iostream>
|
|
6 |
#include <vector>
|
|
7 |
#include <algorithm>
|
|
8 |
|
|
9 |
#ifdef MAIN
|
|
10 |
#define func1_test main
|
|
11 |
#endif
|
|
12 |
|
|
13 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
14 |
using namespace std;
|
|
15 |
#endif
|
|
16 |
static bool bigger(int i_)
|
|
17 |
{
|
|
18 |
return i_ > 3;
|
|
19 |
}
|
|
20 |
int func1_test(int, char**)
|
|
21 |
{
|
|
22 |
cout<<"Results of func1_test:"<<endl;
|
|
23 |
|
|
24 |
vector<int>v;
|
|
25 |
v.push_back(4);
|
|
26 |
v.push_back(1);
|
|
27 |
v.push_back(5);
|
|
28 |
int n = 0;
|
|
29 |
count_if(v.begin(), v.end(), bigger, n);
|
|
30 |
cout << "Number greater than 3 = " << n << endl;
|
|
31 |
|
|
32 |
if(n == 2)
|
|
33 |
return 0;
|
|
34 |
else
|
|
35 |
return 1;
|
|
36 |
}
|