31
|
1 |
|
|
2 |
// STLport regression testsuite component.
|
|
3 |
// To compile as a separate example, please #define MAIN.
|
|
4 |
|
|
5 |
#include <algorithm>
|
|
6 |
#include <iostream>
|
|
7 |
|
|
8 |
#include "unary.h"
|
|
9 |
|
|
10 |
|
|
11 |
#ifdef MAIN
|
|
12 |
#define bcompos1_test main
|
|
13 |
#endif
|
|
14 |
|
|
15 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
16 |
using namespace std;
|
|
17 |
#endif
|
|
18 |
int bcompos1_test(int, char**)
|
|
19 |
{
|
|
20 |
|
|
21 |
cout<<"Results of bcompos1_test:"<<endl;
|
|
22 |
|
|
23 |
int array [6] = { -2, -1, 0, 1, 2, 3 };
|
|
24 |
|
|
25 |
binary_compose<logical_and<bool>, odd, positive> b =
|
|
26 |
binary_compose<logical_and<bool>, odd, positive>(logical_and<bool>(), odd(), positive());
|
|
27 |
int* p = find_if((int*)array, (int*)array + 6, b);
|
|
28 |
if(p != array + 6)
|
|
29 |
cout << *p << " is odd and positive" << endl;
|
|
30 |
|
|
31 |
if (*p == 1)
|
|
32 |
return 0;
|
|
33 |
else
|
|
34 |
return 1;
|
|
35 |
}
|