1 ///////////////////////////////////////////////////////////////////////////////
2 /// \file basic_expr.hpp
3 /// Contains definition of basic_expr\<\> class template.
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)
36 template<typename Tag, typename Arg0>
37 struct basic_expr<Tag, term<Arg0>, 0>
39 typedef Tag proto_tag;
40 static const long proto_arity_c = 0;
41 typedef mpl::long_<0 > proto_arity;
42 typedef basic_expr proto_base_expr;
43 typedef term<Arg0> proto_args;
44 typedef basic_expr proto_grammar;
45 typedef basic_default_domain proto_domain;
46 typedef default_generator proto_generator;
47 typedef proto::tag::proto_expr<Tag, proto_domain> fusion_tag;
48 typedef basic_expr proto_derived_expr;
49 typedef void proto_is_expr_;
50 typedef Arg0 proto_child0; proto_child0 child0;
51 typedef void proto_child1; typedef void proto_child2; typedef void proto_child3; typedef void proto_child4; typedef void proto_child5; typedef void proto_child6; typedef void proto_child7; typedef void proto_child8; typedef void proto_child9;
55 basic_expr const &proto_base() const
62 basic_expr &proto_base()
71 static basic_expr const make(A0 &a0)
73 return detail::make_terminal(a0, static_cast<basic_expr *>(0), static_cast<proto_args *>(0));
79 static basic_expr const make(A0 const &a0)
81 return detail::make_terminal(a0, static_cast<basic_expr *>(0), static_cast<proto_args *>(0));
85 typedef detail::not_a_valid_type address_of_hack_type_;
114 template<typename Tag , typename Arg0>
115 struct basic_expr<Tag, list1<Arg0>, 1 >
117 typedef Tag proto_tag;
118 static const long proto_arity_c = 1;
119 typedef mpl::long_<1 > proto_arity;
120 typedef basic_expr proto_base_expr;
121 typedef list1<Arg0> proto_args;
122 typedef basic_expr proto_grammar;
123 typedef basic_default_domain proto_domain;
124 typedef default_generator proto_generator;
125 typedef proto::tag::proto_expr<Tag, proto_domain> fusion_tag;
126 typedef basic_expr proto_derived_expr;
127 typedef void proto_is_expr_;
128 typedef Arg0 proto_child0; proto_child0 child0;
129 typedef void proto_child1; typedef void proto_child2; typedef void proto_child3; typedef void proto_child4; typedef void proto_child5; typedef void proto_child6; typedef void proto_child7; typedef void proto_child8; typedef void proto_child9;
133 basic_expr const &proto_base() const
140 basic_expr &proto_base()
147 template<typename A0>
149 static basic_expr const make(A0 const &a0)
151 basic_expr that = {a0};
157 typedef typename detail::address_of_hack<Tag, proto_child0>::type address_of_hack_type_;
166 operator address_of_hack_type_() const
168 return boost::addressof(this->child0);
198 template<typename Tag , typename Arg0 , typename Arg1>
199 struct basic_expr<Tag, list2<Arg0 , Arg1>, 2 >
201 typedef Tag proto_tag;
202 static const long proto_arity_c = 2;
203 typedef mpl::long_<2 > proto_arity;
204 typedef basic_expr proto_base_expr;
205 typedef list2<Arg0 , Arg1> proto_args;
206 typedef basic_expr proto_grammar;
207 typedef basic_default_domain proto_domain;
208 typedef default_generator proto_generator;
209 typedef proto::tag::proto_expr<Tag, proto_domain> fusion_tag;
210 typedef basic_expr proto_derived_expr;
211 typedef void proto_is_expr_;
212 typedef Arg0 proto_child0; proto_child0 child0; typedef Arg1 proto_child1; proto_child1 child1;
213 typedef void proto_child2; typedef void proto_child3; typedef void proto_child4; typedef void proto_child5; typedef void proto_child6; typedef void proto_child7; typedef void proto_child8; typedef void proto_child9;
217 basic_expr const &proto_base() const
224 basic_expr &proto_base()
231 template<typename A0 , typename A1>
233 static basic_expr const make(A0 const &a0 , A1 const &a1)
235 basic_expr that = {a0 , a1};
240 typedef detail::not_a_valid_type address_of_hack_type_;
269 template<typename Tag , typename Arg0 , typename Arg1 , typename Arg2>
270 struct basic_expr<Tag, list3<Arg0 , Arg1 , Arg2>, 3 >
272 typedef Tag proto_tag;
273 static const long proto_arity_c = 3;
274 typedef mpl::long_<3 > proto_arity;
275 typedef basic_expr proto_base_expr;
276 typedef list3<Arg0 , Arg1 , Arg2> proto_args;
277 typedef basic_expr proto_grammar;
278 typedef basic_default_domain proto_domain;
279 typedef default_generator proto_generator;
280 typedef proto::tag::proto_expr<Tag, proto_domain> fusion_tag;
281 typedef basic_expr proto_derived_expr;
282 typedef void proto_is_expr_;
283 typedef Arg0 proto_child0; proto_child0 child0; typedef Arg1 proto_child1; proto_child1 child1; typedef Arg2 proto_child2; proto_child2 child2;
284 typedef void proto_child3; typedef void proto_child4; typedef void proto_child5; typedef void proto_child6; typedef void proto_child7; typedef void proto_child8; typedef void proto_child9;
288 basic_expr const &proto_base() const
295 basic_expr &proto_base()
302 template<typename A0 , typename A1 , typename A2>
304 static basic_expr const make(A0 const &a0 , A1 const &a1 , A2 const &a2)
306 basic_expr that = {a0 , a1 , a2};
311 typedef detail::not_a_valid_type address_of_hack_type_;
340 template<typename Tag , typename Arg0 , typename Arg1 , typename Arg2 , typename Arg3>
341 struct basic_expr<Tag, list4<Arg0 , Arg1 , Arg2 , Arg3>, 4 >
343 typedef Tag proto_tag;
344 static const long proto_arity_c = 4;
345 typedef mpl::long_<4 > proto_arity;
346 typedef basic_expr proto_base_expr;
347 typedef list4<Arg0 , Arg1 , Arg2 , Arg3> proto_args;
348 typedef basic_expr proto_grammar;
349 typedef basic_default_domain proto_domain;
350 typedef default_generator proto_generator;
351 typedef proto::tag::proto_expr<Tag, proto_domain> fusion_tag;
352 typedef basic_expr proto_derived_expr;
353 typedef void proto_is_expr_;
354 typedef Arg0 proto_child0; proto_child0 child0; typedef Arg1 proto_child1; proto_child1 child1; typedef Arg2 proto_child2; proto_child2 child2; typedef Arg3 proto_child3; proto_child3 child3;
355 typedef void proto_child4; typedef void proto_child5; typedef void proto_child6; typedef void proto_child7; typedef void proto_child8; typedef void proto_child9;
359 basic_expr const &proto_base() const
366 basic_expr &proto_base()
373 template<typename A0 , typename A1 , typename A2 , typename A3>
375 static basic_expr const make(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3)
377 basic_expr that = {a0 , a1 , a2 , a3};
382 typedef detail::not_a_valid_type address_of_hack_type_;
411 template<typename Tag , typename Arg0 , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4>
412 struct basic_expr<Tag, list5<Arg0 , Arg1 , Arg2 , Arg3 , Arg4>, 5 >
414 typedef Tag proto_tag;
415 static const long proto_arity_c = 5;
416 typedef mpl::long_<5 > proto_arity;
417 typedef basic_expr proto_base_expr;
418 typedef list5<Arg0 , Arg1 , Arg2 , Arg3 , Arg4> proto_args;
419 typedef basic_expr proto_grammar;
420 typedef basic_default_domain proto_domain;
421 typedef default_generator proto_generator;
422 typedef proto::tag::proto_expr<Tag, proto_domain> fusion_tag;
423 typedef basic_expr proto_derived_expr;
424 typedef void proto_is_expr_;
425 typedef Arg0 proto_child0; proto_child0 child0; typedef Arg1 proto_child1; proto_child1 child1; typedef Arg2 proto_child2; proto_child2 child2; typedef Arg3 proto_child3; proto_child3 child3; typedef Arg4 proto_child4; proto_child4 child4;
426 typedef void proto_child5; typedef void proto_child6; typedef void proto_child7; typedef void proto_child8; typedef void proto_child9;
430 basic_expr const &proto_base() const
437 basic_expr &proto_base()
444 template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
446 static basic_expr const make(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4)
448 basic_expr that = {a0 , a1 , a2 , a3 , a4};
453 typedef detail::not_a_valid_type address_of_hack_type_;
482 template<typename Tag , typename Arg0 , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 , typename Arg5>
483 struct basic_expr<Tag, list6<Arg0 , Arg1 , Arg2 , Arg3 , Arg4 , Arg5>, 6 >
485 typedef Tag proto_tag;
486 static const long proto_arity_c = 6;
487 typedef mpl::long_<6 > proto_arity;
488 typedef basic_expr proto_base_expr;
489 typedef list6<Arg0 , Arg1 , Arg2 , Arg3 , Arg4 , Arg5> proto_args;
490 typedef basic_expr proto_grammar;
491 typedef basic_default_domain proto_domain;
492 typedef default_generator proto_generator;
493 typedef proto::tag::proto_expr<Tag, proto_domain> fusion_tag;
494 typedef basic_expr proto_derived_expr;
495 typedef void proto_is_expr_;
496 typedef Arg0 proto_child0; proto_child0 child0; typedef Arg1 proto_child1; proto_child1 child1; typedef Arg2 proto_child2; proto_child2 child2; typedef Arg3 proto_child3; proto_child3 child3; typedef Arg4 proto_child4; proto_child4 child4; typedef Arg5 proto_child5; proto_child5 child5;
497 typedef void proto_child6; typedef void proto_child7; typedef void proto_child8; typedef void proto_child9;
501 basic_expr const &proto_base() const
508 basic_expr &proto_base()
515 template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
517 static basic_expr const make(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5)
519 basic_expr that = {a0 , a1 , a2 , a3 , a4 , a5};
524 typedef detail::not_a_valid_type address_of_hack_type_;
553 template<typename Tag , typename Arg0 , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 , typename Arg5 , typename Arg6>
554 struct basic_expr<Tag, list7<Arg0 , Arg1 , Arg2 , Arg3 , Arg4 , Arg5 , Arg6>, 7 >
556 typedef Tag proto_tag;
557 static const long proto_arity_c = 7;
558 typedef mpl::long_<7 > proto_arity;
559 typedef basic_expr proto_base_expr;
560 typedef list7<Arg0 , Arg1 , Arg2 , Arg3 , Arg4 , Arg5 , Arg6> proto_args;
561 typedef basic_expr proto_grammar;
562 typedef basic_default_domain proto_domain;
563 typedef default_generator proto_generator;
564 typedef proto::tag::proto_expr<Tag, proto_domain> fusion_tag;
565 typedef basic_expr proto_derived_expr;
566 typedef void proto_is_expr_;
567 typedef Arg0 proto_child0; proto_child0 child0; typedef Arg1 proto_child1; proto_child1 child1; typedef Arg2 proto_child2; proto_child2 child2; typedef Arg3 proto_child3; proto_child3 child3; typedef Arg4 proto_child4; proto_child4 child4; typedef Arg5 proto_child5; proto_child5 child5; typedef Arg6 proto_child6; proto_child6 child6;
568 typedef void proto_child7; typedef void proto_child8; typedef void proto_child9;
572 basic_expr const &proto_base() const
579 basic_expr &proto_base()
586 template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
588 static basic_expr const make(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5 , A6 const &a6)
590 basic_expr that = {a0 , a1 , a2 , a3 , a4 , a5 , a6};
595 typedef detail::not_a_valid_type address_of_hack_type_;
624 template<typename Tag , typename Arg0 , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 , typename Arg5 , typename Arg6 , typename Arg7>
625 struct basic_expr<Tag, list8<Arg0 , Arg1 , Arg2 , Arg3 , Arg4 , Arg5 , Arg6 , Arg7>, 8 >
627 typedef Tag proto_tag;
628 static const long proto_arity_c = 8;
629 typedef mpl::long_<8 > proto_arity;
630 typedef basic_expr proto_base_expr;
631 typedef list8<Arg0 , Arg1 , Arg2 , Arg3 , Arg4 , Arg5 , Arg6 , Arg7> proto_args;
632 typedef basic_expr proto_grammar;
633 typedef basic_default_domain proto_domain;
634 typedef default_generator proto_generator;
635 typedef proto::tag::proto_expr<Tag, proto_domain> fusion_tag;
636 typedef basic_expr proto_derived_expr;
637 typedef void proto_is_expr_;
638 typedef Arg0 proto_child0; proto_child0 child0; typedef Arg1 proto_child1; proto_child1 child1; typedef Arg2 proto_child2; proto_child2 child2; typedef Arg3 proto_child3; proto_child3 child3; typedef Arg4 proto_child4; proto_child4 child4; typedef Arg5 proto_child5; proto_child5 child5; typedef Arg6 proto_child6; proto_child6 child6; typedef Arg7 proto_child7; proto_child7 child7;
639 typedef void proto_child8; typedef void proto_child9;
643 basic_expr const &proto_base() const
650 basic_expr &proto_base()
657 template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
659 static basic_expr const make(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5 , A6 const &a6 , A7 const &a7)
661 basic_expr that = {a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7};
666 typedef detail::not_a_valid_type address_of_hack_type_;
695 template<typename Tag , typename Arg0 , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 , typename Arg5 , typename Arg6 , typename Arg7 , typename Arg8>
696 struct basic_expr<Tag, list9<Arg0 , Arg1 , Arg2 , Arg3 , Arg4 , Arg5 , Arg6 , Arg7 , Arg8>, 9 >
698 typedef Tag proto_tag;
699 static const long proto_arity_c = 9;
700 typedef mpl::long_<9 > proto_arity;
701 typedef basic_expr proto_base_expr;
702 typedef list9<Arg0 , Arg1 , Arg2 , Arg3 , Arg4 , Arg5 , Arg6 , Arg7 , Arg8> proto_args;
703 typedef basic_expr proto_grammar;
704 typedef basic_default_domain proto_domain;
705 typedef default_generator proto_generator;
706 typedef proto::tag::proto_expr<Tag, proto_domain> fusion_tag;
707 typedef basic_expr proto_derived_expr;
708 typedef void proto_is_expr_;
709 typedef Arg0 proto_child0; proto_child0 child0; typedef Arg1 proto_child1; proto_child1 child1; typedef Arg2 proto_child2; proto_child2 child2; typedef Arg3 proto_child3; proto_child3 child3; typedef Arg4 proto_child4; proto_child4 child4; typedef Arg5 proto_child5; proto_child5 child5; typedef Arg6 proto_child6; proto_child6 child6; typedef Arg7 proto_child7; proto_child7 child7; typedef Arg8 proto_child8; proto_child8 child8;
710 typedef void proto_child9;
714 basic_expr const &proto_base() const
721 basic_expr &proto_base()
728 template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
730 static basic_expr const make(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5 , A6 const &a6 , A7 const &a7 , A8 const &a8)
732 basic_expr that = {a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8};
737 typedef detail::not_a_valid_type address_of_hack_type_;
766 template<typename Tag , typename Arg0 , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 , typename Arg5 , typename Arg6 , typename Arg7 , typename Arg8 , typename Arg9>
767 struct basic_expr<Tag, list10<Arg0 , Arg1 , Arg2 , Arg3 , Arg4 , Arg5 , Arg6 , Arg7 , Arg8 , Arg9>, 10 >
769 typedef Tag proto_tag;
770 static const long proto_arity_c = 10;
771 typedef mpl::long_<10 > proto_arity;
772 typedef basic_expr proto_base_expr;
773 typedef list10<Arg0 , Arg1 , Arg2 , Arg3 , Arg4 , Arg5 , Arg6 , Arg7 , Arg8 , Arg9> proto_args;
774 typedef basic_expr proto_grammar;
775 typedef basic_default_domain proto_domain;
776 typedef default_generator proto_generator;
777 typedef proto::tag::proto_expr<Tag, proto_domain> fusion_tag;
778 typedef basic_expr proto_derived_expr;
779 typedef void proto_is_expr_;
780 typedef Arg0 proto_child0; proto_child0 child0; typedef Arg1 proto_child1; proto_child1 child1; typedef Arg2 proto_child2; proto_child2 child2; typedef Arg3 proto_child3; proto_child3 child3; typedef Arg4 proto_child4; proto_child4 child4; typedef Arg5 proto_child5; proto_child5 child5; typedef Arg6 proto_child6; proto_child6 child6; typedef Arg7 proto_child7; proto_child7 child7; typedef Arg8 proto_child8; proto_child8 child8; typedef Arg9 proto_child9; proto_child9 child9;
785 basic_expr const &proto_base() const
792 basic_expr &proto_base()
799 template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
801 static basic_expr const make(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5 , A6 const &a6 , A7 const &a7 , A8 const &a8 , A9 const &a9)
803 basic_expr that = {a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9};
808 typedef detail::not_a_valid_type address_of_hack_type_;