and_n.hpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. ///////////////////////////////////////////////////////////////////////////////
  2. /// \file and_n.hpp
  3. /// Definitions of and_N, and_impl
  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. template<bool B, typename P0>
  9. struct and_2
  10. : mpl::bool_<P0::value>
  11. {};
  12. template<typename P0>
  13. struct and_2<false, P0>
  14. : mpl::false_
  15. {};
  16. template<typename G0 , typename G1, typename Expr, typename State, typename Data>
  17. struct _and_impl<proto::and_<G0 , G1>, Expr, State, Data>
  18. : proto::transform_impl<Expr, State, Data>
  19. {
  20. typedef typename proto::when<proto::_, G0> ::template impl<Expr, State, Data> Gimpl0; typedef typename proto::when<proto::_, G1> ::template impl<Expr, State, Data> Gimpl1;
  21. typedef typename Gimpl1::result_type result_type;
  22. result_type operator()(
  23. typename _and_impl::expr_param e
  24. , typename _and_impl::state_param s
  25. , typename _and_impl::data_param d
  26. ) const
  27. {
  28. Gimpl0()(e,s,d);
  29. return Gimpl1()(e,s,d);
  30. }
  31. };
  32. template<bool B, typename P0 , typename P1>
  33. struct and_3
  34. : and_2<
  35. P0::value ,
  36. P1
  37. >
  38. {};
  39. template<typename P0 , typename P1>
  40. struct and_3<false, P0 , P1>
  41. : mpl::false_
  42. {};
  43. template<typename G0 , typename G1 , typename G2, typename Expr, typename State, typename Data>
  44. struct _and_impl<proto::and_<G0 , G1 , G2>, Expr, State, Data>
  45. : proto::transform_impl<Expr, State, Data>
  46. {
  47. typedef typename proto::when<proto::_, G0> ::template impl<Expr, State, Data> Gimpl0; typedef typename proto::when<proto::_, G1> ::template impl<Expr, State, Data> Gimpl1; typedef typename proto::when<proto::_, G2> ::template impl<Expr, State, Data> Gimpl2;
  48. typedef typename Gimpl2::result_type result_type;
  49. result_type operator()(
  50. typename _and_impl::expr_param e
  51. , typename _and_impl::state_param s
  52. , typename _and_impl::data_param d
  53. ) const
  54. {
  55. Gimpl0()(e,s,d); Gimpl1()(e,s,d);
  56. return Gimpl2()(e,s,d);
  57. }
  58. };
  59. template<bool B, typename P0 , typename P1 , typename P2>
  60. struct and_4
  61. : and_3<
  62. P0::value ,
  63. P1 , P2
  64. >
  65. {};
  66. template<typename P0 , typename P1 , typename P2>
  67. struct and_4<false, P0 , P1 , P2>
  68. : mpl::false_
  69. {};
  70. template<typename G0 , typename G1 , typename G2 , typename G3, typename Expr, typename State, typename Data>
  71. struct _and_impl<proto::and_<G0 , G1 , G2 , G3>, Expr, State, Data>
  72. : proto::transform_impl<Expr, State, Data>
  73. {
  74. typedef typename proto::when<proto::_, G0> ::template impl<Expr, State, Data> Gimpl0; typedef typename proto::when<proto::_, G1> ::template impl<Expr, State, Data> Gimpl1; typedef typename proto::when<proto::_, G2> ::template impl<Expr, State, Data> Gimpl2; typedef typename proto::when<proto::_, G3> ::template impl<Expr, State, Data> Gimpl3;
  75. typedef typename Gimpl3::result_type result_type;
  76. result_type operator()(
  77. typename _and_impl::expr_param e
  78. , typename _and_impl::state_param s
  79. , typename _and_impl::data_param d
  80. ) const
  81. {
  82. Gimpl0()(e,s,d); Gimpl1()(e,s,d); Gimpl2()(e,s,d);
  83. return Gimpl3()(e,s,d);
  84. }
  85. };
  86. template<bool B, typename P0 , typename P1 , typename P2 , typename P3>
  87. struct and_5
  88. : and_4<
  89. P0::value ,
  90. P1 , P2 , P3
  91. >
  92. {};
  93. template<typename P0 , typename P1 , typename P2 , typename P3>
  94. struct and_5<false, P0 , P1 , P2 , P3>
  95. : mpl::false_
  96. {};
  97. template<typename G0 , typename G1 , typename G2 , typename G3 , typename G4, typename Expr, typename State, typename Data>
  98. struct _and_impl<proto::and_<G0 , G1 , G2 , G3 , G4>, Expr, State, Data>
  99. : proto::transform_impl<Expr, State, Data>
  100. {
  101. typedef typename proto::when<proto::_, G0> ::template impl<Expr, State, Data> Gimpl0; typedef typename proto::when<proto::_, G1> ::template impl<Expr, State, Data> Gimpl1; typedef typename proto::when<proto::_, G2> ::template impl<Expr, State, Data> Gimpl2; typedef typename proto::when<proto::_, G3> ::template impl<Expr, State, Data> Gimpl3; typedef typename proto::when<proto::_, G4> ::template impl<Expr, State, Data> Gimpl4;
  102. typedef typename Gimpl4::result_type result_type;
  103. result_type operator()(
  104. typename _and_impl::expr_param e
  105. , typename _and_impl::state_param s
  106. , typename _and_impl::data_param d
  107. ) const
  108. {
  109. Gimpl0()(e,s,d); Gimpl1()(e,s,d); Gimpl2()(e,s,d); Gimpl3()(e,s,d);
  110. return Gimpl4()(e,s,d);
  111. }
  112. };
  113. template<bool B, typename P0 , typename P1 , typename P2 , typename P3 , typename P4>
  114. struct and_6
  115. : and_5<
  116. P0::value ,
  117. P1 , P2 , P3 , P4
  118. >
  119. {};
  120. template<typename P0 , typename P1 , typename P2 , typename P3 , typename P4>
  121. struct and_6<false, P0 , P1 , P2 , P3 , P4>
  122. : mpl::false_
  123. {};
  124. template<typename G0 , typename G1 , typename G2 , typename G3 , typename G4 , typename G5, typename Expr, typename State, typename Data>
  125. struct _and_impl<proto::and_<G0 , G1 , G2 , G3 , G4 , G5>, Expr, State, Data>
  126. : proto::transform_impl<Expr, State, Data>
  127. {
  128. typedef typename proto::when<proto::_, G0> ::template impl<Expr, State, Data> Gimpl0; typedef typename proto::when<proto::_, G1> ::template impl<Expr, State, Data> Gimpl1; typedef typename proto::when<proto::_, G2> ::template impl<Expr, State, Data> Gimpl2; typedef typename proto::when<proto::_, G3> ::template impl<Expr, State, Data> Gimpl3; typedef typename proto::when<proto::_, G4> ::template impl<Expr, State, Data> Gimpl4; typedef typename proto::when<proto::_, G5> ::template impl<Expr, State, Data> Gimpl5;
  129. typedef typename Gimpl5::result_type result_type;
  130. result_type operator()(
  131. typename _and_impl::expr_param e
  132. , typename _and_impl::state_param s
  133. , typename _and_impl::data_param d
  134. ) const
  135. {
  136. Gimpl0()(e,s,d); Gimpl1()(e,s,d); Gimpl2()(e,s,d); Gimpl3()(e,s,d); Gimpl4()(e,s,d);
  137. return Gimpl5()(e,s,d);
  138. }
  139. };
  140. template<bool B, typename P0 , typename P1 , typename P2 , typename P3 , typename P4 , typename P5>
  141. struct and_7
  142. : and_6<
  143. P0::value ,
  144. P1 , P2 , P3 , P4 , P5
  145. >
  146. {};
  147. template<typename P0 , typename P1 , typename P2 , typename P3 , typename P4 , typename P5>
  148. struct and_7<false, P0 , P1 , P2 , P3 , P4 , P5>
  149. : mpl::false_
  150. {};
  151. template<typename G0 , typename G1 , typename G2 , typename G3 , typename G4 , typename G5 , typename G6, typename Expr, typename State, typename Data>
  152. struct _and_impl<proto::and_<G0 , G1 , G2 , G3 , G4 , G5 , G6>, Expr, State, Data>
  153. : proto::transform_impl<Expr, State, Data>
  154. {
  155. typedef typename proto::when<proto::_, G0> ::template impl<Expr, State, Data> Gimpl0; typedef typename proto::when<proto::_, G1> ::template impl<Expr, State, Data> Gimpl1; typedef typename proto::when<proto::_, G2> ::template impl<Expr, State, Data> Gimpl2; typedef typename proto::when<proto::_, G3> ::template impl<Expr, State, Data> Gimpl3; typedef typename proto::when<proto::_, G4> ::template impl<Expr, State, Data> Gimpl4; typedef typename proto::when<proto::_, G5> ::template impl<Expr, State, Data> Gimpl5; typedef typename proto::when<proto::_, G6> ::template impl<Expr, State, Data> Gimpl6;
  156. typedef typename Gimpl6::result_type result_type;
  157. result_type operator()(
  158. typename _and_impl::expr_param e
  159. , typename _and_impl::state_param s
  160. , typename _and_impl::data_param d
  161. ) const
  162. {
  163. Gimpl0()(e,s,d); Gimpl1()(e,s,d); Gimpl2()(e,s,d); Gimpl3()(e,s,d); Gimpl4()(e,s,d); Gimpl5()(e,s,d);
  164. return Gimpl6()(e,s,d);
  165. }
  166. };
  167. template<bool B, typename P0 , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6>
  168. struct and_8
  169. : and_7<
  170. P0::value ,
  171. P1 , P2 , P3 , P4 , P5 , P6
  172. >
  173. {};
  174. template<typename P0 , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6>
  175. struct and_8<false, P0 , P1 , P2 , P3 , P4 , P5 , P6>
  176. : mpl::false_
  177. {};
  178. template<typename G0 , typename G1 , typename G2 , typename G3 , typename G4 , typename G5 , typename G6 , typename G7, typename Expr, typename State, typename Data>
  179. struct _and_impl<proto::and_<G0 , G1 , G2 , G3 , G4 , G5 , G6 , G7>, Expr, State, Data>
  180. : proto::transform_impl<Expr, State, Data>
  181. {
  182. typedef typename proto::when<proto::_, G0> ::template impl<Expr, State, Data> Gimpl0; typedef typename proto::when<proto::_, G1> ::template impl<Expr, State, Data> Gimpl1; typedef typename proto::when<proto::_, G2> ::template impl<Expr, State, Data> Gimpl2; typedef typename proto::when<proto::_, G3> ::template impl<Expr, State, Data> Gimpl3; typedef typename proto::when<proto::_, G4> ::template impl<Expr, State, Data> Gimpl4; typedef typename proto::when<proto::_, G5> ::template impl<Expr, State, Data> Gimpl5; typedef typename proto::when<proto::_, G6> ::template impl<Expr, State, Data> Gimpl6; typedef typename proto::when<proto::_, G7> ::template impl<Expr, State, Data> Gimpl7;
  183. typedef typename Gimpl7::result_type result_type;
  184. result_type operator()(
  185. typename _and_impl::expr_param e
  186. , typename _and_impl::state_param s
  187. , typename _and_impl::data_param d
  188. ) const
  189. {
  190. Gimpl0()(e,s,d); Gimpl1()(e,s,d); Gimpl2()(e,s,d); Gimpl3()(e,s,d); Gimpl4()(e,s,d); Gimpl5()(e,s,d); Gimpl6()(e,s,d);
  191. return Gimpl7()(e,s,d);
  192. }
  193. };
  194. template<bool B, typename P0 , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7>
  195. struct and_9
  196. : and_8<
  197. P0::value ,
  198. P1 , P2 , P3 , P4 , P5 , P6 , P7
  199. >
  200. {};
  201. template<typename P0 , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7>
  202. struct and_9<false, P0 , P1 , P2 , P3 , P4 , P5 , P6 , P7>
  203. : mpl::false_
  204. {};
  205. template<typename G0 , typename G1 , typename G2 , typename G3 , typename G4 , typename G5 , typename G6 , typename G7 , typename G8, typename Expr, typename State, typename Data>
  206. struct _and_impl<proto::and_<G0 , G1 , G2 , G3 , G4 , G5 , G6 , G7 , G8>, Expr, State, Data>
  207. : proto::transform_impl<Expr, State, Data>
  208. {
  209. typedef typename proto::when<proto::_, G0> ::template impl<Expr, State, Data> Gimpl0; typedef typename proto::when<proto::_, G1> ::template impl<Expr, State, Data> Gimpl1; typedef typename proto::when<proto::_, G2> ::template impl<Expr, State, Data> Gimpl2; typedef typename proto::when<proto::_, G3> ::template impl<Expr, State, Data> Gimpl3; typedef typename proto::when<proto::_, G4> ::template impl<Expr, State, Data> Gimpl4; typedef typename proto::when<proto::_, G5> ::template impl<Expr, State, Data> Gimpl5; typedef typename proto::when<proto::_, G6> ::template impl<Expr, State, Data> Gimpl6; typedef typename proto::when<proto::_, G7> ::template impl<Expr, State, Data> Gimpl7; typedef typename proto::when<proto::_, G8> ::template impl<Expr, State, Data> Gimpl8;
  210. typedef typename Gimpl8::result_type result_type;
  211. result_type operator()(
  212. typename _and_impl::expr_param e
  213. , typename _and_impl::state_param s
  214. , typename _and_impl::data_param d
  215. ) const
  216. {
  217. Gimpl0()(e,s,d); Gimpl1()(e,s,d); Gimpl2()(e,s,d); Gimpl3()(e,s,d); Gimpl4()(e,s,d); Gimpl5()(e,s,d); Gimpl6()(e,s,d); Gimpl7()(e,s,d);
  218. return Gimpl8()(e,s,d);
  219. }
  220. };
  221. template<bool B, typename P0 , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8>
  222. struct and_10
  223. : and_9<
  224. P0::value ,
  225. P1 , P2 , P3 , P4 , P5 , P6 , P7 , P8
  226. >
  227. {};
  228. template<typename P0 , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8>
  229. struct and_10<false, P0 , P1 , P2 , P3 , P4 , P5 , P6 , P7 , P8>
  230. : mpl::false_
  231. {};
  232. template<typename G0 , typename G1 , typename G2 , typename G3 , typename G4 , typename G5 , typename G6 , typename G7 , typename G8 , typename G9, typename Expr, typename State, typename Data>
  233. struct _and_impl<proto::and_<G0 , G1 , G2 , G3 , G4 , G5 , G6 , G7 , G8 , G9>, Expr, State, Data>
  234. : proto::transform_impl<Expr, State, Data>
  235. {
  236. typedef typename proto::when<proto::_, G0> ::template impl<Expr, State, Data> Gimpl0; typedef typename proto::when<proto::_, G1> ::template impl<Expr, State, Data> Gimpl1; typedef typename proto::when<proto::_, G2> ::template impl<Expr, State, Data> Gimpl2; typedef typename proto::when<proto::_, G3> ::template impl<Expr, State, Data> Gimpl3; typedef typename proto::when<proto::_, G4> ::template impl<Expr, State, Data> Gimpl4; typedef typename proto::when<proto::_, G5> ::template impl<Expr, State, Data> Gimpl5; typedef typename proto::when<proto::_, G6> ::template impl<Expr, State, Data> Gimpl6; typedef typename proto::when<proto::_, G7> ::template impl<Expr, State, Data> Gimpl7; typedef typename proto::when<proto::_, G8> ::template impl<Expr, State, Data> Gimpl8; typedef typename proto::when<proto::_, G9> ::template impl<Expr, State, Data> Gimpl9;
  237. typedef typename Gimpl9::result_type result_type;
  238. result_type operator()(
  239. typename _and_impl::expr_param e
  240. , typename _and_impl::state_param s
  241. , typename _and_impl::data_param d
  242. ) const
  243. {
  244. Gimpl0()(e,s,d); Gimpl1()(e,s,d); Gimpl2()(e,s,d); Gimpl3()(e,s,d); Gimpl4()(e,s,d); Gimpl5()(e,s,d); Gimpl6()(e,s,d); Gimpl7()(e,s,d); Gimpl8()(e,s,d);
  245. return Gimpl9()(e,s,d);
  246. }
  247. };