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