1 // Copyright David Abrahams 2004. Distributed under the Boost
2 // Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #define BOOST_ENABLE_ASSERT_HANDLER
6 #include <boost/assert.hpp>
7 #include <boost/mpl/assert.hpp>
8 #include <boost/python/detail/indirect_traits.hpp>
9 #include <boost/mpl/assert.hpp>
11 //#define print(expr) printf("%s ==> %s\n", #expr, expr)
13 // not all the compilers can handle an incomplete class type here.
16 using namespace boost::python::indirect_traits
;
18 typedef void (X::*pmf
)();
20 BOOST_MPL_ASSERT((is_reference_to_function
<int (&)()>));
21 BOOST_MPL_ASSERT_NOT((is_reference_to_function
<int (*)()>));
22 BOOST_MPL_ASSERT_NOT((is_reference_to_function
<int&>));
23 BOOST_MPL_ASSERT_NOT((is_reference_to_function
<pmf
>));
25 BOOST_MPL_ASSERT_NOT((is_pointer_to_function
<int (&)()>));
26 BOOST_MPL_ASSERT((is_pointer_to_function
<int (*)()>));
27 BOOST_MPL_ASSERT_NOT((is_pointer_to_function
<int (*&)()>));
28 BOOST_MPL_ASSERT_NOT((is_pointer_to_function
<int (*const&)()>));
29 BOOST_MPL_ASSERT_NOT((is_pointer_to_function
<pmf
>));
31 BOOST_MPL_ASSERT_NOT((is_reference_to_function_pointer
<int (&)()>));
32 BOOST_MPL_ASSERT_NOT((is_reference_to_function_pointer
<int (*)()>));
33 BOOST_MPL_ASSERT_NOT((is_reference_to_function_pointer
<int&>));
34 BOOST_MPL_ASSERT((is_reference_to_function_pointer
<int (*&)()>));
35 BOOST_MPL_ASSERT((is_reference_to_function_pointer
<int (*const&)()>));
36 BOOST_MPL_ASSERT_NOT((is_reference_to_function_pointer
<pmf
>));
38 BOOST_MPL_ASSERT((is_reference_to_pointer
<int*&>));
39 BOOST_MPL_ASSERT((is_reference_to_pointer
<int* const&>));
40 BOOST_MPL_ASSERT((is_reference_to_pointer
<int*volatile&>));
41 BOOST_MPL_ASSERT((is_reference_to_pointer
<int*const volatile&>));
42 BOOST_MPL_ASSERT((is_reference_to_pointer
<int const*&>));
43 BOOST_MPL_ASSERT((is_reference_to_pointer
<int const* const&>));
44 BOOST_MPL_ASSERT((is_reference_to_pointer
<int const*volatile&>));
45 BOOST_MPL_ASSERT((is_reference_to_pointer
<int const*const volatile&>));
46 BOOST_MPL_ASSERT_NOT((is_reference_to_pointer
<pmf
>));
48 BOOST_MPL_ASSERT_NOT((is_reference_to_pointer
<int const volatile>));
49 BOOST_MPL_ASSERT_NOT((is_reference_to_pointer
<int>));
50 BOOST_MPL_ASSERT_NOT((is_reference_to_pointer
<int*>));
52 BOOST_MPL_ASSERT_NOT((is_reference_to_const
<int*&>));
53 BOOST_MPL_ASSERT((is_reference_to_const
<int* const&>));
54 BOOST_MPL_ASSERT_NOT((is_reference_to_const
<int*volatile&>));
55 BOOST_MPL_ASSERT((is_reference_to_const
<int*const volatile&>));
57 BOOST_MPL_ASSERT_NOT((is_reference_to_const
<int const volatile>));
58 BOOST_MPL_ASSERT_NOT((is_reference_to_const
<int>));
59 BOOST_MPL_ASSERT_NOT((is_reference_to_const
<int*>));
61 BOOST_MPL_ASSERT((is_reference_to_non_const
<int*&>));
62 BOOST_MPL_ASSERT_NOT((is_reference_to_non_const
<int* const&>));
63 BOOST_MPL_ASSERT((is_reference_to_non_const
<int*volatile&>));
64 BOOST_MPL_ASSERT_NOT((is_reference_to_non_const
<int*const volatile&>));
66 BOOST_MPL_ASSERT_NOT((is_reference_to_non_const
<int const volatile>));
67 BOOST_MPL_ASSERT_NOT((is_reference_to_non_const
<int>));
68 BOOST_MPL_ASSERT_NOT((is_reference_to_non_const
<int*>));
70 BOOST_MPL_ASSERT_NOT((is_reference_to_volatile
<int*&>));
71 BOOST_MPL_ASSERT_NOT((is_reference_to_volatile
<int* const&>));
72 BOOST_MPL_ASSERT((is_reference_to_volatile
<int*volatile&>));
73 BOOST_MPL_ASSERT((is_reference_to_volatile
<int*const volatile&>));
75 BOOST_MPL_ASSERT_NOT((is_reference_to_volatile
<int const volatile>));
76 BOOST_MPL_ASSERT_NOT((is_reference_to_volatile
<int>));
77 BOOST_MPL_ASSERT_NOT((is_reference_to_volatile
<int*>));
79 namespace tt
= boost::python::indirect_traits
;
81 BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class
<int>));
82 BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class
<int&>));
83 BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class
<int*>));
86 BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class
<pmf
>));
87 BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class
<pmf
const&>));
89 BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class
<X
>));
91 BOOST_MPL_ASSERT((tt::is_reference_to_class
<X
&>));
92 BOOST_MPL_ASSERT((tt::is_reference_to_class
<X
const&>));
93 BOOST_MPL_ASSERT((tt::is_reference_to_class
<X
volatile&>));
94 BOOST_MPL_ASSERT((tt::is_reference_to_class
<X
const volatile&>));
96 BOOST_MPL_ASSERT_NOT((is_pointer_to_class
<int>));
97 BOOST_MPL_ASSERT_NOT((is_pointer_to_class
<int*>));
98 BOOST_MPL_ASSERT_NOT((is_pointer_to_class
<int&>));
100 BOOST_MPL_ASSERT_NOT((is_pointer_to_class
<X
>));
101 BOOST_MPL_ASSERT_NOT((is_pointer_to_class
<X
&>));
102 BOOST_MPL_ASSERT_NOT((is_pointer_to_class
<pmf
>));
103 BOOST_MPL_ASSERT_NOT((is_pointer_to_class
<pmf
const>));
104 BOOST_MPL_ASSERT((is_pointer_to_class
<X
*>));
105 BOOST_MPL_ASSERT((is_pointer_to_class
<X
const*>));
106 BOOST_MPL_ASSERT((is_pointer_to_class
<X
volatile*>));
107 BOOST_MPL_ASSERT((is_pointer_to_class
<X
const volatile*>));
109 BOOST_MPL_ASSERT((tt::is_reference_to_member_function_pointer
<pmf
&>));
110 BOOST_MPL_ASSERT((tt::is_reference_to_member_function_pointer
<pmf
const&>));
111 BOOST_MPL_ASSERT((tt::is_reference_to_member_function_pointer
<pmf
volatile&>));
112 BOOST_MPL_ASSERT((tt::is_reference_to_member_function_pointer
<pmf
const volatile&>));
113 BOOST_MPL_ASSERT_NOT((tt::is_reference_to_member_function_pointer
<pmf
[2]>));
114 BOOST_MPL_ASSERT_NOT((tt::is_reference_to_member_function_pointer
<pmf(&)[2]>));
115 BOOST_MPL_ASSERT_NOT((tt::is_reference_to_member_function_pointer
<pmf
>));