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 iter3_test main
|
|
11 |
#endif
|
|
12 |
|
|
13 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
14 |
using namespace std;
|
|
15 |
#endif
|
|
16 |
|
|
17 |
int iter3_test(int, char**)
|
|
18 |
{
|
|
19 |
cout<<"Results of iter3_test:"<<endl;
|
|
20 |
typedef vector<const char*> Vec;
|
|
21 |
const char* array[2];
|
|
22 |
int j =0 ;
|
|
23 |
int failures = 0;
|
|
24 |
Vec v; // Vector of character strings.
|
|
25 |
v.push_back((char*) "zippy"); // First element.
|
|
26 |
v.push_back((char*) "motorboy"); // Second element.
|
|
27 |
Vec::reverse_iterator it;
|
|
28 |
for(it = v.rbegin(); it != v.rend(); it++)
|
|
29 |
{
|
|
30 |
cout << *it << endl; // Display item.
|
|
31 |
array[j++] = *it;
|
|
32 |
}
|
|
33 |
|
|
34 |
|
|
35 |
if(array[0] != "motorboy")
|
|
36 |
failures++;
|
|
37 |
if(array[1] != "zippy")
|
|
38 |
failures++;
|
|
39 |
|
|
40 |
return failures;
|
|
41 |
}
|