1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
13 // class Alloc = allocator<Value>>
14 // class unordered_set
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();}
23 #include <unordered_set>
26 #include "min_allocator.h"
31 typedef std::unordered_set<int> C;
42 C c(a, a + sizeof(a)/sizeof(a[0]));
43 assert(c.bucket_count() >= 5);
44 assert(c.size() == 4);
45 assert(std::distance(c.begin(), c.end()) == c.size());
46 assert(std::distance(c.cbegin(), c.cend()) == c.size());
50 typedef std::unordered_set<int> C;
61 const C c(a, a + sizeof(a)/sizeof(a[0]));
62 assert(c.bucket_count() >= 5);
63 assert(c.size() == 4);
64 assert(std::distance(c.begin(), c.end()) == c.size());
65 assert(std::distance(c.cbegin(), c.cend()) == c.size());
68 #if __cplusplus >= 201103L
70 typedef std::unordered_set<int, std::hash<int>,
71 std::equal_to<int>, min_allocator<int>> C;
82 C c(a, a + sizeof(a)/sizeof(a[0]));
83 assert(c.bucket_count() >= 5);
84 assert(c.size() == 4);
85 assert(std::distance(c.begin(), c.end()) == c.size());
86 assert(std::distance(c.cbegin(), c.cend()) == c.size());
90 typedef std::unordered_set<int, std::hash<int>,
91 std::equal_to<int>, min_allocator<int>> C;
102 const C c(a, a + sizeof(a)/sizeof(a[0]));
103 assert(c.bucket_count() >= 5);
104 assert(c.size() == 4);
105 assert(std::distance(c.begin(), c.end()) == c.size());
106 assert(std::distance(c.cbegin(), c.cend()) == c.size());
110 #if _LIBCPP_STD_VER > 11
112 typedef std::unordered_set<int> C;
113 C::iterator ii1{}, ii2{};
114 C::iterator ii4 = ii1;
115 C::const_iterator cii{};
116 assert ( ii1 == ii2 );
117 assert ( ii1 == ii4 );
118 assert ( ii1 == cii );
120 assert ( !(ii1 != ii2 ));
121 assert ( !(ii1 != cii ));