| 1 | /* |
| 2 | Copyright 2017 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/pointer_traits.hpp> |
| 9 | #include <boost/core/lightweight_test_trait.hpp> |
| 10 | #include <boost/core/detail/is_same.hpp> |
| 11 | |
| 12 | template<class T> |
| 13 | struct P { }; |
| 14 | |
| 15 | template<class T> |
| 16 | struct E { |
| 17 | typedef long difference_type; |
| 18 | }; |
| 19 | |
| 20 | int main() |
| 21 | { |
| 22 | BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<std::ptrdiff_t, |
| 23 | boost::pointer_traits<int*>::difference_type>)); |
| 24 | BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<std::ptrdiff_t, |
| 25 | boost::pointer_traits<P<int> >::difference_type>)); |
| 26 | BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<long, |
| 27 | boost::pointer_traits<E<int> >::difference_type>)); |
| 28 | BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<std::ptrdiff_t, |
| 29 | boost::pointer_traits<void*>::difference_type>)); |
| 30 | BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<std::ptrdiff_t, |
| 31 | boost::pointer_traits<P<void> >::difference_type>)); |
| 32 | BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<long, |
| 33 | boost::pointer_traits<E<void> >::difference_type>)); |
| 34 | BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<std::ptrdiff_t, |
| 35 | boost::pointer_traits<const int*>::difference_type>)); |
| 36 | BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<std::ptrdiff_t, |
| 37 | boost::pointer_traits<P<const int> >::difference_type>)); |
| 38 | BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<long, |
| 39 | boost::pointer_traits<E<const int> >::difference_type>)); |
| 40 | return boost::report_errors(); |
| 41 | } |
| 42 | |