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 // template <class Alloc>
13 // struct allocator_traits
15 // static size_type max_size(const allocator_type& a) noexcept;
21 #include <type_traits>
24 #include "test_macros.h"
38 size_t max_size() const
46 #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
49 assert(std::allocator_traits<A<int> >::max_size(a) ==
50 std::numeric_limits<std::size_t>::max() / sizeof(int));
54 assert(std::allocator_traits<A<int> >::max_size(a) ==
55 std::numeric_limits<std::size_t>::max() / sizeof(int));
57 #endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
60 assert(std::allocator_traits<B<int> >::max_size(b) == 100);
64 assert(std::allocator_traits<B<int> >::max_size(b) == 100);
66 #if TEST_STD_VER >= 11
68 std::allocator<int> a;
69 static_assert(noexcept(std::allocator_traits<std::allocator<int>>::max_size(a)) == true, "");