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 //===----------------------------------------------------------------------===//
14 // size_type max_size() const;
19 #include <type_traits>
21 #include "test_allocator.h"
22 #include "test_macros.h"
27 typedef limited_allocator<int, 10> A;
28 typedef std::set<int, std::less<int>, A> C;
30 assert(c.max_size() <= 10);
31 LIBCPP_ASSERT(c.max_size() == 10);
34 typedef limited_allocator<int, (size_t)-1> A;
35 typedef std::set<int, std::less<int>, A> C;
36 const C::difference_type max_dist =
37 std::numeric_limits<C::difference_type>::max();
39 assert(c.max_size() <= max_dist);
40 LIBCPP_ASSERT(c.max_size() == max_dist);
43 typedef std::set<char> C;
44 const C::difference_type max_dist =
45 std::numeric_limits<C::difference_type>::max();
47 assert(c.max_size() <= max_dist);
48 assert(c.max_size() <= alloc_max_size(c.get_allocator()));