31
|
1 |
|
|
2 |
|
|
3 |
// STLport regression testsuite component.
|
|
4 |
// To compile as a separate example, please #define MAIN.
|
|
5 |
|
|
6 |
#include <iostream>
|
|
7 |
#include <vector>
|
|
8 |
#include <algorithm>
|
|
9 |
|
|
10 |
#ifdef MAIN
|
|
11 |
#define iter1_test main
|
|
12 |
#endif
|
|
13 |
|
|
14 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
15 |
using namespace std;
|
|
16 |
#endif
|
|
17 |
int iter1_test(int, char**)
|
|
18 |
{
|
|
19 |
cout<<"Results of iter1_test:"<<endl;
|
|
20 |
int failures = 0;
|
|
21 |
vector<const char*> v; // Vector of character strings.
|
|
22 |
const char* array[2];
|
|
23 |
int j =0 ;
|
|
24 |
v.push_back((char*) "zippy"); // First element.
|
|
25 |
v.push_back((char*) "motorboy"); // Second element.
|
|
26 |
typedef vector<const char*> vec;
|
|
27 |
vec::iterator i = v.begin(); // Position at end.
|
|
28 |
for(i = v.begin(); i != v.end(); i++)
|
|
29 |
{
|
|
30 |
cout << *i << endl; // Display item.
|
|
31 |
array[j++] = *i;
|
|
32 |
}
|
|
33 |
if(array[0] != "zippy")
|
|
34 |
failures++;
|
|
35 |
if(array[1] != "motorboy")
|
|
36 |
failures++;
|
|
37 |
|
|
38 |
return failures;
|
|
39 |
}
|