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

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <iostream>
  5. #include <set>
  6. #include <functional>
  7.  
  8. #ifdef MAIN 
  9. #define mset1_test main
  10. #endif
  11.  
  12. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  13. using namespace std;
  14. #endif
  15.  
  16. typedef multiset<int, less<int> > mset;
  17.  
  18. int mset1_test(int, char**)
  19. {
  20.   cout<<"Results of mset1_test:"<<endl;
  21.   mset s;
  22.   cout << "count(42) = " << s.count(42) << endl;
  23.   s.insert(42);
  24.   cout << "count(42) = " << s.count(42) << endl;
  25.   s.insert(42);
  26.   cout << "count(42) = " << s.count(42) << endl;
  27.   mset::iterator i = s.find(40);
  28.   if(i == s.end())
  29.     cout << "40 Not found" << endl;
  30.   else
  31.     cout << "Found " << *i << endl;
  32.   i = s.find(42);
  33.   if(i == s.end())
  34.     cout << "Not found" << endl;
  35.   else
  36.     cout << "Found " << *i << endl;
  37.   int count = s.erase(42);
  38.   cout << "Erased " << count << " instances" << endl;
  39.   return 0;
  40. }
  41.