|
3 | 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
4 | 4 | //#include <stdio.h> |
5 | 5 | #include <cassert> |
| 6 | +#include <boost/type_traits/is_member_function_pointer.hpp> |
| 7 | +#include <boost/mpl/assert.hpp> |
6 | 8 | #include <boost/python/detail/indirect_traits.hpp> |
| 9 | +#include <boost/mpl/assert.hpp> |
7 | 10 |
|
8 | 11 | //#define print(expr) printf("%s ==> %s\n", #expr, expr) |
9 | 12 |
|
10 | 13 | // not all the compilers can handle an incomplete class type here. |
11 | 14 | struct X {}; |
12 | 15 |
|
13 | | -int main() |
14 | | -{ |
15 | | - using namespace boost::python::indirect_traits; |
| 16 | +using namespace boost::python::indirect_traits; |
16 | 17 |
|
17 | | - typedef void (X::*pmf)(); |
| 18 | +typedef void (X::*pmf)(); |
18 | 19 |
|
19 | | - assert(is_reference_to_function<int (&)()>::value); |
20 | | - assert(!is_reference_to_function<int (*)()>::value); |
21 | | - assert(!is_reference_to_function<int&>::value); |
22 | | - assert(!is_reference_to_function<pmf>::value); |
| 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>)); |
23 | 24 |
|
24 | | - assert(!is_pointer_to_function<int (&)()>::value); |
25 | | - assert(is_pointer_to_function<int (*)()>::value); |
26 | | - assert(!is_pointer_to_function<int (*&)()>::value); |
27 | | - assert(!is_pointer_to_function<int (*const&)()>::value); |
28 | | - assert(!is_pointer_to_function<pmf>::value); |
| 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>)); |
29 | 30 |
|
30 | | - assert(!is_reference_to_function_pointer<int (&)()>::value); |
31 | | - assert(!is_reference_to_function_pointer<int (*)()>::value); |
32 | | - assert(!is_reference_to_function_pointer<int&>::value); |
33 | | - assert(is_reference_to_function_pointer<int (*&)()>::value); |
34 | | - assert(is_reference_to_function_pointer<int (*const&)()>::value); |
35 | | - assert(!is_reference_to_function_pointer<pmf>::value); |
| 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>)); |
36 | 37 |
|
37 | | - assert(is_reference_to_pointer<int*&>::value); |
38 | | - assert(is_reference_to_pointer<int* const&>::value); |
39 | | - assert(is_reference_to_pointer<int*volatile&>::value); |
40 | | - assert(is_reference_to_pointer<int*const volatile&>::value); |
41 | | - assert(is_reference_to_pointer<int const*&>::value); |
42 | | - assert(is_reference_to_pointer<int const* const&>::value); |
43 | | - assert(is_reference_to_pointer<int const*volatile&>::value); |
44 | | - assert(is_reference_to_pointer<int const*const volatile&>::value); |
45 | | - assert(!is_reference_to_pointer<pmf>::value); |
46 | | - |
47 | | - assert(!is_reference_to_pointer<int const volatile>::value); |
48 | | - assert(!is_reference_to_pointer<int>::value); |
49 | | - assert(!is_reference_to_pointer<int*>::value); |
| 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>)); |
| 47 | + |
| 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*>)); |
50 | 51 |
|
51 | | - assert(!is_reference_to_const<int*&>::value); |
52 | | - assert(is_reference_to_const<int* const&>::value); |
53 | | - assert(!is_reference_to_const<int*volatile&>::value); |
54 | | - assert(is_reference_to_const<int*const volatile&>::value); |
| 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&>)); |
55 | 56 |
|
56 | | - assert(!is_reference_to_const<int const volatile>::value); |
57 | | - assert(!is_reference_to_const<int>::value); |
58 | | - assert(!is_reference_to_const<int*>::value); |
| 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*>)); |
59 | 60 |
|
60 | | - assert(is_reference_to_non_const<int*&>::value); |
61 | | - assert(!is_reference_to_non_const<int* const&>::value); |
62 | | - assert(is_reference_to_non_const<int*volatile&>::value); |
63 | | - assert(!is_reference_to_non_const<int*const volatile&>::value); |
| 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&>)); |
| 65 | + |
| 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*>)); |
64 | 69 |
|
65 | | - assert(!is_reference_to_non_const<int const volatile>::value); |
66 | | - assert(!is_reference_to_non_const<int>::value); |
67 | | - assert(!is_reference_to_non_const<int*>::value); |
| 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&>)); |
68 | 74 |
|
69 | | - assert(!is_reference_to_volatile<int*&>::value); |
70 | | - assert(!is_reference_to_volatile<int* const&>::value); |
71 | | - assert(is_reference_to_volatile<int*volatile&>::value); |
72 | | - assert(is_reference_to_volatile<int*const volatile&>::value); |
| 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*>)); |
| 78 | + |
| 79 | +namespace tt = boost::python::indirect_traits; |
| 80 | + |
| 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*>)); |
73 | 84 |
|
74 | | - assert(!is_reference_to_volatile<int const volatile>::value); |
75 | | - assert(!is_reference_to_volatile<int>::value); |
76 | | - assert(!is_reference_to_volatile<int*>::value); |
77 | 85 |
|
78 | | - assert(!is_reference_to_class<int>::value); |
79 | | - assert(!is_reference_to_class<int&>::value); |
80 | | - assert(!is_reference_to_class<int*>::value); |
| 86 | +BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<pmf>)); |
| 87 | +BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<pmf const&>)); |
81 | 88 |
|
82 | | - assert(!is_reference_to_class<X>::value); |
83 | | - assert(is_reference_to_class<X&>::value); |
84 | | - assert(is_reference_to_class<X const&>::value); |
85 | | - assert(is_reference_to_class<X volatile&>::value); |
86 | | - assert(is_reference_to_class<X const volatile&>::value); |
| 89 | +BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<X>)); |
| 90 | + |
| 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&>)); |
87 | 95 |
|
88 | | - assert(!is_pointer_to_class<int>::value); |
89 | | - assert(!is_pointer_to_class<int*>::value); |
90 | | - assert(!is_pointer_to_class<int&>::value); |
| 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&>)); |
91 | 99 |
|
92 | | - assert(!is_pointer_to_class<X>::value); |
93 | | - assert(!is_pointer_to_class<X&>::value); |
94 | | - assert(is_pointer_to_class<X*>::value); |
95 | | - assert(is_pointer_to_class<X const*>::value); |
96 | | - assert(is_pointer_to_class<X volatile*>::value); |
97 | | - assert(is_pointer_to_class<X const volatile*>::value); |
| 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*>)); |
98 | 108 |
|
99 | | - assert(is_reference_to_member_function_pointer<pmf&>::value); |
100 | | - assert(is_reference_to_member_function_pointer<pmf const&>::value); |
101 | | - assert(is_reference_to_member_function_pointer<pmf volatile&>::value); |
102 | | - assert(is_reference_to_member_function_pointer<pmf const volatile&>::value); |
103 | | - assert(!is_reference_to_member_function_pointer<pmf[2]>::value); |
104 | | - assert(!is_reference_to_member_function_pointer<pmf(&)[2]>::value); |
105 | | - assert(!is_reference_to_member_function_pointer<pmf>::value); |
| 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>)); |
106 | 116 |
|
107 | | - return 0; |
108 | | -} |
|
0 commit comments