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 // iterator erase(const_iterator p)
17 
18 #include <unordered_set>
19 #include <cassert>
20 
21 #include "../../min_allocator.h"
22 
23 int main()
24 {
25     {
26         typedef std::unordered_multiset<int> C;
27         typedef int P;
28         P a[] =
29         {
30             P(1),
31             P(2),
32             P(3),
33             P(4),
34             P(1),
35             P(2)
36         };
37         C c(a, a + sizeof(a)/sizeof(a[0]));
38         C::const_iterator i = c.find(2);
39         C::iterator j = c.erase(i);
40         assert(c.size() == 5);
41         assert(c.count(1) == 2);
42         assert(c.count(2) == 1);
43         assert(c.count(3) == 1);
44         assert(c.count(4) == 1);
45     }
46 #if __cplusplus >= 201103L
47     {
48         typedef std::unordered_multiset<int, std::hash<int>,
49                                       std::equal_to<int>, min_allocator<int>> C;
50         typedef int P;
51         P a[] =
52         {
53             P(1),
54             P(2),
55             P(3),
56             P(4),
57             P(1),
58             P(2)
59         };
60         C c(a, a + sizeof(a)/sizeof(a[0]));
61         C::const_iterator i = c.find(2);
62         C::iterator j = c.erase(i);
63         assert(c.size() == 5);
64         assert(c.count(1) == 2);
65         assert(c.count(2) == 1);
66         assert(c.count(3) == 1);
67         assert(c.count(4) == 1);
68     }
69 #endif
70 }
71