31
|
1 |
|
|
2 |
// STLport regression testsuite component.
|
|
3 |
// To compile as a separate example, please #define MAIN.
|
|
4 |
|
|
5 |
#include <iostream>
|
|
6 |
#include <slist>
|
|
7 |
#include <iterator>
|
|
8 |
|
|
9 |
#ifdef MAIN
|
|
10 |
#define slist1_test main
|
|
11 |
#endif
|
|
12 |
|
|
13 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
14 |
using namespace std;
|
|
15 |
#endif
|
|
16 |
|
|
17 |
int slist1_test(int, char**)
|
|
18 |
{
|
|
19 |
cout<<"Results of slist1_test:"<<endl;
|
|
20 |
char array [] = { 'x', 'l', 'x', 't', 's', 's' };
|
|
21 |
ostream_iterator<char> o(cout,"");
|
|
22 |
slist<char> str(array+0, array + 6);
|
|
23 |
std::slist<char>::iterator i;
|
|
24 |
cout << "original: ";
|
|
25 |
copy(str.begin(), str.end(),o);
|
|
26 |
cout << endl;
|
|
27 |
cout << "reversed: ";
|
|
28 |
str.reverse();
|
|
29 |
for(i = str.begin(); i != str.end(); i++)
|
|
30 |
cout << *i;
|
|
31 |
cout << endl;
|
|
32 |
cout << "removed: ";
|
|
33 |
str.remove('x');
|
|
34 |
for(i = str.begin(); i != str.end(); i++)
|
|
35 |
cout << *i;
|
|
36 |
cout << endl;
|
|
37 |
cout << "uniqued: ";
|
|
38 |
str.unique();
|
|
39 |
for(i = str.begin(); i != str.end(); i++)
|
|
40 |
cout << *i;
|
|
41 |
cout << endl;
|
|
42 |
cout << "sorted: ";
|
|
43 |
str.sort();
|
|
44 |
for(i = str.begin(); i != str.end(); i++)
|
|
45 |
cout << *i;
|
|
46 |
cout << endl;
|
|
47 |
return 0;
|
|
48 |
}
|