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 // class unordered_multiset 13 14 // size_type max_size() const; 15 16 #include <cassert> 17 #include <limits> 18 #include <type_traits> 19 #include <unordered_set> 20 21 #include "test_allocator.h" 22 #include "test_macros.h" 23 24 int main() 25 { 26 { 27 typedef limited_allocator<int, 10> A; 28 typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, 29 A> 30 C; 31 C c; 32 assert(c.max_size() <= 10); 33 LIBCPP_ASSERT(c.max_size() == 10); 34 } 35 { 36 typedef limited_allocator<int, (size_t)-1> A; 37 typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, 38 A> 39 C; 40 const C::difference_type max_dist = 41 std::numeric_limits<C::difference_type>::max(); 42 C c; 43 assert(c.max_size() <= max_dist); 44 LIBCPP_ASSERT(c.max_size() == max_dist); 45 } 46 { 47 typedef std::unordered_multiset<char> C; 48 const C::difference_type max_dist = 49 std::numeric_limits<C::difference_type>::max(); 50 C c; 51 assert(c.max_size() <= max_dist); 52 assert(c.max_size() <= alloc_max_size(c.get_allocator())); 53 } 54 } 55