home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / test / regression / rotcopy1.cpp < prev    next >
C/C++ Source or Header  |  2000-12-07  |  927b  |  41 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 rotcopy1_test main
  14. #endif
  15.  
  16. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  17. using namespace std;
  18. #endif
  19. int rotcopy1_test(int, char**)
  20. {
  21.   cout<<"Results of rotcopy1_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.   vector <int> v2(v1.size());
  28.   for(int i = 0; i < v1.size(); i++)
  29.   {
  30.     rotate_copy(v1.begin(),
  31.                  v1.begin() + i,
  32.                  v1.end(),
  33.                  v2.begin());
  34.     ostream_iterator <int> iter(cout, " ");
  35.     copy(v2.begin(), v2.end(), iter);
  36.     cout << endl;
  37.   }
  38.   cout << endl;
  39.   return 0;
  40. }
  41.