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_multiset
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 #include "min_allocator.h"
24
main()25 int main()
26 {
27 {
28 typedef std::unordered_multiset<int> C;
29 typedef int P;
30 P a[] =
31 {
32 P(1),
33 P(2),
34 P(3),
35 P(4),
36 P(1),
37 P(2)
38 };
39 C c;
40 c.insert(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
41 assert(c.size() == 6);
42 assert(c.count(1) == 2);
43 assert(c.count(2) == 2);
44 assert(c.count(3) == 1);
45 assert(c.count(4) == 1);
46 }
47 #if TEST_STD_VER >= 11
48 {
49 typedef std::unordered_multiset<int, std::hash<int>,
50 std::equal_to<int>, min_allocator<int>> C;
51 typedef int P;
52 P a[] =
53 {
54 P(1),
55 P(2),
56 P(3),
57 P(4),
58 P(1),
59 P(2)
60 };
61 C c;
62 c.insert(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
63 assert(c.size() == 6);
64 assert(c.count(1) == 2);
65 assert(c.count(2) == 2);
66 assert(c.count(3) == 1);
67 assert(c.count(4) == 1);
68 }
69 #endif
70 }
71