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_trait.hpp>
10#include <boost/type_traits/is_same.hpp>
11#if !defined(BOOST_NO_CXX11_ALLOCATOR)
12#include <boost/type_traits/make_unsigned.hpp>
13#endif
14
15template<class T>
16struct A1 {
17 typedef T value_type;
18 typedef int size_type;
19};
20
21#if !defined(BOOST_NO_CXX11_ALLOCATOR)
22template<class T>
23struct A2 {
24 typedef T value_type;
25};
26#endif
27
28int main()
29{
30 BOOST_TEST_TRAIT_TRUE((boost::is_same<int,
31 boost::allocator_size_type<A1<char> >::type>));
32#if !defined(BOOST_NO_CXX11_ALLOCATOR)
33 BOOST_TEST_TRAIT_TRUE((boost::is_same<
34 boost::make_unsigned<std::ptrdiff_t>::type,
35 boost::allocator_size_type<A2<int> >::type>));
36#endif
37 return boost::report_errors();
38}
39

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