stdcpp/tsrc/Stdcpp_test/stlport/auto/stlport_hset/src/hset2.cpp
changeset 0 e4d67989cc36
child 18 47c74d1534e1
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 
       
     2 // STLport regression testsuite component.
       
     3 // To compile as a separate example, please #define MAIN.
       
     4 
       
     5 #include <iostream>
       
     6 #include <algorithm>
       
     7 #include <hash_set>
       
     8 
       
     9 #ifdef MAIN 
       
    10 #define hset2_test main
       
    11 #endif
       
    12 
       
    13 #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
       
    14 using namespace std;
       
    15 #endif
       
    16 
       
    17 // __STL_TYPE_TRAITS_POD_SPECIALIZE(_Hashtable_node<int>*);
       
    18 
       
    19 int hset2_test(int, char**)
       
    20 {
       
    21   cout<<"Results of hset2_test:"<<endl;
       
    22   hash_set<int, hash<int>, equal_to<int> > s;
       
    23   int failures = 0;
       
    24   pair<std::hash_set<int, hash<int>, equal_to<int> >::const_iterator, bool> p = s.insert(42);
       
    25   if(p.second)
       
    26   {
       
    27   	   cout << "Inserted new element " << *(p.first) << endl;
       
    28   	   
       
    29   }
       
    30   else
       
    31   {
       
    32   	   cout << "Existing element = " << *(p.first) << endl;
       
    33   		failures++;
       
    34   }
       
    35   p = s.insert(42);
       
    36   if(p.second)
       
    37   {
       
    38     cout << "Inserted new element " << *(p.first) << endl;
       
    39   	   failures++;
       
    40   }
       
    41   else
       
    42   {
       
    43   	   cout << "Existing element = " << *(p.first) << endl;
       
    44   }
       
    45   return failures;
       
    46 }