home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl453up.zip / stl453fx / test / regression / rotate1.cpp < prev    next >
C/C++ Source or Header  |  2002-04-29  |  826b  |  37 lines

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3. #include <iterator>
  4.  
  5. #include <algorithm>
  6. #include <vector>
  7. #include <iostream>
  8. #include <iterator>
  9. // #include <functional>
  10. #include <numeric>
  11.  
  12. #ifdef MAIN 
  13. #define rotate1_test main
  14. #endif
  15.  
  16. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  17. using namespace std;
  18. #endif
  19. int rotate1_test(int, char**)
  20. {
  21.   cout<<"Results of rotate1_test:"<<endl;
  22.   vector <int> v1(10);
  23.   iota(v1.begin(), v1.end(), 0);
  24.   ostream_iterator <int> iter(cout, " ");
  25.   copy(v1.begin(), v1.end(), iter);
  26.   cout << endl;
  27.   for(int i = 0; i < v1.size(); i++)
  28.   {
  29.     rotate(v1.begin(), v1.begin() + i, v1.end());
  30.     ostream_iterator <int> iter(cout, " ");
  31.     copy(v1.begin(), v1.end(), iter);
  32.     cout << endl;
  33.   }
  34.   cout << endl;
  35.   return 0;
  36. }
  37.