traits.hpp 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487
  1. ///////////////////////////////////////////////////////////////////////////////
  2. /// \file traits.hpp
  3. /// Definitions of proto::function, proto::nary_expr and proto::result_of::child_c
  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. namespace result_of
  9. {
  10. template<typename Expr>
  11. struct child_c<Expr, 0>
  12. {
  13. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  14. typedef typename Expr::proto_child0 value_type;
  15. typedef typename detail::expr_traits<typename Expr::proto_child0>::value_type type;
  16. };
  17. template<typename Expr>
  18. struct child_c<Expr &, 0>
  19. {
  20. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  21. typedef typename Expr::proto_child0 value_type;
  22. typedef typename detail::expr_traits<typename Expr::proto_child0>::reference type;
  23. BOOST_FORCEINLINE
  24. static type call(Expr &e)
  25. {
  26. return e.proto_base().child0;
  27. }
  28. };
  29. template<typename Expr>
  30. struct child_c<Expr const &, 0>
  31. {
  32. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  33. typedef typename Expr::proto_child0 value_type;
  34. typedef typename detail::expr_traits<typename Expr::proto_child0>::const_reference type;
  35. BOOST_FORCEINLINE
  36. static type call(Expr const &e)
  37. {
  38. return e.proto_base().child0;
  39. }
  40. };
  41. }
  42. template<typename A0>
  43. struct function
  44. <
  45. A0
  46. , void , void , void , void , void , void , void , void , void
  47. >
  48. : proto::transform<
  49. function<
  50. A0
  51. , void , void , void , void , void , void , void , void , void
  52. >
  53. , int
  54. >
  55. {
  56. typedef proto::expr<proto::tag::function, list1<A0>, 1> type;
  57. typedef proto::basic_expr<proto::tag::function, list1<A0>, 1> proto_grammar;
  58. template<typename Expr, typename State, typename Data>
  59. struct impl
  60. : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
  61. {};
  62. typedef proto::tag::function proto_tag;
  63. typedef A0 proto_child0;
  64. typedef detail::if_vararg<A0> proto_child1; typedef detail::if_vararg<A0> proto_child2; typedef detail::if_vararg<A0> proto_child3; typedef detail::if_vararg<A0> proto_child4; typedef detail::if_vararg<A0> proto_child5; typedef detail::if_vararg<A0> proto_child6; typedef detail::if_vararg<A0> proto_child7; typedef detail::if_vararg<A0> proto_child8; typedef detail::if_vararg<A0> proto_child9;
  65. };
  66. template<typename Tag , typename A0>
  67. struct nary_expr
  68. <
  69. Tag
  70. , A0
  71. , void , void , void , void , void , void , void , void , void
  72. >
  73. : proto::transform<
  74. nary_expr<
  75. Tag
  76. , A0
  77. , void , void , void , void , void , void , void , void , void
  78. >
  79. , int
  80. >
  81. {
  82. typedef proto::expr<Tag, list1<A0>, 1> type;
  83. typedef proto::basic_expr<Tag, list1<A0>, 1> proto_grammar;
  84. template<typename Expr, typename State, typename Data>
  85. struct impl
  86. : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
  87. {};
  88. typedef Tag proto_tag;
  89. typedef A0 proto_child0;
  90. typedef detail::if_vararg<A0> proto_child1; typedef detail::if_vararg<A0> proto_child2; typedef detail::if_vararg<A0> proto_child3; typedef detail::if_vararg<A0> proto_child4; typedef detail::if_vararg<A0> proto_child5; typedef detail::if_vararg<A0> proto_child6; typedef detail::if_vararg<A0> proto_child7; typedef detail::if_vararg<A0> proto_child8; typedef detail::if_vararg<A0> proto_child9;
  91. };
  92. namespace detail
  93. {
  94. template<
  95. template<typename> class T
  96. , typename A0
  97. >
  98. struct is_callable_<T<A0> BOOST_PROTO_TEMPLATE_ARITY_PARAM(1)>
  99. : is_same<A0, callable>
  100. {};
  101. }
  102. namespace result_of
  103. {
  104. template<typename Expr>
  105. struct child_c<Expr, 1>
  106. {
  107. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  108. typedef typename Expr::proto_child1 value_type;
  109. typedef typename detail::expr_traits<typename Expr::proto_child1>::value_type type;
  110. };
  111. template<typename Expr>
  112. struct child_c<Expr &, 1>
  113. {
  114. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  115. typedef typename Expr::proto_child1 value_type;
  116. typedef typename detail::expr_traits<typename Expr::proto_child1>::reference type;
  117. BOOST_FORCEINLINE
  118. static type call(Expr &e)
  119. {
  120. return e.proto_base().child1;
  121. }
  122. };
  123. template<typename Expr>
  124. struct child_c<Expr const &, 1>
  125. {
  126. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  127. typedef typename Expr::proto_child1 value_type;
  128. typedef typename detail::expr_traits<typename Expr::proto_child1>::const_reference type;
  129. BOOST_FORCEINLINE
  130. static type call(Expr const &e)
  131. {
  132. return e.proto_base().child1;
  133. }
  134. };
  135. }
  136. template<typename A0 , typename A1>
  137. struct function
  138. <
  139. A0 , A1
  140. , void , void , void , void , void , void , void , void
  141. >
  142. : proto::transform<
  143. function<
  144. A0 , A1
  145. , void , void , void , void , void , void , void , void
  146. >
  147. , int
  148. >
  149. {
  150. typedef proto::expr<proto::tag::function, list2<A0 , A1>, 2> type;
  151. typedef proto::basic_expr<proto::tag::function, list2<A0 , A1>, 2> proto_grammar;
  152. template<typename Expr, typename State, typename Data>
  153. struct impl
  154. : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
  155. {};
  156. typedef proto::tag::function proto_tag;
  157. typedef A0 proto_child0; typedef A1 proto_child1;
  158. typedef detail::if_vararg<A1> proto_child2; typedef detail::if_vararg<A1> proto_child3; typedef detail::if_vararg<A1> proto_child4; typedef detail::if_vararg<A1> proto_child5; typedef detail::if_vararg<A1> proto_child6; typedef detail::if_vararg<A1> proto_child7; typedef detail::if_vararg<A1> proto_child8; typedef detail::if_vararg<A1> proto_child9;
  159. };
  160. template<typename Tag , typename A0 , typename A1>
  161. struct nary_expr
  162. <
  163. Tag
  164. , A0 , A1
  165. , void , void , void , void , void , void , void , void
  166. >
  167. : proto::transform<
  168. nary_expr<
  169. Tag
  170. , A0 , A1
  171. , void , void , void , void , void , void , void , void
  172. >
  173. , int
  174. >
  175. {
  176. typedef proto::expr<Tag, list2<A0 , A1>, 2> type;
  177. typedef proto::basic_expr<Tag, list2<A0 , A1>, 2> proto_grammar;
  178. template<typename Expr, typename State, typename Data>
  179. struct impl
  180. : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
  181. {};
  182. typedef Tag proto_tag;
  183. typedef A0 proto_child0; typedef A1 proto_child1;
  184. typedef detail::if_vararg<A1> proto_child2; typedef detail::if_vararg<A1> proto_child3; typedef detail::if_vararg<A1> proto_child4; typedef detail::if_vararg<A1> proto_child5; typedef detail::if_vararg<A1> proto_child6; typedef detail::if_vararg<A1> proto_child7; typedef detail::if_vararg<A1> proto_child8; typedef detail::if_vararg<A1> proto_child9;
  185. };
  186. namespace detail
  187. {
  188. template<
  189. template<typename , typename> class T
  190. , typename A0 , typename A1
  191. >
  192. struct is_callable_<T<A0 , A1> BOOST_PROTO_TEMPLATE_ARITY_PARAM(2)>
  193. : is_same<A1, callable>
  194. {};
  195. }
  196. namespace result_of
  197. {
  198. template<typename Expr>
  199. struct child_c<Expr, 2>
  200. {
  201. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  202. typedef typename Expr::proto_child2 value_type;
  203. typedef typename detail::expr_traits<typename Expr::proto_child2>::value_type type;
  204. };
  205. template<typename Expr>
  206. struct child_c<Expr &, 2>
  207. {
  208. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  209. typedef typename Expr::proto_child2 value_type;
  210. typedef typename detail::expr_traits<typename Expr::proto_child2>::reference type;
  211. BOOST_FORCEINLINE
  212. static type call(Expr &e)
  213. {
  214. return e.proto_base().child2;
  215. }
  216. };
  217. template<typename Expr>
  218. struct child_c<Expr const &, 2>
  219. {
  220. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  221. typedef typename Expr::proto_child2 value_type;
  222. typedef typename detail::expr_traits<typename Expr::proto_child2>::const_reference type;
  223. BOOST_FORCEINLINE
  224. static type call(Expr const &e)
  225. {
  226. return e.proto_base().child2;
  227. }
  228. };
  229. }
  230. template<typename A0 , typename A1 , typename A2>
  231. struct function
  232. <
  233. A0 , A1 , A2
  234. , void , void , void , void , void , void , void
  235. >
  236. : proto::transform<
  237. function<
  238. A0 , A1 , A2
  239. , void , void , void , void , void , void , void
  240. >
  241. , int
  242. >
  243. {
  244. typedef proto::expr<proto::tag::function, list3<A0 , A1 , A2>, 3> type;
  245. typedef proto::basic_expr<proto::tag::function, list3<A0 , A1 , A2>, 3> proto_grammar;
  246. template<typename Expr, typename State, typename Data>
  247. struct impl
  248. : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
  249. {};
  250. typedef proto::tag::function proto_tag;
  251. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2;
  252. typedef detail::if_vararg<A2> proto_child3; typedef detail::if_vararg<A2> proto_child4; typedef detail::if_vararg<A2> proto_child5; typedef detail::if_vararg<A2> proto_child6; typedef detail::if_vararg<A2> proto_child7; typedef detail::if_vararg<A2> proto_child8; typedef detail::if_vararg<A2> proto_child9;
  253. };
  254. template<typename Tag , typename A0 , typename A1 , typename A2>
  255. struct nary_expr
  256. <
  257. Tag
  258. , A0 , A1 , A2
  259. , void , void , void , void , void , void , void
  260. >
  261. : proto::transform<
  262. nary_expr<
  263. Tag
  264. , A0 , A1 , A2
  265. , void , void , void , void , void , void , void
  266. >
  267. , int
  268. >
  269. {
  270. typedef proto::expr<Tag, list3<A0 , A1 , A2>, 3> type;
  271. typedef proto::basic_expr<Tag, list3<A0 , A1 , A2>, 3> proto_grammar;
  272. template<typename Expr, typename State, typename Data>
  273. struct impl
  274. : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
  275. {};
  276. typedef Tag proto_tag;
  277. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2;
  278. typedef detail::if_vararg<A2> proto_child3; typedef detail::if_vararg<A2> proto_child4; typedef detail::if_vararg<A2> proto_child5; typedef detail::if_vararg<A2> proto_child6; typedef detail::if_vararg<A2> proto_child7; typedef detail::if_vararg<A2> proto_child8; typedef detail::if_vararg<A2> proto_child9;
  279. };
  280. namespace detail
  281. {
  282. template<
  283. template<typename , typename , typename> class T
  284. , typename A0 , typename A1 , typename A2
  285. >
  286. struct is_callable_<T<A0 , A1 , A2> BOOST_PROTO_TEMPLATE_ARITY_PARAM(3)>
  287. : is_same<A2, callable>
  288. {};
  289. }
  290. namespace result_of
  291. {
  292. template<typename Expr>
  293. struct child_c<Expr, 3>
  294. {
  295. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  296. typedef typename Expr::proto_child3 value_type;
  297. typedef typename detail::expr_traits<typename Expr::proto_child3>::value_type type;
  298. };
  299. template<typename Expr>
  300. struct child_c<Expr &, 3>
  301. {
  302. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  303. typedef typename Expr::proto_child3 value_type;
  304. typedef typename detail::expr_traits<typename Expr::proto_child3>::reference type;
  305. BOOST_FORCEINLINE
  306. static type call(Expr &e)
  307. {
  308. return e.proto_base().child3;
  309. }
  310. };
  311. template<typename Expr>
  312. struct child_c<Expr const &, 3>
  313. {
  314. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  315. typedef typename Expr::proto_child3 value_type;
  316. typedef typename detail::expr_traits<typename Expr::proto_child3>::const_reference type;
  317. BOOST_FORCEINLINE
  318. static type call(Expr const &e)
  319. {
  320. return e.proto_base().child3;
  321. }
  322. };
  323. }
  324. template<typename A0 , typename A1 , typename A2 , typename A3>
  325. struct function
  326. <
  327. A0 , A1 , A2 , A3
  328. , void , void , void , void , void , void
  329. >
  330. : proto::transform<
  331. function<
  332. A0 , A1 , A2 , A3
  333. , void , void , void , void , void , void
  334. >
  335. , int
  336. >
  337. {
  338. typedef proto::expr<proto::tag::function, list4<A0 , A1 , A2 , A3>, 4> type;
  339. typedef proto::basic_expr<proto::tag::function, list4<A0 , A1 , A2 , A3>, 4> proto_grammar;
  340. template<typename Expr, typename State, typename Data>
  341. struct impl
  342. : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
  343. {};
  344. typedef proto::tag::function proto_tag;
  345. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3;
  346. typedef detail::if_vararg<A3> proto_child4; typedef detail::if_vararg<A3> proto_child5; typedef detail::if_vararg<A3> proto_child6; typedef detail::if_vararg<A3> proto_child7; typedef detail::if_vararg<A3> proto_child8; typedef detail::if_vararg<A3> proto_child9;
  347. };
  348. template<typename Tag , typename A0 , typename A1 , typename A2 , typename A3>
  349. struct nary_expr
  350. <
  351. Tag
  352. , A0 , A1 , A2 , A3
  353. , void , void , void , void , void , void
  354. >
  355. : proto::transform<
  356. nary_expr<
  357. Tag
  358. , A0 , A1 , A2 , A3
  359. , void , void , void , void , void , void
  360. >
  361. , int
  362. >
  363. {
  364. typedef proto::expr<Tag, list4<A0 , A1 , A2 , A3>, 4> type;
  365. typedef proto::basic_expr<Tag, list4<A0 , A1 , A2 , A3>, 4> proto_grammar;
  366. template<typename Expr, typename State, typename Data>
  367. struct impl
  368. : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
  369. {};
  370. typedef Tag proto_tag;
  371. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3;
  372. typedef detail::if_vararg<A3> proto_child4; typedef detail::if_vararg<A3> proto_child5; typedef detail::if_vararg<A3> proto_child6; typedef detail::if_vararg<A3> proto_child7; typedef detail::if_vararg<A3> proto_child8; typedef detail::if_vararg<A3> proto_child9;
  373. };
  374. namespace detail
  375. {
  376. template<
  377. template<typename , typename , typename , typename> class T
  378. , typename A0 , typename A1 , typename A2 , typename A3
  379. >
  380. struct is_callable_<T<A0 , A1 , A2 , A3> BOOST_PROTO_TEMPLATE_ARITY_PARAM(4)>
  381. : is_same<A3, callable>
  382. {};
  383. }
  384. namespace result_of
  385. {
  386. template<typename Expr>
  387. struct child_c<Expr, 4>
  388. {
  389. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  390. typedef typename Expr::proto_child4 value_type;
  391. typedef typename detail::expr_traits<typename Expr::proto_child4>::value_type type;
  392. };
  393. template<typename Expr>
  394. struct child_c<Expr &, 4>
  395. {
  396. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  397. typedef typename Expr::proto_child4 value_type;
  398. typedef typename detail::expr_traits<typename Expr::proto_child4>::reference type;
  399. BOOST_FORCEINLINE
  400. static type call(Expr &e)
  401. {
  402. return e.proto_base().child4;
  403. }
  404. };
  405. template<typename Expr>
  406. struct child_c<Expr const &, 4>
  407. {
  408. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  409. typedef typename Expr::proto_child4 value_type;
  410. typedef typename detail::expr_traits<typename Expr::proto_child4>::const_reference type;
  411. BOOST_FORCEINLINE
  412. static type call(Expr const &e)
  413. {
  414. return e.proto_base().child4;
  415. }
  416. };
  417. }
  418. template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
  419. struct function
  420. <
  421. A0 , A1 , A2 , A3 , A4
  422. , void , void , void , void , void
  423. >
  424. : proto::transform<
  425. function<
  426. A0 , A1 , A2 , A3 , A4
  427. , void , void , void , void , void
  428. >
  429. , int
  430. >
  431. {
  432. typedef proto::expr<proto::tag::function, list5<A0 , A1 , A2 , A3 , A4>, 5> type;
  433. typedef proto::basic_expr<proto::tag::function, list5<A0 , A1 , A2 , A3 , A4>, 5> proto_grammar;
  434. template<typename Expr, typename State, typename Data>
  435. struct impl
  436. : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
  437. {};
  438. typedef proto::tag::function proto_tag;
  439. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3; typedef A4 proto_child4;
  440. typedef detail::if_vararg<A4> proto_child5; typedef detail::if_vararg<A4> proto_child6; typedef detail::if_vararg<A4> proto_child7; typedef detail::if_vararg<A4> proto_child8; typedef detail::if_vararg<A4> proto_child9;
  441. };
  442. template<typename Tag , typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
  443. struct nary_expr
  444. <
  445. Tag
  446. , A0 , A1 , A2 , A3 , A4
  447. , void , void , void , void , void
  448. >
  449. : proto::transform<
  450. nary_expr<
  451. Tag
  452. , A0 , A1 , A2 , A3 , A4
  453. , void , void , void , void , void
  454. >
  455. , int
  456. >
  457. {
  458. typedef proto::expr<Tag, list5<A0 , A1 , A2 , A3 , A4>, 5> type;
  459. typedef proto::basic_expr<Tag, list5<A0 , A1 , A2 , A3 , A4>, 5> proto_grammar;
  460. template<typename Expr, typename State, typename Data>
  461. struct impl
  462. : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
  463. {};
  464. typedef Tag proto_tag;
  465. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3; typedef A4 proto_child4;
  466. typedef detail::if_vararg<A4> proto_child5; typedef detail::if_vararg<A4> proto_child6; typedef detail::if_vararg<A4> proto_child7; typedef detail::if_vararg<A4> proto_child8; typedef detail::if_vararg<A4> proto_child9;
  467. };
  468. namespace detail
  469. {
  470. template<
  471. template<typename , typename , typename , typename , typename> class T
  472. , typename A0 , typename A1 , typename A2 , typename A3 , typename A4
  473. >
  474. struct is_callable_<T<A0 , A1 , A2 , A3 , A4> BOOST_PROTO_TEMPLATE_ARITY_PARAM(5)>
  475. : is_same<A4, callable>
  476. {};
  477. }
  478. namespace result_of
  479. {
  480. template<typename Expr>
  481. struct child_c<Expr, 5>
  482. {
  483. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  484. typedef typename Expr::proto_child5 value_type;
  485. typedef typename detail::expr_traits<typename Expr::proto_child5>::value_type type;
  486. };
  487. template<typename Expr>
  488. struct child_c<Expr &, 5>
  489. {
  490. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  491. typedef typename Expr::proto_child5 value_type;
  492. typedef typename detail::expr_traits<typename Expr::proto_child5>::reference type;
  493. BOOST_FORCEINLINE
  494. static type call(Expr &e)
  495. {
  496. return e.proto_base().child5;
  497. }
  498. };
  499. template<typename Expr>
  500. struct child_c<Expr const &, 5>
  501. {
  502. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  503. typedef typename Expr::proto_child5 value_type;
  504. typedef typename detail::expr_traits<typename Expr::proto_child5>::const_reference type;
  505. BOOST_FORCEINLINE
  506. static type call(Expr const &e)
  507. {
  508. return e.proto_base().child5;
  509. }
  510. };
  511. }
  512. template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
  513. struct function
  514. <
  515. A0 , A1 , A2 , A3 , A4 , A5
  516. , void , void , void , void
  517. >
  518. : proto::transform<
  519. function<
  520. A0 , A1 , A2 , A3 , A4 , A5
  521. , void , void , void , void
  522. >
  523. , int
  524. >
  525. {
  526. typedef proto::expr<proto::tag::function, list6<A0 , A1 , A2 , A3 , A4 , A5>, 6> type;
  527. typedef proto::basic_expr<proto::tag::function, list6<A0 , A1 , A2 , A3 , A4 , A5>, 6> proto_grammar;
  528. template<typename Expr, typename State, typename Data>
  529. struct impl
  530. : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
  531. {};
  532. typedef proto::tag::function proto_tag;
  533. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3; typedef A4 proto_child4; typedef A5 proto_child5;
  534. typedef detail::if_vararg<A5> proto_child6; typedef detail::if_vararg<A5> proto_child7; typedef detail::if_vararg<A5> proto_child8; typedef detail::if_vararg<A5> proto_child9;
  535. };
  536. template<typename Tag , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
  537. struct nary_expr
  538. <
  539. Tag
  540. , A0 , A1 , A2 , A3 , A4 , A5
  541. , void , void , void , void
  542. >
  543. : proto::transform<
  544. nary_expr<
  545. Tag
  546. , A0 , A1 , A2 , A3 , A4 , A5
  547. , void , void , void , void
  548. >
  549. , int
  550. >
  551. {
  552. typedef proto::expr<Tag, list6<A0 , A1 , A2 , A3 , A4 , A5>, 6> type;
  553. typedef proto::basic_expr<Tag, list6<A0 , A1 , A2 , A3 , A4 , A5>, 6> proto_grammar;
  554. template<typename Expr, typename State, typename Data>
  555. struct impl
  556. : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
  557. {};
  558. typedef Tag proto_tag;
  559. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3; typedef A4 proto_child4; typedef A5 proto_child5;
  560. typedef detail::if_vararg<A5> proto_child6; typedef detail::if_vararg<A5> proto_child7; typedef detail::if_vararg<A5> proto_child8; typedef detail::if_vararg<A5> proto_child9;
  561. };
  562. namespace detail
  563. {
  564. template<
  565. template<typename , typename , typename , typename , typename , typename> class T
  566. , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5
  567. >
  568. struct is_callable_<T<A0 , A1 , A2 , A3 , A4 , A5> BOOST_PROTO_TEMPLATE_ARITY_PARAM(6)>
  569. : is_same<A5, callable>
  570. {};
  571. }
  572. namespace result_of
  573. {
  574. template<typename Expr>
  575. struct child_c<Expr, 6>
  576. {
  577. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  578. typedef typename Expr::proto_child6 value_type;
  579. typedef typename detail::expr_traits<typename Expr::proto_child6>::value_type type;
  580. };
  581. template<typename Expr>
  582. struct child_c<Expr &, 6>
  583. {
  584. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  585. typedef typename Expr::proto_child6 value_type;
  586. typedef typename detail::expr_traits<typename Expr::proto_child6>::reference type;
  587. BOOST_FORCEINLINE
  588. static type call(Expr &e)
  589. {
  590. return e.proto_base().child6;
  591. }
  592. };
  593. template<typename Expr>
  594. struct child_c<Expr const &, 6>
  595. {
  596. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  597. typedef typename Expr::proto_child6 value_type;
  598. typedef typename detail::expr_traits<typename Expr::proto_child6>::const_reference type;
  599. BOOST_FORCEINLINE
  600. static type call(Expr const &e)
  601. {
  602. return e.proto_base().child6;
  603. }
  604. };
  605. }
  606. template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
  607. struct function
  608. <
  609. A0 , A1 , A2 , A3 , A4 , A5 , A6
  610. , void , void , void
  611. >
  612. : proto::transform<
  613. function<
  614. A0 , A1 , A2 , A3 , A4 , A5 , A6
  615. , void , void , void
  616. >
  617. , int
  618. >
  619. {
  620. typedef proto::expr<proto::tag::function, list7<A0 , A1 , A2 , A3 , A4 , A5 , A6>, 7> type;
  621. typedef proto::basic_expr<proto::tag::function, list7<A0 , A1 , A2 , A3 , A4 , A5 , A6>, 7> proto_grammar;
  622. template<typename Expr, typename State, typename Data>
  623. struct impl
  624. : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
  625. {};
  626. typedef proto::tag::function proto_tag;
  627. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3; typedef A4 proto_child4; typedef A5 proto_child5; typedef A6 proto_child6;
  628. typedef detail::if_vararg<A6> proto_child7; typedef detail::if_vararg<A6> proto_child8; typedef detail::if_vararg<A6> proto_child9;
  629. };
  630. template<typename Tag , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
  631. struct nary_expr
  632. <
  633. Tag
  634. , A0 , A1 , A2 , A3 , A4 , A5 , A6
  635. , void , void , void
  636. >
  637. : proto::transform<
  638. nary_expr<
  639. Tag
  640. , A0 , A1 , A2 , A3 , A4 , A5 , A6
  641. , void , void , void
  642. >
  643. , int
  644. >
  645. {
  646. typedef proto::expr<Tag, list7<A0 , A1 , A2 , A3 , A4 , A5 , A6>, 7> type;
  647. typedef proto::basic_expr<Tag, list7<A0 , A1 , A2 , A3 , A4 , A5 , A6>, 7> proto_grammar;
  648. template<typename Expr, typename State, typename Data>
  649. struct impl
  650. : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
  651. {};
  652. typedef Tag proto_tag;
  653. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3; typedef A4 proto_child4; typedef A5 proto_child5; typedef A6 proto_child6;
  654. typedef detail::if_vararg<A6> proto_child7; typedef detail::if_vararg<A6> proto_child8; typedef detail::if_vararg<A6> proto_child9;
  655. };
  656. namespace detail
  657. {
  658. template<
  659. template<typename , typename , typename , typename , typename , typename , typename> class T
  660. , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6
  661. >
  662. struct is_callable_<T<A0 , A1 , A2 , A3 , A4 , A5 , A6> BOOST_PROTO_TEMPLATE_ARITY_PARAM(7)>
  663. : is_same<A6, callable>
  664. {};
  665. }
  666. namespace result_of
  667. {
  668. template<typename Expr>
  669. struct child_c<Expr, 7>
  670. {
  671. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  672. typedef typename Expr::proto_child7 value_type;
  673. typedef typename detail::expr_traits<typename Expr::proto_child7>::value_type type;
  674. };
  675. template<typename Expr>
  676. struct child_c<Expr &, 7>
  677. {
  678. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  679. typedef typename Expr::proto_child7 value_type;
  680. typedef typename detail::expr_traits<typename Expr::proto_child7>::reference type;
  681. BOOST_FORCEINLINE
  682. static type call(Expr &e)
  683. {
  684. return e.proto_base().child7;
  685. }
  686. };
  687. template<typename Expr>
  688. struct child_c<Expr const &, 7>
  689. {
  690. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  691. typedef typename Expr::proto_child7 value_type;
  692. typedef typename detail::expr_traits<typename Expr::proto_child7>::const_reference type;
  693. BOOST_FORCEINLINE
  694. static type call(Expr const &e)
  695. {
  696. return e.proto_base().child7;
  697. }
  698. };
  699. }
  700. template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
  701. struct function
  702. <
  703. A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
  704. , void , void
  705. >
  706. : proto::transform<
  707. function<
  708. A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
  709. , void , void
  710. >
  711. , int
  712. >
  713. {
  714. typedef proto::expr<proto::tag::function, list8<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>, 8> type;
  715. typedef proto::basic_expr<proto::tag::function, list8<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>, 8> proto_grammar;
  716. template<typename Expr, typename State, typename Data>
  717. struct impl
  718. : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
  719. {};
  720. typedef proto::tag::function proto_tag;
  721. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3; typedef A4 proto_child4; typedef A5 proto_child5; typedef A6 proto_child6; typedef A7 proto_child7;
  722. typedef detail::if_vararg<A7> proto_child8; typedef detail::if_vararg<A7> proto_child9;
  723. };
  724. template<typename Tag , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
  725. struct nary_expr
  726. <
  727. Tag
  728. , A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
  729. , void , void
  730. >
  731. : proto::transform<
  732. nary_expr<
  733. Tag
  734. , A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7
  735. , void , void
  736. >
  737. , int
  738. >
  739. {
  740. typedef proto::expr<Tag, list8<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>, 8> type;
  741. typedef proto::basic_expr<Tag, list8<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7>, 8> proto_grammar;
  742. template<typename Expr, typename State, typename Data>
  743. struct impl
  744. : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
  745. {};
  746. typedef Tag proto_tag;
  747. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3; typedef A4 proto_child4; typedef A5 proto_child5; typedef A6 proto_child6; typedef A7 proto_child7;
  748. typedef detail::if_vararg<A7> proto_child8; typedef detail::if_vararg<A7> proto_child9;
  749. };
  750. namespace detail
  751. {
  752. template<
  753. template<typename , typename , typename , typename , typename , typename , typename , typename> class T
  754. , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7
  755. >
  756. struct is_callable_<T<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7> BOOST_PROTO_TEMPLATE_ARITY_PARAM(8)>
  757. : is_same<A7, callable>
  758. {};
  759. }
  760. namespace result_of
  761. {
  762. template<typename Expr>
  763. struct child_c<Expr, 8>
  764. {
  765. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  766. typedef typename Expr::proto_child8 value_type;
  767. typedef typename detail::expr_traits<typename Expr::proto_child8>::value_type type;
  768. };
  769. template<typename Expr>
  770. struct child_c<Expr &, 8>
  771. {
  772. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  773. typedef typename Expr::proto_child8 value_type;
  774. typedef typename detail::expr_traits<typename Expr::proto_child8>::reference type;
  775. BOOST_FORCEINLINE
  776. static type call(Expr &e)
  777. {
  778. return e.proto_base().child8;
  779. }
  780. };
  781. template<typename Expr>
  782. struct child_c<Expr const &, 8>
  783. {
  784. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  785. typedef typename Expr::proto_child8 value_type;
  786. typedef typename detail::expr_traits<typename Expr::proto_child8>::const_reference type;
  787. BOOST_FORCEINLINE
  788. static type call(Expr const &e)
  789. {
  790. return e.proto_base().child8;
  791. }
  792. };
  793. }
  794. template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
  795. struct function
  796. <
  797. A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
  798. , void
  799. >
  800. : proto::transform<
  801. function<
  802. A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
  803. , void
  804. >
  805. , int
  806. >
  807. {
  808. typedef proto::expr<proto::tag::function, list9<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>, 9> type;
  809. typedef proto::basic_expr<proto::tag::function, list9<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>, 9> proto_grammar;
  810. template<typename Expr, typename State, typename Data>
  811. struct impl
  812. : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
  813. {};
  814. typedef proto::tag::function proto_tag;
  815. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3; typedef A4 proto_child4; typedef A5 proto_child5; typedef A6 proto_child6; typedef A7 proto_child7; typedef A8 proto_child8;
  816. typedef detail::if_vararg<A8> proto_child9;
  817. };
  818. template<typename Tag , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
  819. struct nary_expr
  820. <
  821. Tag
  822. , A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
  823. , void
  824. >
  825. : proto::transform<
  826. nary_expr<
  827. Tag
  828. , A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8
  829. , void
  830. >
  831. , int
  832. >
  833. {
  834. typedef proto::expr<Tag, list9<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>, 9> type;
  835. typedef proto::basic_expr<Tag, list9<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8>, 9> proto_grammar;
  836. template<typename Expr, typename State, typename Data>
  837. struct impl
  838. : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
  839. {};
  840. typedef Tag proto_tag;
  841. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3; typedef A4 proto_child4; typedef A5 proto_child5; typedef A6 proto_child6; typedef A7 proto_child7; typedef A8 proto_child8;
  842. typedef detail::if_vararg<A8> proto_child9;
  843. };
  844. namespace detail
  845. {
  846. template<
  847. template<typename , typename , typename , typename , typename , typename , typename , typename , typename> class T
  848. , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8
  849. >
  850. struct is_callable_<T<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8> BOOST_PROTO_TEMPLATE_ARITY_PARAM(9)>
  851. : is_same<A8, callable>
  852. {};
  853. }
  854. namespace result_of
  855. {
  856. template<typename Expr>
  857. struct child_c<Expr, 9>
  858. {
  859. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  860. typedef typename Expr::proto_child9 value_type;
  861. typedef typename detail::expr_traits<typename Expr::proto_child9>::value_type type;
  862. };
  863. template<typename Expr>
  864. struct child_c<Expr &, 9>
  865. {
  866. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  867. typedef typename Expr::proto_child9 value_type;
  868. typedef typename detail::expr_traits<typename Expr::proto_child9>::reference type;
  869. BOOST_FORCEINLINE
  870. static type call(Expr &e)
  871. {
  872. return e.proto_base().child9;
  873. }
  874. };
  875. template<typename Expr>
  876. struct child_c<Expr const &, 9>
  877. {
  878. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  879. typedef typename Expr::proto_child9 value_type;
  880. typedef typename detail::expr_traits<typename Expr::proto_child9>::const_reference type;
  881. BOOST_FORCEINLINE
  882. static type call(Expr const &e)
  883. {
  884. return e.proto_base().child9;
  885. }
  886. };
  887. }
  888. template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
  889. struct function
  890. : proto::transform<
  891. function<
  892. A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9
  893. >
  894. , int
  895. >
  896. {
  897. typedef proto::expr<proto::tag::function, list10<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>, 10> type;
  898. typedef proto::basic_expr<proto::tag::function, list10<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>, 10> proto_grammar;
  899. template<typename Expr, typename State, typename Data>
  900. struct impl
  901. : detail::pass_through_impl<function, deduce_domain, Expr, State, Data>
  902. {};
  903. typedef proto::tag::function proto_tag;
  904. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3; typedef A4 proto_child4; typedef A5 proto_child5; typedef A6 proto_child6; typedef A7 proto_child7; typedef A8 proto_child8; typedef A9 proto_child9;
  905. };
  906. template<typename Tag , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
  907. struct nary_expr
  908. : proto::transform<
  909. nary_expr<
  910. Tag
  911. , A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9
  912. >
  913. , int
  914. >
  915. {
  916. typedef proto::expr<Tag, list10<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>, 10> type;
  917. typedef proto::basic_expr<Tag, list10<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9>, 10> proto_grammar;
  918. template<typename Expr, typename State, typename Data>
  919. struct impl
  920. : detail::pass_through_impl<nary_expr, deduce_domain, Expr, State, Data>
  921. {};
  922. typedef Tag proto_tag;
  923. typedef A0 proto_child0; typedef A1 proto_child1; typedef A2 proto_child2; typedef A3 proto_child3; typedef A4 proto_child4; typedef A5 proto_child5; typedef A6 proto_child6; typedef A7 proto_child7; typedef A8 proto_child8; typedef A9 proto_child9;
  924. };
  925. namespace detail
  926. {
  927. template<
  928. template<typename , typename , typename , typename , typename , typename , typename , typename , typename , typename> class T
  929. , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9
  930. >
  931. struct is_callable_<T<A0 , A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9> BOOST_PROTO_TEMPLATE_ARITY_PARAM(10)>
  932. : is_same<A9, callable>
  933. {};
  934. }
  935. namespace result_of
  936. {
  937. template<typename Expr>
  938. struct child_c<Expr, 10>
  939. {
  940. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  941. typedef typename Expr::proto_child10 value_type;
  942. typedef typename detail::expr_traits<typename Expr::proto_child10>::value_type type;
  943. };
  944. template<typename Expr>
  945. struct child_c<Expr &, 10>
  946. {
  947. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  948. typedef typename Expr::proto_child10 value_type;
  949. typedef typename detail::expr_traits<typename Expr::proto_child10>::reference type;
  950. BOOST_FORCEINLINE
  951. static type call(Expr &e)
  952. {
  953. return e.proto_base().child10;
  954. }
  955. };
  956. template<typename Expr>
  957. struct child_c<Expr const &, 10>
  958. {
  959. BOOST_STATIC_ASSERT(0 != Expr::proto_arity_c);
  960. typedef typename Expr::proto_child10 value_type;
  961. typedef typename detail::expr_traits<typename Expr::proto_child10>::const_reference type;
  962. BOOST_FORCEINLINE
  963. static type call(Expr const &e)
  964. {
  965. return e.proto_base().child10;
  966. }
  967. };
  968. }