home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl453up.zip / stl453fx / test / regression / hset2.cpp < prev    next >
C/C++ Source or Header  |  2002-04-29  |  871b  |  34 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 <hash_set>
  7.  
  8. #ifdef MAIN 
  9. #define hset2_test main
  10. #endif
  11.  
  12. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  13. using namespace std;
  14. #endif
  15.  
  16. // __STL_TYPE_TRAITS_POD_SPECIALIZE(_Hashtable_node<int>*);
  17.  
  18. int hset2_test(int, char**)
  19. {
  20.   cout<<"Results of hset2_test:"<<endl;
  21.   hash_set<int, hash<int>, equal_to<int> > s;
  22.   pair<std::hash_set<int, hash<int>, equal_to<int> >::const_iterator, bool> p = s.insert(42);
  23.   if(p.second)
  24.    cout << "Inserted new element " << *(p.first) << endl;
  25.   else
  26.    cout << "Existing element = " << *(p.first) << endl;
  27.   p = s.insert(42);
  28.   if(p.second)
  29.    cout << "Inserted new element " << *(p.first) << endl;
  30.   else
  31.    cout << "Existing element = " << *(p.first) << endl;
  32.   return 0;
  33. }
  34.