blob: 7da57d622e9e76c479bcb9ad3f83218393530cc7 [file] [log] [blame]
/*
Copyright 2020 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/core/allocator_access.hpp>
#include <boost/core/lightweight_test.hpp>
#include <limits>
template<class T>
struct A1 {
typedef T value_type;
typedef short size_type;
A1() { }
short max_size() const {
return 1;
}
};
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
template<class T>
struct A2 {
typedef T value_type;
typedef short size_type;
A2() { }
};
#endif
int main()
{
BOOST_TEST_EQ(boost::allocator_max_size(A1<int>()), 1);
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
BOOST_TEST_LE(boost::allocator_max_size(A2<int>()),
(std::numeric_limits<short>::max)());
#endif
return boost::report_errors();
}