1/*
2Copyright 2020 Glen Joseph Fernandes
3(glenjofe@gmail.com)
4
5Distributed 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
12template<class T>
13struct A1 {
14 typedef T value_type;
15 typedef short size_type;
16 A1() { }
17 short max_size() const {
18 return 1;
19 }
20};
21
22template<class T>
23struct A2 {
24 typedef T value_type;
25 typedef short size_type;
26 A2() { }
27};
28
29int 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

source code of boost/libs/core/test/allocator_max_size_test.cpp