]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/intrusive/test/has_member_function_callable_with.cpp
buildsys: change download over to reef release
[ceph.git] / ceph / src / boost / libs / intrusive / test / has_member_function_callable_with.cpp
CommitLineData
7c673cae
FG
1//////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2011-2014. Distributed under the Boost
4// Software License, Version 1.0. (See accompanying file
5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7// See http://www.boost.org/libs/intrusive for documentation.
8//
9//////////////////////////////////////////////////////////////////////////////
10//User define
11#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME func0to3
12#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0
13#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 3
14#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace func0to3ns {
15#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }
16#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
17
18#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME func1to2
19#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1
20#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 2
21#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace func1to2ns {
22#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }
23#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
24
25#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME func3to3
26#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 3
27#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 3
28#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace func3to3ns {
29#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }
30#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
31
32#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME func0to0
33#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0
34#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0
35#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace func0to0ns {
36#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }
37#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
38
39///////////////////
40///////////////////
41// TEST CODE
42///////////////////
43///////////////////
44
45struct functor
46{
47 //func0to3
48 void func0to3();
49 void func0to3(const int&);
50 void func0to3(const int&, const int&);
51 void func0to3(const int&, const int&, const int&);
52 //func1to2
53 void func1to2(const int&);
54 void func1to2(const int&, const int&);
55 //func3to3
56 void func3to3(const int&, const int&, const int&);
57 //func0to0
58 void func0to0();
59};
60
61struct functor2
62{
63 void func0to3(char*);
64 void func0to3(int, char*);
65 void func0to3(int, char*, double);
66 void func0to3(const int&, char*, void *);
67 //func1to2
68 void func1to2(char*);
69 void func1to2(int, char*);
70 void func1to2(int, char*, double);
71 //func3to3
72 void func3to3(const int&, char*, void *);
73};
74
75struct functor3
76{
77
78};
79
80struct functor4
81{
82 //func0to3
83 void func0to3(...);
84 template<class T> void func0to3(int, const T &);
85 template<class T> void func0to3(const T &);
86 template<class T, class U> void func0to3(int, const T &, const U &);
87 //func1to2
88 template<class T> void func1to2(int, const T &);
89 template<class T> void func1to2(const T &);
90 template<class T, class U> void func1to2(int, const T &, const U &);
91 //func3to3
92 void func3to3(...);
93 template<class T, class U> void func3to3(int, const T &, const U &);
94};
95
96int main()
97{
98 #if !defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED)
99 { //func0to3 0 arg
100 using func0to3ns::has_member_function_callable_with_func0to3;
101 int check1[ has_member_function_callable_with_func0to3<functor>::value ? 1 : -1];
102 int check2[!has_member_function_callable_with_func0to3<functor2>::value ? 1 : -1];
103 int check3[!has_member_function_callable_with_func0to3<functor3>::value ? 1 : -1];
104 int check4[ has_member_function_callable_with_func0to3<functor4>::value ? 1 : -1];
105 (void)check1;
106 (void)check2;
107 (void)check3;
108 (void)check4;
109 }
110 { //func0to0 0 arg
111 using func0to0ns::has_member_function_callable_with_func0to0;
112 int check1[ has_member_function_callable_with_func0to0<functor>::value ? 1 : -1];
113 int check2[!has_member_function_callable_with_func0to0<functor2>::value ? 1 : -1];
114 int check3[!has_member_function_callable_with_func0to0<functor3>::value ? 1 : -1];
115 (void)check1;
116 (void)check2;
117 (void)check3;
118 }
119 #endif
120
121 { //func0to3 1arg
122 using func0to3ns::has_member_function_callable_with_func0to3;
123 int check1[ has_member_function_callable_with_func0to3<functor, int>::value ? 1 : -1];
124 int check2[!has_member_function_callable_with_func0to3<functor, char*>::value ? 1 : -1];
125 int check3[!has_member_function_callable_with_func0to3<functor2, int>::value ? 1 : -1];
126 int check4[ has_member_function_callable_with_func0to3<functor2, char*>::value ? 1 : -1];
127 int check5[!has_member_function_callable_with_func0to3<functor3, int>::value ? 1 : -1];
128 int check6[!has_member_function_callable_with_func0to3<functor3, char*>::value ? 1 : -1];
129 int check7[ has_member_function_callable_with_func0to3<functor4, int>::value ? 1 : -1];
130 int check8[ has_member_function_callable_with_func0to3<functor4, char*>::value ? 1 : -1];
131 (void)check1;
132 (void)check2;
133 (void)check3;
134 (void)check4;
135 (void)check5;
136 (void)check6;
137 (void)check7;
138 (void)check8;
139 }
140
141 { //func1to2 1arg
142 using func1to2ns::has_member_function_callable_with_func1to2;
143 int check1[ has_member_function_callable_with_func1to2<functor, int>::value ? 1 : -1];
144 int check2[!has_member_function_callable_with_func1to2<functor, char*>::value ? 1 : -1];
145 int check3[!has_member_function_callable_with_func1to2<functor2, int>::value ? 1 : -1];
146 int check4[ has_member_function_callable_with_func1to2<functor2, char*>::value ? 1 : -1];
147 int check5[!has_member_function_callable_with_func1to2<functor3, int>::value ? 1 : -1];
148 int check6[!has_member_function_callable_with_func1to2<functor3, char*>::value ? 1 : -1];
149 int check7[ has_member_function_callable_with_func1to2<functor4, int>::value ? 1 : -1];
150 int check8[ has_member_function_callable_with_func1to2<functor4, char*>::value ? 1 : -1];
151 (void)check1;
152 (void)check2;
153 (void)check3;
154 (void)check4;
155 (void)check5;
156 (void)check6;
157 (void)check7;
158 (void)check8;
159 }
160
161 { //func0to3 2arg
162 using func0to3ns::has_member_function_callable_with_func0to3;
163 int check1[ has_member_function_callable_with_func0to3<functor, int, int>::value ? 1 : -1];
164 int check2[!has_member_function_callable_with_func0to3<functor, int, char*>::value ? 1 : -1];
165 int check3[!has_member_function_callable_with_func0to3<functor2, int, int>::value ? 1 : -1];
166 int check4[ has_member_function_callable_with_func0to3<functor2, int, char*>::value ? 1 : -1];
167 int check5[!has_member_function_callable_with_func0to3<functor3, int, int>::value ? 1 : -1];
168 int check6[!has_member_function_callable_with_func0to3<functor3, int, char*>::value ? 1 : -1];
169 int check7[ has_member_function_callable_with_func0to3<functor4, int, char*>::value ? 1 : -1];
170 (void)check1;
171 (void)check2;
172 (void)check3;
173 (void)check4;
174 (void)check5;
175 (void)check6;
176 (void)check7;
177 }
178
179 { //func1to2 2arg
180 using func1to2ns::has_member_function_callable_with_func1to2;
181 int check1[ has_member_function_callable_with_func1to2<functor, int, int>::value ? 1 : -1];
182 int check2[!has_member_function_callable_with_func1to2<functor, int, char*>::value ? 1 : -1];
183 int check3[!has_member_function_callable_with_func1to2<functor2, int, int>::value ? 1 : -1];
184 int check4[ has_member_function_callable_with_func1to2<functor2, int, char*>::value ? 1 : -1];
185 int check5[!has_member_function_callable_with_func1to2<functor3, int, int>::value ? 1 : -1];
186 int check6[!has_member_function_callable_with_func1to2<functor3, int, char*>::value ? 1 : -1];
187 int check7[ has_member_function_callable_with_func1to2<functor4, int, char*>::value ? 1 : -1];
188 (void)check1;
189 (void)check2;
190 (void)check3;
191 (void)check4;
192 (void)check5;
193 (void)check6;
194 (void)check7;
195 }
196
197 { //func0to3 3arg
198 using func0to3ns::has_member_function_callable_with_func0to3;
199 int check1[ has_member_function_callable_with_func0to3<functor, int, int, int>::value ? 1 : -1];
200 int check2[!has_member_function_callable_with_func0to3<functor, int, char*, int>::value ? 1 : -1];
201 int check3[!has_member_function_callable_with_func0to3<functor2, int, int, int>::value ? 1 : -1];
202 int check4[ has_member_function_callable_with_func0to3<functor2, int, char*, void*>::value ? 1 : -1];
203 int check5[!has_member_function_callable_with_func0to3<functor3, int, int, int>::value ? 1 : -1];
204 int check6[!has_member_function_callable_with_func0to3<functor3, int, char*, void*>::value ? 1 : -1];
205 int check7[ has_member_function_callable_with_func0to3<functor4, int, char*, int>::value ? 1 : -1];
206 (void)check1;
207 (void)check2;
208 (void)check3;
209 (void)check4;
210 (void)check5;
211 (void)check6;
212 (void)check7;
213 }
214
215 { //func3to3 3arg
216 using func3to3ns::has_member_function_callable_with_func3to3;
217 int check1[ has_member_function_callable_with_func3to3<functor, int, int, int>::value ? 1 : -1];
218 int check2[!has_member_function_callable_with_func3to3<functor, int, char*, int>::value ? 1 : -1];
219 int check3[!has_member_function_callable_with_func3to3<functor2, int, int, int>::value ? 1 : -1];
220 int check4[ has_member_function_callable_with_func3to3<functor2, int, char*, void*>::value ? 1 : -1];
221 int check5[!has_member_function_callable_with_func3to3<functor3, int, int, int>::value ? 1 : -1];
222 int check6[!has_member_function_callable_with_func3to3<functor3, int, char*, void*>::value ? 1 : -1];
223 int check7[ has_member_function_callable_with_func3to3<functor4, int, char*, int>::value ? 1 : -1];
224 (void)check1;
225 (void)check2;
226 (void)check3;
227 (void)check4;
228 (void)check5;
229 (void)check6;
230 (void)check7;
231 }
232
233 return 0;
234}