member_function_ptr_10.hpp 11 KB

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