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

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