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>
36 size_t max_size() const
44 #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
47 assert(std::allocator_traits<A<int> >::max_size(a) ==
48 std::numeric_limits<std::size_t>::max());
52 assert(std::allocator_traits<A<int> >::max_size(a) ==
53 std::numeric_limits<std::size_t>::max());
55 #endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
58 assert(std::allocator_traits<B<int> >::max_size(b) == 100);
62 assert(std::allocator_traits<B<int> >::max_size(b) == 100);
64 #if __cplusplus >= 201103
66 std::allocator<int> a;
67 static_assert(noexcept(std::allocator_traits<std::allocator<int>>::max_size(a)) == true, "");