31
|
1 |
|
|
2 |
|
|
3 |
// STLport regression testsuite component.
|
|
4 |
// To compile as a separate example, please #define MAIN.
|
|
5 |
|
|
6 |
#include <algorithm>
|
|
7 |
#include <iostream>
|
|
8 |
|
|
9 |
#ifdef MAIN
|
|
10 |
#define find1_test main
|
|
11 |
#endif
|
|
12 |
|
|
13 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
14 |
using namespace std;
|
|
15 |
#endif
|
|
16 |
int find1_test(int, char**)
|
|
17 |
{
|
|
18 |
cout<<"Results of find1_test:"<<endl;
|
|
19 |
int years[] = { 1942, 1952, 1962, 1972, 1982, 1992 };
|
|
20 |
|
|
21 |
const unsigned yearCount = sizeof(years) / sizeof(years[0]);
|
|
22 |
int* location = find((int*)years, (int*)years + yearCount, 1972);
|
|
23 |
cout << "Found 1972 at offset " <<(location - years) << endl;
|
|
24 |
|
|
25 |
if((location - years) == 3)
|
|
26 |
return 0;
|
|
27 |
else
|
|
28 |
return 1;
|
|
29 |
|
|
30 |
}
|