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 Key, class Hash, class Pred, class Alloc>
13 // bool
14 // operator==(const unordered_multiset<Key, Hash, Pred, Alloc>& x,
15 // const unordered_multiset<Key, Hash, Pred, Alloc>& y);
16 //
17 // template <class Key, class Hash, class Pred, class Alloc>
18 // bool
19 // operator!=(const unordered_multiset<Key, Hash, Pred, Alloc>& x,
20 // const unordered_multiset<Key, Hash, Pred, Alloc>& y);
21
22 #include <unordered_set>
23 #include <cassert>
24
main()25 int main()
26 {
27 {
28 typedef std::unordered_multiset<int> C;
29 typedef int P;
30 P a[] =
31 {
32 P(10),
33 P(20),
34 P(20),
35 P(30),
36 P(40),
37 P(50),
38 P(50),
39 P(50),
40 P(60),
41 P(70),
42 P(80)
43 };
44 const C c1(std::begin(a), std::end(a));
45 const C c2;
46 assert(!(c1 == c2));
47 assert( (c1 != c2));
48 }
49 {
50 typedef std::unordered_multiset<int> C;
51 typedef int P;
52 P a[] =
53 {
54 P(10),
55 P(20),
56 P(20),
57 P(30),
58 P(40),
59 P(50),
60 P(50),
61 P(50),
62 P(60),
63 P(70),
64 P(80)
65 };
66 const C c1(std::begin(a), std::end(a));
67 const C c2 = c1;
68 assert( (c1 == c2));
69 assert(!(c1 != c2));
70 }
71 {
72 typedef std::unordered_multiset<int> C;
73 typedef int P;
74 P a[] =
75 {
76 P(10),
77 P(20),
78 P(20),
79 P(30),
80 P(40),
81 P(50),
82 P(50),
83 P(50),
84 P(60),
85 P(70),
86 P(80)
87 };
88 C c1(std::begin(a), std::end(a));
89 C c2 = c1;
90 c2.rehash(30);
91 assert( (c1 == c2));
92 assert(!(c1 != c2));
93 c2.insert(P(90));
94 assert(!(c1 == c2));
95 assert( (c1 != c2));
96 c1.insert(P(90));
97 assert( (c1 == c2));
98 assert(!(c1 != c2));
99 }
100 }
101