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/is_same.hpp> 10 #include <boost/core/lightweight_test_trait.hpp> 11 12 template<class T> 13 struct A1 { 14 typedef T value_type; 15 int value; 16 }; 17 18 #if !defined(BOOST_NO_CXX11_ALLOCATOR) 19 template<class T> 20 struct A2 { 21 typedef T value_type; 22 }; 23 24 template<class T> 25 struct A3 { 26 typedef T value_type; 27 typedef std::false_type is_always_equal; 28 }; 29 30 template<class T> 31 struct A4 { 32 typedef T value_type; 33 typedef std::true_type is_always_equal; 34 int value; 35 }; 36 #endif 37 main()38int main() 39 { 40 BOOST_TEST_TRAIT_FALSE((boost::allocator_is_always_equal<A1<int> >::type)); 41 #if !defined(BOOST_NO_CXX11_ALLOCATOR) 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 #endif 46 return boost::report_errors(); 47 } 48