| 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_trait.hpp> |
| 10 | |
| 11 | template<class T> |
| 12 | struct A1 { |
| 13 | typedef T value_type; |
| 14 | int value; |
| 15 | }; |
| 16 | |
| 17 | template<class T> |
| 18 | struct A2 { |
| 19 | typedef T value_type; |
| 20 | }; |
| 21 | |
| 22 | template<class T> |
| 23 | struct A3 { |
| 24 | typedef T value_type; |
| 25 | struct is_always_equal { |
| 26 | static const bool value = false; |
| 27 | }; |
| 28 | }; |
| 29 | |
| 30 | template<class T> |
| 31 | struct A4 { |
| 32 | typedef T value_type; |
| 33 | struct is_always_equal { |
| 34 | static const bool value = true; |
| 35 | }; |
| 36 | int value; |
| 37 | }; |
| 38 | |
| 39 | int 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 |
