| 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; |
| 16 | A1() { } |
| 17 | short max_size() const { |
| 18 | return 1; |
| 19 | } |
| 20 | }; |
| 21 | |
| 22 | template<class T> |
| 23 | struct A2 { |
| 24 | typedef T value_type; |
| 25 | typedef short size_type; |
| 26 | A2() { } |
| 27 | }; |
| 28 | |
| 29 | int main() |
| 30 | { |
| 31 | BOOST_TEST_EQ(boost::allocator_max_size(A1<int>()), 1); |
| 32 | BOOST_TEST_LE(boost::allocator_max_size(A2<int>()), |
| 33 | (std::numeric_limits<short>::max)()); |
| 34 | return boost::report_errors(); |
| 35 | } |
| 36 |
