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_set 15 16 // size_type bucket_count() const; 17 18 #include <unordered_set> 19 #include <cassert> 20 21 #include "min_allocator.h" 22 23 int main() 24 { 25 { 26 typedef std::unordered_set<int> C; 27 typedef C::const_iterator I; 28 typedef int P; 29 const C c; 30 assert(c.bucket_count() == 0); 31 } 32 { 33 typedef std::unordered_set<int> C; 34 typedef C::const_iterator I; 35 typedef int P; 36 P a[] = 37 { 38 P(10), 39 P(20), 40 P(30), 41 P(40), 42 P(50), 43 P(60), 44 P(70), 45 P(80) 46 }; 47 const C c(std::begin(a), std::end(a)); 48 assert(c.bucket_count() >= 11); 49 } 50 #if __cplusplus >= 201103L 51 { 52 typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C; 53 typedef C::const_iterator I; 54 typedef int P; 55 const C c; 56 assert(c.bucket_count() == 0); 57 } 58 { 59 typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C; 60 typedef C::const_iterator I; 61 typedef int P; 62 P a[] = 63 { 64 P(10), 65 P(20), 66 P(30), 67 P(40), 68 P(50), 69 P(60), 70 P(70), 71 P(80) 72 }; 73 const C c(std::begin(a), std::end(a)); 74 assert(c.bucket_count() >= 11); 75 } 76 #endif 77 } 78