1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
/*
Copyright 2017-2022 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/core/pointer_traits.hpp>
#include <boost/core/lightweight_test_trait.hpp>
#include <boost/core/detail/is_same.hpp>
template<class T>
struct P1 { };
template<class T1, class T2>
struct P2 { };
template<class T1, class T2, class T3>
struct P3 { };
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class T>
struct E1 {
template<class U>
using rebind = E1<bool>;
};
template<class T1, class T2>
struct E2 {
template<class U>
using rebind = E2<bool, T2>;
};
template<class T1, class T2, class T3>
struct E3 {
template<class U>
using rebind = E3<bool, T2, T3>;
};
#endif
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class T, class... U>
struct P { };
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class T, class... U>
struct E {
template<class V>
using rebind = E<bool, U...>;
};
#endif
#endif
struct R { };
int main()
{
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<char*,
boost::pointer_traits<R*>::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<char>,
boost::pointer_traits<P1<R> >::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P2<char, R>,
boost::pointer_traits<P2<R, R> >::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P3<char, R, R>,
boost::pointer_traits<P3<R, R, R> >::rebind_to<char>::type>));
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P<char, R, R, R>,
boost::pointer_traits<P<R, R, R, R> >::rebind_to<char>::type>));
#endif
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<void*,
boost::pointer_traits<R*>::rebind_to<void>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<void>,
boost::pointer_traits<P1<R> >::rebind_to<void>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<R*,
boost::pointer_traits<void*>::rebind_to<R>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<R>,
boost::pointer_traits<P1<void> >::rebind_to<R>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<const int*,
boost::pointer_traits<R*>::rebind_to<const int>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<const int>,
boost::pointer_traits<P1<R> >::rebind_to<const int>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<int*,
boost::pointer_traits<const R*>::rebind_to<int>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<int>,
boost::pointer_traits<P1<const R> >::rebind_to<int>::type>));
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<char*,
boost::pointer_traits<R*>::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<char>,
boost::pointer_traits<P1<R> >::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P2<char, R>,
boost::pointer_traits<P2<R, R> >::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P3<char, R, R>,
boost::pointer_traits<P3<R, R, R> >::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<void*,
boost::pointer_traits<R*>::rebind<void> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<void>,
boost::pointer_traits<P1<R> >::rebind<void> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<R*,
boost::pointer_traits<void*>::rebind<R> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<R>,
boost::pointer_traits<P1<void> >::rebind<R> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<const int*,
boost::pointer_traits<R*>::rebind<const int> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<const int>,
boost::pointer_traits<P1<R> >::rebind<const int> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<int*,
boost::pointer_traits<const R*>::rebind<int> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P1<int>,
boost::pointer_traits<P1<const R> >::rebind<int> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<R> >::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E2<bool, R>,
boost::pointer_traits<E2<R, R> >::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E3<bool, R, R>,
boost::pointer_traits<E3<R, R, R> >::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<R> >::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E2<bool, R>,
boost::pointer_traits<E2<R, R> >::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E3<bool, R, R>,
boost::pointer_traits<E3<R, R, R> >::rebind<char> >));
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<P<char, R, R, R>,
boost::pointer_traits<P<R, R, R, R> >::rebind<char> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E<bool, R, R, R>,
boost::pointer_traits<E<R, R, R, R> >::rebind_to<char>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E<bool, R, R, R>,
boost::pointer_traits<E<R, R, R, R> >::rebind<char> >));
#endif
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<R> >::rebind_to<void>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<void> >::rebind_to<R>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<R> >::rebind_to<const int>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<const R> >::rebind_to<int>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<R> >::rebind<void> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<void> >::rebind<R> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<R> >::rebind<const int> >));
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<E1<bool>,
boost::pointer_traits<E1<const R> >::rebind<int> >));
#endif
return boost::report_errors();
}
|