1 /* 2 Copyright 2020 Glen Joseph Fernandes 3 (glenjofe@gmail.com) 4 5 Distributed under the Boost Software License, Version 1.0. 6 (http://www.boost.org/LICENSE_1_0.txt) 7 */ 8 #include <boost/core/allocator_access.hpp> 9 #include <boost/core/lightweight_test.hpp> 10 #include <limits> 11 12 template<class T> 13 struct A1 { 14 typedef T value_type; 15 typedef short size_type; A1A116 A1() { } max_sizeA117 short max_size() const { 18 return 1; 19 } 20 }; 21 22 #if !defined(BOOST_NO_CXX11_ALLOCATOR) 23 template<class T> 24 struct A2 { 25 typedef T value_type; 26 typedef short size_type; A2A227 A2() { } 28 }; 29 #endif 30 main()31int main() 32 { 33 BOOST_TEST_EQ(boost::allocator_max_size(A1<int>()), 1); 34 #if !defined(BOOST_NO_CXX11_ALLOCATOR) 35 BOOST_TEST_LE(boost::allocator_max_size(A2<int>()), 36 (std::numeric_limits<short>::max)()); 37 #endif 38 return boost::report_errors(); 39 } 40