]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/function_types/test/classification/is_cv_function.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / function_types / test / classification / is_cv_function.cpp
1
2 // (C) Copyright Tobias Schwinger
3 //
4 // Use modification and distribution are subject to the boost Software License,
5 // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
6
7 //------------------------------------------------------------------------------
8
9 #include <boost/mpl/assert.hpp>
10 #include <boost/function_types/is_function.hpp>
11
12 namespace ft = boost::function_types;
13
14 template<typename C, typename T>
15 void test_non_cv(T C::*)
16 {
17 BOOST_MPL_ASSERT((
18 ft::is_function<T, ft::non_const >
19 ));
20
21 BOOST_MPL_ASSERT((
22 ft::is_function<T, ft::non_volatile >
23 ));
24
25 BOOST_MPL_ASSERT((
26 ft::is_function<T, ft::tag<ft::non_const,ft::non_volatile> >
27 ));
28
29 BOOST_MPL_ASSERT_NOT((
30 ft::is_function<T, ft::const_qualified >
31 ));
32
33 BOOST_MPL_ASSERT_NOT((
34 ft::is_function<T, ft::volatile_qualified >
35 ));
36
37 BOOST_MPL_ASSERT_NOT((
38 ft::is_function<T, ft::tag<ft::const_qualified,ft::volatile_qualified> >
39 ));
40 }
41
42 template<typename C, typename T>
43 void test_c_non_v(T C::*)
44 {
45 BOOST_MPL_ASSERT((
46 ft::is_function<T, ft::const_qualified >
47 ));
48
49 BOOST_MPL_ASSERT((
50 ft::is_function<T, ft::non_volatile >
51 ));
52
53 BOOST_MPL_ASSERT((
54 ft::is_function<T, ft::tag<ft::const_qualified,ft::non_volatile> >
55 ));
56
57 BOOST_MPL_ASSERT_NOT((
58 ft::is_function<T, ft::non_const >
59 ));
60
61 BOOST_MPL_ASSERT_NOT((
62 ft::is_function<T, ft::volatile_qualified >
63 ));
64
65 BOOST_MPL_ASSERT_NOT((
66 ft::is_function<T, ft::tag<ft::non_const,ft::volatile_qualified> >
67 ));
68 }
69
70 template<typename C, typename T>
71 void test_v_non_c(T C::*)
72 {
73 BOOST_MPL_ASSERT((
74 ft::is_function<T, ft::non_const >
75 ));
76
77 BOOST_MPL_ASSERT((
78 ft::is_function<T, ft::volatile_qualified >
79 ));
80
81 BOOST_MPL_ASSERT((
82 ft::is_function<T, ft::tag<ft::non_const,ft::volatile_qualified> >
83 ));
84
85 BOOST_MPL_ASSERT_NOT((
86 ft::is_function<T, ft::const_qualified >
87 ));
88
89 BOOST_MPL_ASSERT_NOT((
90 ft::is_function<T, ft::non_volatile >
91 ));
92
93 BOOST_MPL_ASSERT_NOT((
94 ft::is_function<T, ft::tag<ft::const_qualified,ft::non_volatile> >
95 ));
96 }
97
98 template<typename C, typename T>
99 void test_cv(T C::*)
100 {
101 BOOST_MPL_ASSERT((
102 ft::is_function<T, ft::const_qualified >
103 ));
104
105 BOOST_MPL_ASSERT((
106 ft::is_function<T, ft::volatile_qualified >
107 ));
108
109 BOOST_MPL_ASSERT((
110 ft::is_function<T, ft::tag<ft::const_qualified,ft::volatile_qualified> >
111 ));
112
113 BOOST_MPL_ASSERT_NOT((
114 ft::is_function<T, ft::non_const >
115 ));
116
117 BOOST_MPL_ASSERT_NOT((
118 ft::is_function<T, ft::non_volatile >
119 ));
120
121 BOOST_MPL_ASSERT_NOT((
122 ft::is_function<T, ft::tag<ft::non_const,ft::non_volatile> >
123 ));
124 }
125
126
127 struct C
128 {
129 void non_cv(int) { }
130 void c_non_v(int) const { }
131 void v_non_c(int) volatile { }
132 void cv(int) const volatile { }
133 };
134
135 void instanitate()
136 {
137 test_non_cv(& C::non_cv);
138 test_c_non_v(& C::c_non_v);
139 test_v_non_c(& C::v_non_c);
140 test_cv(& C::cv);
141 }
142