]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/core/test/pointer_traits_rebind_test.cpp
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/is_same.hpp>
10 #include <boost/core/lightweight_test_trait.hpp>
15 template<class T1
, class T2
>
18 template<class T1
, class T2
, class T3
>
21 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
25 using rebind
= E1
<bool>;
28 template<class T1
, class T2
>
31 using rebind
= E2
<bool, T2
>;
34 template<class T1
, class T2
, class T3
>
37 using rebind
= E3
<bool, T2
, T3
>;
41 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
42 template<class T
, class... U
>
45 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
46 template<class T
, class... U
>
49 using rebind
= E
<bool, U
...>;
58 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<char*,
59 boost::pointer_traits
<R
*>::rebind_to
<char>::type
>));
60 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<P1
<char>,
61 boost::pointer_traits
<P1
<R
> >::rebind_to
<char>::type
>));
62 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<P2
<char, R
>,
63 boost::pointer_traits
<P2
<R
, R
> >::rebind_to
<char>::type
>));
64 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<P3
<char, R
, R
>,
65 boost::pointer_traits
<P3
<R
, R
, R
> >::rebind_to
<char>::type
>));
66 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
67 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<P
<char, R
, R
, R
>,
68 boost::pointer_traits
<P
<R
, R
, R
, R
> >::rebind_to
<char>::type
>));
70 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<void*,
71 boost::pointer_traits
<R
*>::rebind_to
<void>::type
>));
72 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<P1
<void>,
73 boost::pointer_traits
<P1
<R
> >::rebind_to
<void>::type
>));
74 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<R
*,
75 boost::pointer_traits
<void*>::rebind_to
<R
>::type
>));
76 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<P1
<R
>,
77 boost::pointer_traits
<P1
<void> >::rebind_to
<R
>::type
>));
78 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<const int*,
79 boost::pointer_traits
<R
*>::rebind_to
<const int>::type
>));
80 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<P1
<const int>,
81 boost::pointer_traits
<P1
<R
> >::rebind_to
<const int>::type
>));
82 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<int*,
83 boost::pointer_traits
<const R
*>::rebind_to
<int>::type
>));
84 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<P1
<int>,
85 boost::pointer_traits
<P1
<const R
> >::rebind_to
<int>::type
>));
86 #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
87 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<E1
<bool>,
88 boost::pointer_traits
<E1
<R
> >::rebind_to
<char>::type
>));
89 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<E2
<bool, R
>,
90 boost::pointer_traits
<E2
<R
, R
> >::rebind_to
<char>::type
>));
91 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<E3
<bool, R
, R
>,
92 boost::pointer_traits
<E3
<R
, R
, R
> >::rebind_to
<char>::type
>));
93 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
94 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<E
<bool, R
, R
, R
>,
95 boost::pointer_traits
<E
<R
, R
, R
, R
> >::rebind_to
<char>::type
>));
97 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<E1
<bool>,
98 boost::pointer_traits
<E1
<R
> >::rebind_to
<void>::type
>));
99 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<E1
<bool>,
100 boost::pointer_traits
<E1
<void> >::rebind_to
<R
>::type
>));
101 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<E1
<bool>,
102 boost::pointer_traits
<E1
<R
> >::rebind_to
<const int>::type
>));
103 BOOST_TEST_TRAIT_TRUE((boost::core::is_same
<E1
<bool>,
104 boost::pointer_traits
<E1
<const R
> >::rebind_to
<int>::type
>));
106 return boost::report_errors();