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 // size_type max_size() const noexcept
17 #include <type_traits>
19 #include "test_allocator.h"
20 #include "test_macros.h"
24 typedef limited_allocator<int, 10> A;
25 typedef std::list<int, A> C;
27 assert(c.max_size() <= 10);
28 LIBCPP_ASSERT(c.max_size() == 10);
31 typedef limited_allocator<int, (size_t)-1> A;
32 typedef std::list<int, A> C;
33 const C::difference_type max_dist =
34 std::numeric_limits<C::difference_type>::max();
36 assert(c.max_size() <= max_dist);
37 LIBCPP_ASSERT(c.max_size() == max_dist);
40 typedef std::list<char> C;
41 const C::difference_type max_dist =
42 std::numeric_limits<C::difference_type>::max();
44 assert(c.max_size() <= max_dist);
45 assert(c.max_size() <= alloc_max_size(c.get_allocator()));