home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / test / regression / list3.cpp < prev    next >
C/C++ Source or Header  |  2000-12-07  |  1KB  |  47 lines

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