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       begin()        {return __table_.begin();}
17 // iterator       end()          {return __table_.end();}
18 // const_iterator begin()  const {return __table_.begin();}
19 // const_iterator end()    const {return __table_.end();}
20 // const_iterator cbegin() const {return __table_.begin();}
21 // const_iterator cend()   const {return __table_.end();}
22 
23 #include <unordered_set>
24 #include <cassert>
25 
main()26 int main()
27 {
28     {
29         typedef std::unordered_multiset<int> C;
30         typedef int P;
31         P a[] =
32         {
33             P(1),
34             P(2),
35             P(3),
36             P(4),
37             P(1),
38             P(2)
39         };
40         C c(a, a + sizeof(a)/sizeof(a[0]));
41         assert(c.bucket_count() == 7);
42         assert(c.size() == 6);
43         assert(std::distance(c.begin(), c.end()) == c.size());
44         assert(std::distance(c.cbegin(), c.cend()) == c.size());
45         C::iterator i = c.begin();
46         assert(*i == 1);
47         *i = 2;
48     }
49     {
50         typedef std::unordered_multiset<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         const C c(a, a + sizeof(a)/sizeof(a[0]));
62         assert(c.bucket_count() == 7);
63         assert(c.size() == 6);
64         assert(std::distance(c.begin(), c.end()) == c.size());
65         assert(std::distance(c.cbegin(), c.cend()) == c.size());
66     }
67 }
68