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 // template <class InputIterator>
     17 //     void insert(InputIterator first, InputIterator last);
     18 
     19 #include <unordered_set>
     20 #include <cassert>
     21 
     22 #include "test_iterators.h"
     23 
     24 int main()
     25 {
     26     {
     27         typedef std::unordered_set<int> C;
     28         typedef int P;
     29         P a[] =
     30         {
     31             P(1),
     32             P(2),
     33             P(3),
     34             P(4),
     35             P(1),
     36             P(2)
     37         };
     38         C c;
     39         c.insert(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
     40         assert(c.size() == 4);
     41         assert(c.count(1) == 1);
     42         assert(c.count(2) == 1);
     43         assert(c.count(3) == 1);
     44         assert(c.count(4) == 1);
     45     }
     46 }
     47