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
26 #include "test_macros.h"
27
main()28 int main()
29 {
30 {
31 typedef std::unordered_multiset<int> C;
32 typedef int P;
33 P a[] =
34 {
35 P(1),
36 P(2),
37 P(3),
38 P(4),
39 P(1),
40 P(2)
41 };
42 C c(a, a + sizeof(a)/sizeof(a[0]));
43 LIBCPP_ASSERT(c.bucket_count() == 7);
44 assert(c.size() == 6);
45 assert(std::distance(c.begin(), c.end()) == c.size());
46 assert(std::distance(c.cbegin(), c.cend()) == c.size());
47 C::iterator i = c.begin();
48 assert(*i == 1);
49 *i = 2;
50 }
51 {
52 typedef std::unordered_multiset<int> C;
53 typedef int P;
54 P a[] =
55 {
56 P(1),
57 P(2),
58 P(3),
59 P(4),
60 P(1),
61 P(2)
62 };
63 const C c(a, a + sizeof(a)/sizeof(a[0]));
64 LIBCPP_ASSERT(c.bucket_count() == 7);
65 assert(c.size() == 6);
66 assert(std::distance(c.begin(), c.end()) == c.size());
67 assert(std::distance(c.cbegin(), c.cend()) == c.size());
68 }
69 }
70