Home | History | Annotate | Download | only in unord.set
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <unordered_set>
     11 
     12 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
     13 //           class Alloc = allocator<Value>>
     14 // class unordered_set
     15 
     16 // iterator insert(const_iterator p, const value_type& x);
     17 
     18 #include <unordered_set>
     19 #include <cassert>
     20 
     21 int main()
     22 {
     23     {
     24         typedef std::unordered_set<double> C;
     25         typedef C::iterator R;
     26         typedef C::value_type P;
     27         C c;
     28         C::const_iterator e = c.end();
     29         R r = c.insert(e, P(3.5));
     30         assert(c.size() == 1);
     31         assert(*r == 3.5);
     32 
     33         r = c.insert(e, P(3.5));
     34         assert(c.size() == 1);
     35         assert(*r == 3.5);
     36 
     37         r = c.insert(e, P(4.5));
     38         assert(c.size() == 2);
     39         assert(*r == 4.5);
     40 
     41         r = c.insert(e, P(5.5));
     42         assert(c.size() == 3);
     43         assert(*r == 5.5);
     44     }
     45 }
     46