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

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