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

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <set>
  7.  
  8. #ifdef MAIN 
  9. #define set2_test main
  10. #endif
  11.  
  12. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  13. using namespace std;
  14. #endif
  15. int set2_test(int, char**)
  16. {
  17.   cout<<"Results of set2_test:"<<endl;
  18.   set<int, less<int> > s;
  19.   pair<std::set<int, less<int> >::const_iterator, bool> p = s.insert(42);
  20.   if(p.second)
  21.    cout << "Inserted new element " << *(p.first) << endl;
  22.   else
  23.    cout << "Existing element = " << *(p.first) << endl;
  24.   p = s.insert(42);
  25.   if(p.second)
  26.    cout << "Inserted new element " << *(p.first) << endl;
  27.   else
  28.    cout << "Existing element = " << *(p.first) << endl;
  29.   return 0;
  30. }
  31.