7 #ifndef _QITYPE_DETAIL_BINDTYPE_HXX_
8 #define _QITYPE_DETAIL_BINDTYPE_HXX_
10 #include <boost/mpl/find_if.hpp>
11 #include <boost/mpl/vector.hpp>
12 #include <boost/mpl/at.hpp>
13 #include <boost/mpl/placeholders.hpp>
14 #include <boost/mpl/max_element.hpp>
15 #include <boost/mpl/transform.hpp>
16 #include <boost/function_types/parameter_types.hpp>
17 #include <boost/function_types/function_type.hpp>
18 #include <boost/function_types/function_pointer.hpp>
19 #include <boost/bind.hpp>
20 #include <boost/any.hpp>
31 template<
int I,
typename P>
42 template<
int I,
typename P>
52 template<
typename F,
int P,
typename bilistarg>
57 template<
typename F,
int P,
typename V>
63 template<
typename F,
int P,
int I>
64 struct ArgResolver<F, P, boost::arg<I> >
66 using type = MappingItem<I,
67 typename boost::mpl::at_c<
68 typename boost::function_types::parameter_types<F>::type,
77 template<
typename A,
typename B>
80 using type = boost::true_type;
83 template<
typename A,
int I,
typename B>
84 struct ArgLess<A, MappingItem<I, B> >
86 using type = boost::true_type;
89 template<
typename A,
int I,
typename B>
90 struct ArgLess<MappingItem<I, B>, A>
92 using type = boost::false_type;
95 template<
int I1,
typename V1,
int I2,
typename V2>
96 struct ArgLess<MappingItem<I1, V1>, MappingItem<I2, V2> >
98 using type =
typename boost::mpl::less<boost::mpl::long_<I1>, boost::mpl::long_<I2> >::type;
104 template<
typename A,
typename B>
105 struct MapItemIndexIs
107 using type = boost::false_type;
110 template<
typename T,
int B>
111 struct MapItemIndexIs<MappingItem<B, T>, boost::mpl::long_<B> >
113 using type = boost::true_type;
119 template<
int I,
typename Map>
122 using type =
typename boost::mpl::push_back<
124 typename boost::mpl::deref<
typename boost::mpl::find_if<
126 MapItemIndexIs<boost::mpl::_1, boost::mpl::long_<I> >
131 template<
typename Map>
134 using type = boost::mpl::vector<
135 typename boost::mpl::deref<
typename boost::mpl::find_if<
137 MapItemIndexIs<boost::mpl::_1, boost::mpl::long_<1> >
141 template<
typename Map>
144 using type = boost::mpl::vector<>;
156 template<
typename T,
int I>
165 template<
int idx,
typename F,
typename V>
168 using type =
typename boost::mpl::push_back<
174 template<
typename F,
typename V>
177 using type =
typename boost::mpl::vector<
182 template<
typename F,
typename S>
188 template<
typename T>
struct BilistToSeq
190 using type = boost::mpl::vector<>;
193 template<
typename P1>
194 struct BilistToSeq<boost::_bi::list1<P1> >
196 using type =
typename boost::mpl::vector<P1>;
199 template<
typename P1,
typename P2>
200 struct BilistToSeq<boost::_bi::list2<P1, P2> >
202 using type =
typename boost::mpl::vector<P1, P2>;
205 template<
typename P1,
typename P2,
typename P3>
206 struct BilistToSeq<boost::_bi::list3<P1, P2, P3> >
208 using type =
typename boost::mpl::vector<P1, P2, P3>;
211 template<
typename P1,
typename P2,
typename P3,
typename P4>
212 struct BilistToSeq<boost::_bi::list4<P1, P2, P3, P4> >
214 using type =
typename boost::mpl::vector<P1, P2, P3, P4>;
217 template<
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
218 struct BilistToSeq<boost::_bi::list5<P1, P2, P3, P4, P5> >
220 using type =
typename boost::mpl::vector<P1, P2, P3, P4, P5>;
223 template<
typename F,
typename BL>
226 using BLSeq =
typename BilistToSeq<BL>::type;
230 using MaxArg =
typename boost::mpl::deref<typename boost::mpl::max_element<Mapping, ArgLess<boost::mpl::_1, boost::mpl::_2> >
::type>
::type;
235 using type =
typename boost::mpl::transform<Reordered, MappingToType<boost::mpl::_1> >
::type;
240 template<
typename R,
typename A,
typename B>
247 template<
typename R,
typename F,
typename B>
258 using type =
typename boost::function_types::function_type<
259 typename boost::mpl::push_front<
264 using pointer_type =
typename boost::function_types::function_pointer<
265 typename boost::mpl::push_front<
273 #endif // _QITYPE_DETAIL_BINDTYPE_HXX_
typename boost::mpl::push_back< typename MappingBuilder< idx-1, F, V >::type, typename ArgResolver< F, idx, typename boost::mpl::at_c< V, idx >::type >::type >::type type
typename boost::function_types::function_type< typename boost::mpl::push_front< typename boost_bind_parameter_types< T >::type, typename boost_bind_result_type< T >::type >::type >::type type
typename parameter_types_from_bilist_seq< F, BLSeq >::type Mapping
typename boost::mpl::deref< typename boost::mpl::max_element< Mapping, ArgLess< boost::mpl::_1, boost::mpl::_2 > >::type >::type MaxArg
typename ReorderMapping< IntFromMappingItem< MaxArg >::value, Mapping >::type Reordered
typename MappingBuilder< boost::mpl::size< S >::type::value-1, F, S >::type type
boost::mpl::vector<> type
typename boost::mpl::transform< Reordered, MappingToType< boost::mpl::_1 > >::type type
typename boost::mpl::push_back< typename ReorderMapping< I-1, Map >::type, typename boost::mpl::deref< typename boost::mpl::find_if< Map, MapItemIndexIs< boost::mpl::_1, boost::mpl::long_< I > > >::type >::type >::type type
typename boost::mpl::vector< typename ArgResolver< F, 0, typename boost::mpl::at_c< V, 0 >::type >::type > type
boost::mpl::vector< typename boost::mpl::deref< typename boost::mpl::find_if< Map, MapItemIndexIs< boost::mpl::_1, boost::mpl::long_< 1 > > >::type >::type > type
typename BilistToSeq< BL >::type BLSeq
typename boost::function_types::function_pointer< typename boost::mpl::push_front< typename boost_bind_parameter_types< T >::type, typename boost_bind_result_type< T >::type >::type >::type pointer_type