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_map> 11 12 // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, 13 // class Alloc = allocator<pair<const Key, T>>> 14 // class unordered_map 15 16 // float max_load_factor() const; 17 // void max_load_factor(float mlf); 18 19 #include <unordered_map> 20 #include <string> 21 #include <cassert> 22 23 #include "../../min_allocator.h" 24 25 int main() 26 { 27 { 28 typedef std::unordered_map<int, std::string> C; 29 typedef std::pair<int, std::string> P; 30 const C c; 31 assert(c.max_load_factor() == 1); 32 } 33 { 34 typedef std::unordered_map<int, std::string> C; 35 typedef std::pair<int, std::string> P; 36 C c; 37 assert(c.max_load_factor() == 1); 38 c.max_load_factor(2.5); 39 assert(c.max_load_factor() == 2.5); 40 } 41 #if __cplusplus >= 201103L 42 { 43 typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, 44 min_allocator<std::pair<const int, std::string>>> C; 45 typedef std::pair<int, std::string> P; 46 const C c; 47 assert(c.max_load_factor() == 1); 48 } 49 { 50 typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, 51 min_allocator<std::pair<const int, std::string>>> C; 52 typedef std::pair<int, std::string> P; 53 C c; 54 assert(c.max_load_factor() == 1); 55 c.max_load_factor(2.5); 56 assert(c.max_load_factor() == 2.5); 57 } 58 #endif 59 } 60