1 /////////////////////////////////////////////////////////////////////////////// 2 /// \file basic_expr.hpp 3 /// Contains definition of basic_expr\<\> class template. 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 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 template<typename Tag, typename Arg0> 37 struct basic_expr<Tag, term<Arg0>, 0> 38 { 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; 52 53 54 BOOST_FORCEINLINE proto_basebasic_expr55 basic_expr const &proto_base() const 56 { 57 return *this; 58 } 59 60 61 BOOST_FORCEINLINE proto_basebasic_expr62 basic_expr &proto_base() 63 { 64 return *this; 65 } 66 67 68 69 template<typename A0> 70 BOOST_FORCEINLINE makebasic_expr71 static basic_expr const make(A0 &a0) 72 { 73 return detail::make_terminal(a0, static_cast<basic_expr *>(0), static_cast<proto_args *>(0)); 74 } 75 76 77 template<typename A0> 78 BOOST_FORCEINLINE makebasic_expr79 static basic_expr const make(A0 const &a0) 80 { 81 return detail::make_terminal(a0, static_cast<basic_expr *>(0), static_cast<proto_args *>(0)); 82 } 83 84 85 typedef detail::not_a_valid_type address_of_hack_type_; 86 }; 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 template<typename Tag , typename Arg0> 115 struct basic_expr<Tag, list1<Arg0>, 1 > 116 { 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; 130 131 132 BOOST_FORCEINLINE proto_basebasic_expr133 basic_expr const &proto_base() const 134 { 135 return *this; 136 } 137 138 139 BOOST_FORCEINLINE proto_basebasic_expr140 basic_expr &proto_base() 141 { 142 return *this; 143 } 144 145 146 147 template<typename A0> 148 BOOST_FORCEINLINE makebasic_expr149 static basic_expr const make(A0 const &a0) 150 { 151 basic_expr that = {a0}; 152 return that; 153 } 154 155 156 157 typedef typename detail::address_of_hack<Tag, proto_child0>::type address_of_hack_type_; 158 159 160 161 162 163 164 165 BOOST_FORCEINLINE operator address_of_hack_type_basic_expr166 operator address_of_hack_type_() const 167 { 168 return boost::addressof(this->child0); 169 } 170 }; 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 template<typename Tag , typename Arg0 , typename Arg1> 199 struct basic_expr<Tag, list2<Arg0 , Arg1>, 2 > 200 { 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; 214 215 216 BOOST_FORCEINLINE proto_basebasic_expr217 basic_expr const &proto_base() const 218 { 219 return *this; 220 } 221 222 223 BOOST_FORCEINLINE proto_basebasic_expr224 basic_expr &proto_base() 225 { 226 return *this; 227 } 228 229 230 231 template<typename A0 , typename A1> 232 BOOST_FORCEINLINE makebasic_expr233 static basic_expr const make(A0 const &a0 , A1 const &a1) 234 { 235 basic_expr that = {a0 , a1}; 236 return that; 237 } 238 239 240 typedef detail::not_a_valid_type address_of_hack_type_; 241 }; 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 template<typename Tag , typename Arg0 , typename Arg1 , typename Arg2> 270 struct basic_expr<Tag, list3<Arg0 , Arg1 , Arg2>, 3 > 271 { 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; 285 286 287 BOOST_FORCEINLINE proto_basebasic_expr288 basic_expr const &proto_base() const 289 { 290 return *this; 291 } 292 293 294 BOOST_FORCEINLINE proto_basebasic_expr295 basic_expr &proto_base() 296 { 297 return *this; 298 } 299 300 301 302 template<typename A0 , typename A1 , typename A2> 303 BOOST_FORCEINLINE makebasic_expr304 static basic_expr const make(A0 const &a0 , A1 const &a1 , A2 const &a2) 305 { 306 basic_expr that = {a0 , a1 , a2}; 307 return that; 308 } 309 310 311 typedef detail::not_a_valid_type address_of_hack_type_; 312 }; 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 template<typename Tag , typename Arg0 , typename Arg1 , typename Arg2 , typename Arg3> 341 struct basic_expr<Tag, list4<Arg0 , Arg1 , Arg2 , Arg3>, 4 > 342 { 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; 356 357 358 BOOST_FORCEINLINE proto_basebasic_expr359 basic_expr const &proto_base() const 360 { 361 return *this; 362 } 363 364 365 BOOST_FORCEINLINE proto_basebasic_expr366 basic_expr &proto_base() 367 { 368 return *this; 369 } 370 371 372 373 template<typename A0 , typename A1 , typename A2 , typename A3> 374 BOOST_FORCEINLINE makebasic_expr375 static basic_expr const make(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3) 376 { 377 basic_expr that = {a0 , a1 , a2 , a3}; 378 return that; 379 } 380 381 382 typedef detail::not_a_valid_type address_of_hack_type_; 383 }; 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 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 > 413 { 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; 427 428 429 BOOST_FORCEINLINE proto_basebasic_expr430 basic_expr const &proto_base() const 431 { 432 return *this; 433 } 434 435 436 BOOST_FORCEINLINE proto_basebasic_expr437 basic_expr &proto_base() 438 { 439 return *this; 440 } 441 442 443 444 template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4> 445 BOOST_FORCEINLINE makebasic_expr446 static basic_expr const make(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4) 447 { 448 basic_expr that = {a0 , a1 , a2 , a3 , a4}; 449 return that; 450 } 451 452 453 typedef detail::not_a_valid_type address_of_hack_type_; 454 }; 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 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 > 484 { 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; 498 499 500 BOOST_FORCEINLINE proto_basebasic_expr501 basic_expr const &proto_base() const 502 { 503 return *this; 504 } 505 506 507 BOOST_FORCEINLINE proto_basebasic_expr508 basic_expr &proto_base() 509 { 510 return *this; 511 } 512 513 514 515 template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5> 516 BOOST_FORCEINLINE makebasic_expr517 static basic_expr const make(A0 const &a0 , A1 const &a1 , A2 const &a2 , A3 const &a3 , A4 const &a4 , A5 const &a5) 518 { 519 basic_expr that = {a0 , a1 , a2 , a3 , a4 , a5}; 520 return that; 521 } 522 523 524 typedef detail::not_a_valid_type address_of_hack_type_; 525 }; 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 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 > 555 { 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; 569 570 571 BOOST_FORCEINLINE proto_basebasic_expr572 basic_expr const &proto_base() const 573 { 574 return *this; 575 } 576 577 578 BOOST_FORCEINLINE proto_basebasic_expr579 basic_expr &proto_base() 580 { 581 return *this; 582 } 583 584 585 586 template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6> 587 BOOST_FORCEINLINE makebasic_expr588 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) 589 { 590 basic_expr that = {a0 , a1 , a2 , a3 , a4 , a5 , a6}; 591 return that; 592 } 593 594 595 typedef detail::not_a_valid_type address_of_hack_type_; 596 }; 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 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 > 626 { 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; 640 641 642 BOOST_FORCEINLINE proto_basebasic_expr643 basic_expr const &proto_base() const 644 { 645 return *this; 646 } 647 648 649 BOOST_FORCEINLINE proto_basebasic_expr650 basic_expr &proto_base() 651 { 652 return *this; 653 } 654 655 656 657 template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7> 658 BOOST_FORCEINLINE makebasic_expr659 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) 660 { 661 basic_expr that = {a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7}; 662 return that; 663 } 664 665 666 typedef detail::not_a_valid_type address_of_hack_type_; 667 }; 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 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 > 697 { 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; 711 712 713 BOOST_FORCEINLINE proto_basebasic_expr714 basic_expr const &proto_base() const 715 { 716 return *this; 717 } 718 719 720 BOOST_FORCEINLINE proto_basebasic_expr721 basic_expr &proto_base() 722 { 723 return *this; 724 } 725 726 727 728 template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8> 729 BOOST_FORCEINLINE makebasic_expr730 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) 731 { 732 basic_expr that = {a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8}; 733 return that; 734 } 735 736 737 typedef detail::not_a_valid_type address_of_hack_type_; 738 }; 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 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 > 768 { 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; 781 782 783 784 BOOST_FORCEINLINE proto_basebasic_expr785 basic_expr const &proto_base() const 786 { 787 return *this; 788 } 789 790 791 BOOST_FORCEINLINE proto_basebasic_expr792 basic_expr &proto_base() 793 { 794 return *this; 795 } 796 797 798 799 template<typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9> 800 BOOST_FORCEINLINE makebasic_expr801 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) 802 { 803 basic_expr that = {a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9}; 804 return that; 805 } 806 807 808 typedef detail::not_a_valid_type address_of_hack_type_; 809 }; 810