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

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