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
11template<class T>
12struct A1 {
13 typedef T value_type;
14 int value;
15};
16
17template<class T>
18struct A2 {
19 typedef T value_type;
20};
21
22template<class T>
23struct A3 {
24 typedef T value_type;
25 struct is_always_equal {
26 static const bool value = false;
27 };
28};
29
30template<class T>
31struct A4 {
32 typedef T value_type;
33 struct is_always_equal {
34 static const bool value = true;
35 };
36 int value;
37};
38
39int main()
40{
41 BOOST_TEST_TRAIT_FALSE((boost::allocator_is_always_equal<A1<int> >::type));
42 BOOST_TEST_TRAIT_TRUE((boost::allocator_is_always_equal<A2<int> >::type));
43 BOOST_TEST_TRAIT_FALSE((boost::allocator_is_always_equal<A3<int> >::type));
44 BOOST_TEST_TRAIT_TRUE((boost::allocator_is_always_equal<A4<int> >::type));
45 return boost::report_errors();
46}
47

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