]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/python/test/indirect_traits_test.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / python / test / indirect_traits_test.cpp
CommitLineData
7c673cae
FG
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)
4//#include <stdio.h>
5#define BOOST_ENABLE_ASSERT_HANDLER
6#include <boost/assert.hpp>
7c673cae
FG
7#include <boost/mpl/assert.hpp>
8#include <boost/python/detail/indirect_traits.hpp>
9#include <boost/mpl/assert.hpp>
10
11//#define print(expr) printf("%s ==> %s\n", #expr, expr)
12
13// not all the compilers can handle an incomplete class type here.
14struct X {};
15
16using namespace boost::python::indirect_traits;
17
18typedef void (X::*pmf)();
19
20BOOST_MPL_ASSERT((is_reference_to_function<int (&)()>));
21BOOST_MPL_ASSERT_NOT((is_reference_to_function<int (*)()>));
22BOOST_MPL_ASSERT_NOT((is_reference_to_function<int&>));
23BOOST_MPL_ASSERT_NOT((is_reference_to_function<pmf>));
24
25BOOST_MPL_ASSERT_NOT((is_pointer_to_function<int (&)()>));
26BOOST_MPL_ASSERT((is_pointer_to_function<int (*)()>));
27BOOST_MPL_ASSERT_NOT((is_pointer_to_function<int (*&)()>));
28BOOST_MPL_ASSERT_NOT((is_pointer_to_function<int (*const&)()>));
29BOOST_MPL_ASSERT_NOT((is_pointer_to_function<pmf>));
30
31BOOST_MPL_ASSERT_NOT((is_reference_to_function_pointer<int (&)()>));
32BOOST_MPL_ASSERT_NOT((is_reference_to_function_pointer<int (*)()>));
33BOOST_MPL_ASSERT_NOT((is_reference_to_function_pointer<int&>));
34BOOST_MPL_ASSERT((is_reference_to_function_pointer<int (*&)()>));
35BOOST_MPL_ASSERT((is_reference_to_function_pointer<int (*const&)()>));
36BOOST_MPL_ASSERT_NOT((is_reference_to_function_pointer<pmf>));
37
38BOOST_MPL_ASSERT((is_reference_to_pointer<int*&>));
39BOOST_MPL_ASSERT((is_reference_to_pointer<int* const&>));
40BOOST_MPL_ASSERT((is_reference_to_pointer<int*volatile&>));
41BOOST_MPL_ASSERT((is_reference_to_pointer<int*const volatile&>));
42BOOST_MPL_ASSERT((is_reference_to_pointer<int const*&>));
43BOOST_MPL_ASSERT((is_reference_to_pointer<int const* const&>));
44BOOST_MPL_ASSERT((is_reference_to_pointer<int const*volatile&>));
45BOOST_MPL_ASSERT((is_reference_to_pointer<int const*const volatile&>));
46BOOST_MPL_ASSERT_NOT((is_reference_to_pointer<pmf>));
47
48BOOST_MPL_ASSERT_NOT((is_reference_to_pointer<int const volatile>));
49BOOST_MPL_ASSERT_NOT((is_reference_to_pointer<int>));
50BOOST_MPL_ASSERT_NOT((is_reference_to_pointer<int*>));
51
52BOOST_MPL_ASSERT_NOT((is_reference_to_const<int*&>));
53BOOST_MPL_ASSERT((is_reference_to_const<int* const&>));
54BOOST_MPL_ASSERT_NOT((is_reference_to_const<int*volatile&>));
55BOOST_MPL_ASSERT((is_reference_to_const<int*const volatile&>));
56
57BOOST_MPL_ASSERT_NOT((is_reference_to_const<int const volatile>));
58BOOST_MPL_ASSERT_NOT((is_reference_to_const<int>));
59BOOST_MPL_ASSERT_NOT((is_reference_to_const<int*>));
60
61BOOST_MPL_ASSERT((is_reference_to_non_const<int*&>));
62BOOST_MPL_ASSERT_NOT((is_reference_to_non_const<int* const&>));
63BOOST_MPL_ASSERT((is_reference_to_non_const<int*volatile&>));
64BOOST_MPL_ASSERT_NOT((is_reference_to_non_const<int*const volatile&>));
65
66BOOST_MPL_ASSERT_NOT((is_reference_to_non_const<int const volatile>));
67BOOST_MPL_ASSERT_NOT((is_reference_to_non_const<int>));
68BOOST_MPL_ASSERT_NOT((is_reference_to_non_const<int*>));
69
70BOOST_MPL_ASSERT_NOT((is_reference_to_volatile<int*&>));
71BOOST_MPL_ASSERT_NOT((is_reference_to_volatile<int* const&>));
72BOOST_MPL_ASSERT((is_reference_to_volatile<int*volatile&>));
73BOOST_MPL_ASSERT((is_reference_to_volatile<int*const volatile&>));
74
75BOOST_MPL_ASSERT_NOT((is_reference_to_volatile<int const volatile>));
76BOOST_MPL_ASSERT_NOT((is_reference_to_volatile<int>));
77BOOST_MPL_ASSERT_NOT((is_reference_to_volatile<int*>));
78
79namespace tt = boost::python::indirect_traits;
80
81BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<int>));
82BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<int&>));
83BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<int*>));
84
85
86BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<pmf>));
87BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<pmf const&>));
88
89BOOST_MPL_ASSERT_NOT((tt::is_reference_to_class<X>));
90
91BOOST_MPL_ASSERT((tt::is_reference_to_class<X&>));
92BOOST_MPL_ASSERT((tt::is_reference_to_class<X const&>));
93BOOST_MPL_ASSERT((tt::is_reference_to_class<X volatile&>));
94BOOST_MPL_ASSERT((tt::is_reference_to_class<X const volatile&>));
95
96BOOST_MPL_ASSERT_NOT((is_pointer_to_class<int>));
97BOOST_MPL_ASSERT_NOT((is_pointer_to_class<int*>));
98BOOST_MPL_ASSERT_NOT((is_pointer_to_class<int&>));
99
100BOOST_MPL_ASSERT_NOT((is_pointer_to_class<X>));
101BOOST_MPL_ASSERT_NOT((is_pointer_to_class<X&>));
102BOOST_MPL_ASSERT_NOT((is_pointer_to_class<pmf>));
103BOOST_MPL_ASSERT_NOT((is_pointer_to_class<pmf const>));
104BOOST_MPL_ASSERT((is_pointer_to_class<X*>));
105BOOST_MPL_ASSERT((is_pointer_to_class<X const*>));
106BOOST_MPL_ASSERT((is_pointer_to_class<X volatile*>));
107BOOST_MPL_ASSERT((is_pointer_to_class<X const volatile*>));
108
109BOOST_MPL_ASSERT((tt::is_reference_to_member_function_pointer<pmf&>));
110BOOST_MPL_ASSERT((tt::is_reference_to_member_function_pointer<pmf const&>));
111BOOST_MPL_ASSERT((tt::is_reference_to_member_function_pointer<pmf volatile&>));
112BOOST_MPL_ASSERT((tt::is_reference_to_member_function_pointer<pmf const volatile&>));
113BOOST_MPL_ASSERT_NOT((tt::is_reference_to_member_function_pointer<pmf[2]>));
114BOOST_MPL_ASSERT_NOT((tt::is_reference_to_member_function_pointer<pmf(&)[2]>));
115BOOST_MPL_ASSERT_NOT((tt::is_reference_to_member_function_pointer<pmf>));
116