1 ///////////////////////////////////////////////////////////////////////////////
2 // poly_function_traits.hpp
3 // Contains specializations of poly_function_traits and as_mono_function
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)
9 template<typename PolyFun , typename A0>
10 struct poly_function_traits<PolyFun, PolyFun(A0), mpl::size_t<sizeof(poly_function_t)> >
12 typedef typename PolyFun::template impl<const A0> function_type;
13 typedef typename function_type::result_type result_type;
16 template<typename PolyFun , typename A0>
17 struct as_mono_function_impl<PolyFun(A0), true>
19 typedef typename PolyFun::template impl<const A0> type;
22 template<typename PolyFun , typename A0>
23 struct as_mono_function_impl<PolyFun(A0), false>
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>
33 template<typename PolyFun , typename A0 , typename A1>
34 struct poly_function_traits<PolyFun, PolyFun(A0 , A1), mpl::size_t<sizeof(poly_function_t)> >
36 typedef typename PolyFun::template impl<const A0 , const A1> function_type;
37 typedef typename function_type::result_type result_type;
40 template<typename PolyFun , typename A0 , typename A1>
41 struct as_mono_function_impl<PolyFun(A0 , A1), true>
43 typedef typename PolyFun::template impl<const A0 , const A1> type;
46 template<typename PolyFun , typename A0 , typename A1>
47 struct as_mono_function_impl<PolyFun(A0 , A1), false>
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>
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)> >
60 typedef typename PolyFun::template impl<const A0 , const A1 , const A2> function_type;
61 typedef typename function_type::result_type result_type;
64 template<typename PolyFun , typename A0 , typename A1 , typename A2>
65 struct as_mono_function_impl<PolyFun(A0 , A1 , A2), true>
67 typedef typename PolyFun::template impl<const A0 , const A1 , const A2> type;
70 template<typename PolyFun , typename A0 , typename A1 , typename A2>
71 struct as_mono_function_impl<PolyFun(A0 , A1 , A2), false>
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>
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)> >
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;
88 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3>
89 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3), true>
91 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3> type;
94 template<typename PolyFun , typename A0 , typename A1 , typename A2 , typename A3>
95 struct as_mono_function_impl<PolyFun(A0 , A1 , A2 , A3), false>
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>
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)> >
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;
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>
115 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4> type;
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>
121 typedef PolyFun type;
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>
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)> >
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;
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>
139 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5> type;
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>
145 typedef PolyFun type;
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>
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)> >
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;
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>
163 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6> type;
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>
169 typedef PolyFun type;
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>
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)> >
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;
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>
187 typedef typename PolyFun::template impl<const A0 , const A1 , const A2 , const A3 , const A4 , const A5 , const A6 , const A7> type;
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>
193 typedef PolyFun type;
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>
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)> >
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;
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>
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;
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>
217 typedef PolyFun type;
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>
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)> >
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;
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>
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;
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>
241 typedef PolyFun type;
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>