2 Copyright 2017 Glen Joseph Fernandes
5 Distributed under the Boost Software License, Version 1.0.
6 (http://www.boost.org/LICENSE_1_0.txt)
8 #include <boost/core/pointer_traits.hpp>
9 #include <boost/core/lightweight_test.hpp>
14 typedef typename
boost::pointer_traits
<T
>::element_type element_type
;
17 T
operator->() const BOOST_NOEXCEPT
{
29 T
* get() const BOOST_NOEXCEPT
{
39 struct pointer_traits
<special
<T
> > {
40 typedef special
<T
> pointer
;
41 typedef T element_type
;
42 typedef std::ptrdiff_t difference_type
;
45 typedef special
<U
> type
;
47 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
49 using rebind
= typename rebind_to
<U
>::type
;
52 static pointer
pointer_to(U
& v
) BOOST_NOEXCEPT
{
55 static element_type
* to_address(const pointer
& v
) BOOST_NOEXCEPT
{
68 BOOST_TEST(boost::to_address(p
) == &i
);
71 typedef pointer
<int*> type
;
73 BOOST_TEST(boost::to_address(p
) == &i
);
76 typedef pointer
<pointer
<int*> > type
;
78 BOOST_TEST(boost::to_address(p
) == &i
);
83 BOOST_TEST(boost::to_address(p
) == &i
);
86 typedef pointer
<void*> type
;
88 BOOST_TEST(boost::to_address(p
) == &i
);
91 typedef const int* type
;
93 BOOST_TEST(boost::to_address(p
) == &i
);
96 typedef pointer
<const int*> type
;
98 BOOST_TEST(boost::to_address(p
) == &i
);
101 typedef special
<int> type
;
103 BOOST_TEST(boost::to_address(p
) == &i
);
106 typedef special
<void> type
;
108 BOOST_TEST(boost::to_address(p
) == &i
);
111 typedef special
<const int> type
;
113 BOOST_TEST(boost::to_address(p
) == &i
);
116 typedef pointer
<special
<int> > type
;
118 BOOST_TEST(boost::to_address(p
) == &i
);
121 typedef pointer
<special
<void> > type
;
123 BOOST_TEST(boost::to_address(p
) == &i
);
126 typedef pointer
<special
<const int> > type
;
128 BOOST_TEST(boost::to_address(p
) == &i
);
130 return boost::report_errors();