Chris@16
|
1 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
2 // poly_function_traits.hpp
|
Chris@16
|
3 // Contains specializations of poly_function_traits and as_mono_function
|
Chris@16
|
4 //
|
Chris@16
|
5 // Copyright 2008 Eric Niebler. Distributed under the Boost
|
Chris@16
|
6 // Software License, Version 1.0. (See accompanying file
|
Chris@16
|
7 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8
|
Chris@16
|
9 template<typename PolyFun , typename A0>
|
Chris@16
|
10 struct poly_function_traits<PolyFun, PolyFun(A0), mpl::size_t<sizeof(poly_function_t)> >
|
Chris@16
|
11 {
|
Chris@16
|
12 typedef typename PolyFun::template impl<const A0> function_type;
|
Chris@16
|
13 typedef typename function_type::result_type result_type;
|
Chris@16
|
14 };
|
Chris@16
|
15
|
Chris@16
|
16 template<typename PolyFun , typename A0>
|
Chris@16
|
17 struct as_mono_function_impl<PolyFun(A0), true>
|
Chris@16
|
18 {
|
Chris@16
|
19 typedef typename PolyFun::template impl<const A0> type;
|
Chris@16
|
20 };
|
Chris@16
|
21
|
Chris@16
|
22 template<typename PolyFun , typename A0>
|
Chris@16
|
23 struct as_mono_function_impl<PolyFun(A0), false>
|
Chris@16
|
24 {
|
Chris@16
|
25 typedef PolyFun type;
|
Chris@16
|
26 };
|
Chris@16
|
27
|
Chris@16
|
28 template<typename PolyFun , typename A0>
|
Chris@16
|
29 struct as_mono_function<PolyFun(A0)>
|
Chris@16
|
30 : as_mono_function_impl<PolyFun(A0), is_poly_function<PolyFun>::value>
|
Chris@16
|
31 {};
|
Chris@16
|
32
|
Chris@16
|
33 template<typename PolyFun , typename A0 , typename A1>
|
Chris@16
|
34 struct poly_function_traits<PolyFun, PolyFun(A0 , A1), mpl::size_t<sizeof(poly_function_t)> >
|
Chris@16
|
35 {
|
Chris@16
|
36 typedef typename PolyFun::template impl<const A0 , const A1> function_type;
|
Chris@16
|
37 typedef typename function_type::result_type result_type;
|
Chris@16
|
38 };
|
Chris@16
|
39
|
Chris@16
|
40 template<typename PolyFun , typename A0 , typename A1>
|
Chris@16
|
41 struct as_mono_function_impl<PolyFun(A0 , A1), true>
|
Chris@16
|
42 {
|
Chris@16
|
43 typedef typename PolyFun::template impl<const A0 , const A1> type;
|
Chris@16
|
44 };
|
Chris@16
|
45
|
Chris@16
|
46 template<typename PolyFun , typename A0 , typename A1>
|
Chris@16
|
47 struct as_mono_function_impl<PolyFun(A0 , A1), false>
|
Chris@16
|
48 {
|
Chris@16
|
49 typedef PolyFun type;
|
Chris@16
|
50 };
|
Chris@16
|
51
|
Chris@16
|
52 template<typename PolyFun , typename A0 , typename A1>
|
Chris@16
|
53 struct as_mono_function<PolyFun(A0 , A1)>
|
Chris@16
|
54 : as_mono_function_impl<PolyFun(A0 , A1), is_poly_function<PolyFun>::value>
|
Chris@16
|
55 {};
|
Chris@16
|
56
|
Chris@16
|
57 template<typename PolyFun , typename A0 , typename A1 , typename A2>
|
Chris@16
|
58 struct poly_function_traits<PolyFun, PolyFun(A0 , A1 , A2), mpl::size_t<sizeof(poly_function_t)> >
|
Chris@16
|
59 {
|
Chris@16
|
60 typedef typename PolyFun::template impl<const A0 , const A1 , const A2> function_type;
|
Chris@16
|
61 typedef typename function_type::result_type result_type;
|
Chris@16
|
62 };
|
Chris@16
|
63
|
Chris@16
|
64 template<typename PolyFun , typename A0 , typename A1 , typename A2>
|
Chris@16
|
65 struct as_mono_function_impl<PolyFun(A0 , A1 , A2), true>
|
Chris@16
|
66 {
|
Chris@16
|
67 typedef typename PolyFun::template impl<const A0 , const A1 , const A2> type;
|
Chris@16
|
68 };
|
Chris@16
|
69
|
Chris@16
|
70 template<typename PolyFun , typename A0 , typename A1 , typename A2>
|
Chris@16
|
71 struct as_mono_function_impl<PolyFun(A0 , A1 , A2), false>
|
Chris@16
|
72 {
|
Chris@16
|
73 typedef PolyFun type;
|
Chris@16
|
74 };
|
Chris@16
|
75
|
Chris@16
|
76 template<typename PolyFun , typename A0 , typename A1 , typename A2>
|
Chris@16
|
77 struct as_mono_function<PolyFun(A0 , A1 , A2)>
|
Chris@16
|
78 : as_mono_function_impl<PolyFun(A0 , A1 , A2), is_poly_function<PolyFun>::value>
|
Chris@16
|
79 {};
|
Chris@16
|
80
|
Chris@16
|
81 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3>
|
Chris@16
|
82 struct poly_function_traits<PolyFun, PolyFun(A0 , A1 , A2 , A3), mpl::size_t<sizeof(poly_function_t)> >
|
Chris@16
|
83 {
|
Chris@16
|
84 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3> function_type;
|
Chris@16
|
85 typedef typename function_type::result_type result_type;
|
Chris@16
|
86 };
|
Chris@16
|
87
|
Chris@16
|
88 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3>
|
Chris@16
|
89 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3), true>
|
Chris@16
|
90 {
|
Chris@16
|
91 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3> type;
|
Chris@16
|
92 };
|
Chris@16
|
93
|
Chris@16
|
94 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3>
|
Chris@16
|
95 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3), false>
|
Chris@16
|
96 {
|
Chris@16
|
97 typedef PolyFun type;
|
Chris@16
|
98 };
|
Chris@16
|
99
|
Chris@16
|
100 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3>
|
Chris@16
|
101 struct as_mono_function<PolyFun(A0 , A1 , A2 , A3)>
|
Chris@16
|
102 : as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3), is_poly_function<PolyFun>::value>
|
Chris@16
|
103 {};
|
Chris@16
|
104
|
Chris@16
|
105 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
Chris@16
|
106 struct poly_function_traits<PolyFun, PolyFun(A0 , A1 , A2 , A3 , A4), mpl::size_t<sizeof(poly_function_t)> >
|
Chris@16
|
107 {
|
Chris@16
|
108 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4> function_type;
|
Chris@16
|
109 typedef typename function_type::result_type result_type;
|
Chris@16
|
110 };
|
Chris@16
|
111
|
Chris@16
|
112 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
Chris@16
|
113 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4), true>
|
Chris@16
|
114 {
|
Chris@16
|
115 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4> type;
|
Chris@16
|
116 };
|
Chris@16
|
117
|
Chris@16
|
118 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
Chris@16
|
119 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4), false>
|
Chris@16
|
120 {
|
Chris@16
|
121 typedef PolyFun type;
|
Chris@16
|
122 };
|
Chris@16
|
123
|
Chris@16
|
124 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
|
Chris@16
|
125 struct as_mono_function<PolyFun(A0 , A1 , A2 , A3 , A4)>
|
Chris@16
|
126 : as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4), is_poly_function<PolyFun>::value>
|
Chris@16
|
127 {};
|
Chris@16
|
128
|
Chris@16
|
129 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
Chris@16
|
130 struct poly_function_traits<PolyFun, PolyFun(A0 , A1 , A2 , A3 , A4 , A5), mpl::size_t<sizeof(poly_function_t)> >
|
Chris@16
|
131 {
|
Chris@16
|
132 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5> function_type;
|
Chris@16
|
133 typedef typename function_type::result_type result_type;
|
Chris@16
|
134 };
|
Chris@16
|
135
|
Chris@16
|
136 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
Chris@16
|
137 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5), true>
|
Chris@16
|
138 {
|
Chris@16
|
139 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5> type;
|
Chris@16
|
140 };
|
Chris@16
|
141
|
Chris@16
|
142 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
Chris@16
|
143 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5), false>
|
Chris@16
|
144 {
|
Chris@16
|
145 typedef PolyFun type;
|
Chris@16
|
146 };
|
Chris@16
|
147
|
Chris@16
|
148 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
|
Chris@16
|
149 struct as_mono_function<PolyFun(A0 , A1 , A2 , A3 , A4 , A5)>
|
Chris@16
|
150 : as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5), is_poly_function<PolyFun>::value>
|
Chris@16
|
151 {};
|
Chris@16
|
152
|
Chris@16
|
153 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
Chris@16
|
154 struct poly_function_traits<PolyFun, PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6), mpl::size_t<sizeof(poly_function_t)> >
|
Chris@16
|
155 {
|
Chris@16
|
156 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6> function_type;
|
Chris@16
|
157 typedef typename function_type::result_type result_type;
|
Chris@16
|
158 };
|
Chris@16
|
159
|
Chris@16
|
160 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
Chris@16
|
161 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6), true>
|
Chris@16
|
162 {
|
Chris@16
|
163 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6> type;
|
Chris@16
|
164 };
|
Chris@16
|
165
|
Chris@16
|
166 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
Chris@16
|
167 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6), false>
|
Chris@16
|
168 {
|
Chris@16
|
169 typedef PolyFun type;
|
Chris@16
|
170 };
|
Chris@16
|
171
|
Chris@16
|
172 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
|
Chris@16
|
173 struct as_mono_function<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6)>
|
Chris@16
|
174 : as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6), is_poly_function<PolyFun>::value>
|
Chris@16
|
175 {};
|
Chris@16
|
176
|
Chris@16
|
177 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
Chris@16
|
178 struct poly_function_traits<PolyFun, PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7), mpl::size_t<sizeof(poly_function_t)> >
|
Chris@16
|
179 {
|
Chris@16
|
180 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7> function_type;
|
Chris@16
|
181 typedef typename function_type::result_type result_type;
|
Chris@16
|
182 };
|
Chris@16
|
183
|
Chris@16
|
184 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
Chris@16
|
185 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7), true>
|
Chris@16
|
186 {
|
Chris@16
|
187 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7> type;
|
Chris@16
|
188 };
|
Chris@16
|
189
|
Chris@16
|
190 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
Chris@16
|
191 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7), false>
|
Chris@16
|
192 {
|
Chris@16
|
193 typedef PolyFun type;
|
Chris@16
|
194 };
|
Chris@16
|
195
|
Chris@16
|
196 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
|
Chris@16
|
197 struct as_mono_function<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7)>
|
Chris@16
|
198 : as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7), is_poly_function<PolyFun>::value>
|
Chris@16
|
199 {};
|
Chris@16
|
200
|
Chris@16
|
201 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
Chris@16
|
202 struct poly_function_traits<PolyFun, PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8), mpl::size_t<sizeof(poly_function_t)> >
|
Chris@16
|
203 {
|
Chris@16
|
204 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7 , const A8> function_type;
|
Chris@16
|
205 typedef typename function_type::result_type result_type;
|
Chris@16
|
206 };
|
Chris@16
|
207
|
Chris@16
|
208 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
Chris@16
|
209 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8), true>
|
Chris@16
|
210 {
|
Chris@16
|
211 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7 , const A8> type;
|
Chris@16
|
212 };
|
Chris@16
|
213
|
Chris@16
|
214 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
Chris@16
|
215 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8), false>
|
Chris@16
|
216 {
|
Chris@16
|
217 typedef PolyFun type;
|
Chris@16
|
218 };
|
Chris@16
|
219
|
Chris@16
|
220 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
|
Chris@16
|
221 struct as_mono_function<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8)>
|
Chris@16
|
222 : as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8), is_poly_function<PolyFun>::value>
|
Chris@16
|
223 {};
|
Chris@16
|
224
|
Chris@16
|
225 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
Chris@16
|
226 struct poly_function_traits<PolyFun, PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9), mpl::size_t<sizeof(poly_function_t)> >
|
Chris@16
|
227 {
|
Chris@16
|
228 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7 , const A8 , const A9> function_type;
|
Chris@16
|
229 typedef typename function_type::result_type result_type;
|
Chris@16
|
230 };
|
Chris@16
|
231
|
Chris@16
|
232 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
Chris@16
|
233 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9), true>
|
Chris@16
|
234 {
|
Chris@16
|
235 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7 , const A8 , const A9> type;
|
Chris@16
|
236 };
|
Chris@16
|
237
|
Chris@16
|
238 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
Chris@16
|
239 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9), false>
|
Chris@16
|
240 {
|
Chris@16
|
241 typedef PolyFun type;
|
Chris@16
|
242 };
|
Chris@16
|
243
|
Chris@16
|
244 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
|
Chris@16
|
245 struct as_mono_function<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9)>
|
Chris@16
|
246 : as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9), is_poly_function<PolyFun>::value>
|
Chris@16
|
247 {};
|