PageRenderTime 249ms CodeModel.GetById 18ms app.highlight 200ms RepoModel.GetById 7ms app.codeStats 1ms

/Src/Dependencies/Boost/boost/spirit/home/classic/phoenix/operators.hpp

http://hadesmem.googlecode.com/
C++ Header | 2203 lines | 1280 code | 362 blank | 561 comment | 7 complexity | dd40c8555705f675fc606f6a6673434e MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1/*=============================================================================
   2    Phoenix V1.2.1
   3    Copyright (c) 2001-2002 Joel de Guzman
   4
   5  Distributed under the Boost Software License, Version 1.0. (See accompanying
   6  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
   7==============================================================================*/
   8#ifndef PHOENIX_OPERATORS_HPP
   9#define PHOENIX_OPERATORS_HPP
  10
  11///////////////////////////////////////////////////////////////////////////////
  12#if !defined(BOOST_NO_CWCTYPE)
  13    #include <cwctype>
  14#endif
  15
  16#if defined(__BORLANDC__) || (defined(__ICL) && __ICL >= 700)
  17#define CREF const&
  18#else
  19#define CREF
  20#endif
  21
  22#include <climits>
  23#include <boost/spirit/home/classic/phoenix/actor.hpp>
  24#include <boost/spirit/home/classic/phoenix/composite.hpp>
  25#include <boost/config.hpp>
  26#include <boost/mpl/if.hpp>
  27
  28///////////////////////////////////////////////////////////////////////////////
  29namespace phoenix {
  30
  31///////////////////////////////////////////////////////////////////////////////
  32//
  33//  Operators
  34//
  35//      Lazy operators
  36//
  37//      This class provides a mechanism for lazily evaluating operators.
  38//      Syntactically, a lazy operator looks like an ordinary C/C++
  39//      infix, prefix or postfix operator. The operator application
  40//      looks the same. However, unlike ordinary operators, the actual
  41//      operator execution is deferred. (see actor.hpp, primitives.hpp
  42//      and composite.hpp for an overview). Samples:
  43//
  44//          arg1 + arg2
  45//          1 + arg1 * arg2
  46//          1 / -arg1
  47//          arg1 < 150
  48//
  49//      T1 set of classes implement all the C++ free operators. Like
  50//      lazy functions (see functions.hpp), lazy operators are not
  51//      immediately executed when invoked. Instead, a composite (see
  52//      composite.hpp) object is created and returned to the caller.
  53//      Example:
  54//
  55//          (arg1 + arg2) * arg3
  56//
  57//      does nothing more than return a composite. T1 second function
  58//      call will evaluate the actual operators. Example:
  59//
  60//          int i = 4, j = 5, k = 6;
  61//          cout << ((arg1 + arg2) * arg3)(i, j, k);
  62//
  63//      will print out "54".
  64//
  65//      Arbitrarily complex expressions can be lazily evaluated
  66//      following three simple rules:
  67//
  68//          1) Lazy evaluated binary operators apply when at least one
  69//          of the operands is an actor object (see actor.hpp and
  70//          primitives.hpp). Consequently, if an operand is not an actor
  71//          object, it is implicitly converted to an object of type
  72//          actor<value<T> > (where T is the original type of the
  73//          operand).
  74//
  75//          2) Lazy evaluated unary operators apply only to operands
  76//          which are actor objects.
  77//
  78//          3) The result of a lazy operator is a composite actor object
  79//          that can in turn apply to rule 1.
  80//
  81//      Example:
  82//
  83//          arg1 + 3
  84//
  85//      is a lazy expression involving the operator+. Following rule 1,
  86//      lazy evaluation is triggered since arg1 is an instance of an
  87//      actor<argument<N> > class (see primitives.hpp). The right
  88//      operand <3> is implicitly converted to an actor<value<int> >.
  89//      The result of this binary + expression is a composite object,
  90//      following rule 3.
  91//
  92//      Take note that although at least one of the operands must be a
  93//      valid actor class in order for lazy evaluation to take effect,
  94//      if this is not the case and we still want to lazily evaluate an
  95//      expression, we can use var(x), val(x) or cref(x) to transform
  96//      the operand into a valid action object (see primitives.hpp).
  97//      Example:
  98//
  99//          val(1) << 3;
 100//
 101//      Supported operators:
 102//
 103//          Unary operators:
 104//
 105//              prefix:   ~, !, -, +, ++, --, & (reference), * (dereference)
 106//              postfix:  ++, --
 107//
 108//          Binary operators:
 109//
 110//              =, [], +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>=
 111//              +, -, *, /, %, &, |, ^, <<, >>
 112//              ==, !=, <, >, <=, >=
 113//              &&, ||
 114//
 115//      Each operator has a special tag type associated with it. For
 116//      example the binary + operator has a plus_op tag type associated
 117//      with it. This is used to specialize either the unary_operator or
 118//      binary_operator template classes (see unary_operator and
 119//      binary_operator below). Specializations of these unary_operator
 120//      and binary_operator are the actual workhorses that implement the
 121//      operations. The behavior of each lazy operator depends on these
 122//      unary_operator and binary_operator specializations. 'preset'
 123//      specializations conform to the canonical operator rules modeled
 124//      by the behavior of integers and pointers:
 125//
 126//          Prefix -, + and ~ accept constant arguments and return an
 127//          object by value.
 128//
 129//          The ! accept constant arguments and returns a boolean
 130//          result.
 131//
 132//          The & (address-of), * (dereference) both return a reference
 133//          to an object.
 134//
 135//          Prefix ++ returns a reference to its mutable argument after
 136//          it is incremented.
 137//
 138//          Postfix ++ returns the mutable argument by value before it
 139//          is incremented.
 140//
 141//          The += and its family accept mutable right hand side (rhs)
 142//          operand and return a reference to the rhs operand.
 143//
 144//          Infix + and its family accept constant arguments and return
 145//          an object by value.
 146//
 147//          The == and its family accept constant arguments and return a
 148//          boolean result.
 149//
 150//          Operators && and || accept constant arguments and return a
 151//          boolean result and are short circuit evaluated as expected.
 152//
 153///////////////////////////////////////////////////////////////////////////////
 154
 155///////////////////////////////////////////////////////////////////////////////
 156//
 157//  Operator tags
 158//
 159//      Each C++ operator has a corresponding tag type. This is
 160//      used as a means for specializing the unary_operator and
 161//      binary_operator (see below). The tag also serves as the
 162//      lazy operator type compatible as a composite operation
 163//      see (composite.hpp).
 164//
 165///////////////////////////////////////////////////////////////////////////////
 166
 167//  Unary operator tags
 168
 169struct negative_op;         struct positive_op;
 170struct logical_not_op;      struct invert_op;
 171struct reference_op;        struct dereference_op;
 172struct pre_incr_op;         struct pre_decr_op;
 173struct post_incr_op;        struct post_decr_op;
 174
 175//  Binary operator tags
 176
 177struct assign_op;           struct index_op;
 178struct plus_assign_op;      struct minus_assign_op;
 179struct times_assign_op;     struct divide_assign_op;    struct mod_assign_op;
 180struct and_assign_op;       struct or_assign_op;        struct xor_assign_op;
 181struct shift_l_assign_op;   struct shift_r_assign_op;
 182
 183struct plus_op;             struct minus_op;
 184struct times_op;            struct divide_op;           struct mod_op;
 185struct and_op;              struct or_op;               struct xor_op;
 186struct shift_l_op;          struct shift_r_op;
 187
 188struct eq_op;               struct not_eq_op;
 189struct lt_op;               struct lt_eq_op;
 190struct gt_op;               struct gt_eq_op;
 191struct logical_and_op;      struct logical_or_op;
 192
 193///////////////////////////////////////////////////////////////////////////////
 194//
 195//  unary_operator<TagT, T>
 196//
 197//      The unary_operator class implements most of the C++ unary
 198//      operators. Each specialization is basically a simple static eval
 199//      function plus a result_type typedef that determines the return
 200//      type of the eval function.
 201//
 202//      TagT is one of the unary operator tags above and T is the data
 203//      type (argument) involved in the operation.
 204//
 205//      Only the behavior of C/C++ built-in types are taken into account
 206//      in the specializations provided below. For user-defined types,
 207//      these specializations may still be used provided that the
 208//      operator overloads of such types adhere to the standard behavior
 209//      of built-in types.
 210//
 211//      T1 separate special_ops.hpp file implements more stl savvy
 212//      specializations. Other more specialized unary_operator
 213//      implementations may be defined by the client for specific
 214//      unary operator tags/data types.
 215//
 216///////////////////////////////////////////////////////////////////////////////
 217template <typename TagT, typename T>
 218struct unary_operator;
 219
 220//////////////////////////////////
 221template <typename T>
 222struct unary_operator<negative_op, T> {
 223
 224    typedef T const result_type;
 225    static result_type eval(T const& v)
 226    { return -v; }
 227};
 228
 229//////////////////////////////////
 230template <typename T>
 231struct unary_operator<positive_op, T> {
 232
 233    typedef T const result_type;
 234    static result_type eval(T const& v)
 235    { return +v; }
 236};
 237
 238//////////////////////////////////
 239template <typename T>
 240struct unary_operator<logical_not_op, T> {
 241
 242    typedef T const result_type;
 243    static result_type eval(T const& v)
 244    { return !v; }
 245};
 246
 247//////////////////////////////////
 248template <typename T>
 249struct unary_operator<invert_op, T> {
 250
 251    typedef T const result_type;
 252    static result_type eval(T const& v)
 253    { return ~v; }
 254};
 255
 256//////////////////////////////////
 257template <typename T>
 258struct unary_operator<reference_op, T> {
 259
 260    typedef T* result_type;
 261    static result_type eval(T& v)
 262    { return &v; }
 263};
 264
 265//////////////////////////////////
 266template <typename T>
 267struct unary_operator<dereference_op, T*> {
 268
 269    typedef T& result_type;
 270    static result_type eval(T* v)
 271    { return *v; }
 272};
 273
 274//////////////////////////////////
 275template <typename T>
 276struct unary_operator<dereference_op, T* const> {
 277
 278    typedef T& result_type;
 279    static result_type eval(T* const v)
 280    { return *v; }
 281};
 282
 283//////////////////////////////////
 284template <>
 285struct unary_operator<dereference_op, nil_t> {
 286
 287    //  G++ eager template instantiation
 288    //  somehow requires this.
 289    typedef nil_t result_type;
 290};
 291
 292//////////////////////////////////
 293#ifndef __BORLANDC__
 294template <>
 295struct unary_operator<dereference_op, nil_t const> {
 296
 297    //  G++ eager template instantiation
 298    //  somehow requires this.
 299    typedef nil_t result_type;
 300};
 301#endif
 302
 303//////////////////////////////////
 304template <typename T>
 305struct unary_operator<pre_incr_op, T> {
 306
 307    typedef T& result_type;
 308    static result_type eval(T& v)
 309    { return ++v; }
 310};
 311
 312//////////////////////////////////
 313template <typename T>
 314struct unary_operator<pre_decr_op, T> {
 315
 316    typedef T& result_type;
 317    static result_type eval(T& v)
 318    { return --v; }
 319};
 320
 321//////////////////////////////////
 322template <typename T>
 323struct unary_operator<post_incr_op, T> {
 324
 325    typedef T const result_type;
 326    static result_type eval(T& v)
 327    { T t(v); ++v; return t; }
 328};
 329
 330//////////////////////////////////
 331template <typename T>
 332struct unary_operator<post_decr_op, T> {
 333
 334    typedef T const result_type;
 335    static result_type eval(T& v)
 336    { T t(v); --v; return t; }
 337};
 338
 339///////////////////////////////////////////////////////////////////////////////
 340//
 341//  rank<T>
 342//
 343//      rank<T> class has a static int constant 'value' that defines the
 344//      absolute rank of a type. rank<T> is used to choose the result
 345//      type of binary operators such as +. The type with the higher
 346//      rank wins and is used as the operator's return type. T1 generic
 347//      user defined type has a very high rank and always wins when
 348//      compared against a user defined type. If this is not desireable,
 349//      one can write a rank specialization for the type.
 350//
 351//      Take note that ranks 0..9999 are reserved for the framework.
 352//
 353///////////////////////////////////////////////////////////////////////////////
 354template <typename T>
 355struct rank { static int const value = INT_MAX; };
 356
 357template <> struct rank<void>               { static int const value = 0; };
 358template <> struct rank<bool>               { static int const value = 10; };
 359
 360template <> struct rank<char>               { static int const value = 20; };
 361template <> struct rank<signed char>        { static int const value = 20; };
 362template <> struct rank<unsigned char>      { static int const value = 30; };
 363#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
 364template <> struct rank<wchar_t>            { static int const value = 40; };
 365#endif // !defined(BOOST_NO_INTRINSIC_WCHAR_T)
 366
 367template <> struct rank<short>              { static int const value = 50; };
 368template <> struct rank<unsigned short>     { static int const value = 60; };
 369
 370template <> struct rank<int>                { static int const value = 70; };
 371template <> struct rank<unsigned int>       { static int const value = 80; };
 372
 373template <> struct rank<long>               { static int const value = 90; };
 374template <> struct rank<unsigned long>      { static int const value = 100; };
 375
 376#ifdef BOOST_HAS_LONG_LONG
 377template <> struct rank< ::boost::long_long_type>          { static int const value = 110; };
 378template <> struct rank< ::boost::ulong_long_type> { static int const value = 120; };
 379#endif
 380
 381template <> struct rank<float>              { static int const value = 130; };
 382template <> struct rank<double>             { static int const value = 140; };
 383template <> struct rank<long double>        { static int const value = 150; };
 384
 385template <typename T> struct rank<T*>
 386{ static int const value = 160; };
 387
 388template <typename T> struct rank<T* const>
 389{ static int const value = 160; };
 390
 391template <typename T, int N> struct rank<T[N]>
 392{ static int const value = 160; };
 393
 394///////////////////////////////////////////////////////////////////////////////
 395//
 396//  higher_rank<T0, T1>
 397//
 398//      Chooses the type (T0 or T1) with the higher rank.
 399//
 400///////////////////////////////////////////////////////////////////////////////
 401template <typename T0, typename T1>
 402struct higher_rank {
 403    typedef typename boost::mpl::if_c<
 404        rank<T0>::value < rank<T1>::value,
 405        T1, T0>::type type;
 406};
 407
 408///////////////////////////////////////////////////////////////////////////////
 409//
 410//  binary_operator<TagT, T0, T1>
 411//
 412//      The binary_operator class implements most of the C++ binary
 413//      operators. Each specialization is basically a simple static eval
 414//      function plus a result_type typedef that determines the return
 415//      type of the eval function.
 416//
 417//      TagT is one of the binary operator tags above T0 and T1 are the
 418//      (arguments') data types involved in the operation.
 419//
 420//      Only the behavior of C/C++ built-in types are taken into account
 421//      in the specializations provided below. For user-defined types,
 422//      these specializations may still be used provided that the
 423//      operator overloads of such types adhere to the standard behavior
 424//      of built-in types.
 425//
 426//      T1 separate special_ops.hpp file implements more stl savvy
 427//      specializations. Other more specialized unary_operator
 428//      implementations may be defined by the client for specific
 429//      unary operator tags/data types.
 430//
 431//      All binary_operator except the logical_and_op and logical_or_op
 432//      have an eval static function that carries out the actual operation.
 433//      The logical_and_op and logical_or_op d are special because these
 434//      two operators are short-circuit evaluated.
 435//
 436///////////////////////////////////////////////////////////////////////////////
 437template <typename TagT, typename T0, typename T1>
 438struct binary_operator;
 439
 440//////////////////////////////////
 441template <typename T0, typename T1>
 442struct binary_operator<assign_op, T0, T1> {
 443
 444    typedef T0& result_type;
 445    static result_type eval(T0& lhs, T1 const& rhs)
 446    { return lhs = rhs; }
 447};
 448
 449//////////////////////////////////
 450template <typename T1>
 451struct binary_operator<index_op, nil_t, T1> {
 452
 453    //  G++ eager template instantiation
 454    //  somehow requires this.
 455    typedef nil_t result_type;
 456};
 457
 458//////////////////////////////////
 459template <typename T0, typename T1>
 460struct binary_operator<index_op, T0*, T1> {
 461
 462    typedef T0& result_type;
 463    static result_type eval(T0* ptr, T1 const& index)
 464    { return ptr[index]; }
 465};
 466
 467//////////////////////////////////
 468template <typename T0, typename T1>
 469struct binary_operator<index_op, T0* const, T1> {
 470
 471    typedef T0& result_type;
 472    static result_type eval(T0* const ptr, T1 const& index)
 473    { return ptr[index]; }
 474};
 475
 476//////////////////////////////////
 477template <typename T0, int N, typename T1>
 478struct binary_operator<index_op, T0[N], T1> {
 479
 480    typedef T0& result_type;
 481    static result_type eval(T0* ptr, T1 const& index)
 482    { return ptr[index]; }
 483};
 484
 485//////////////////////////////////
 486template <typename T0, typename T1>
 487struct binary_operator<plus_assign_op, T0, T1> {
 488
 489    typedef T0& result_type;
 490    static result_type eval(T0& lhs, T1 const& rhs)
 491    { return lhs += rhs; }
 492};
 493
 494//////////////////////////////////
 495template <typename T0, typename T1>
 496struct binary_operator<minus_assign_op, T0, T1> {
 497
 498    typedef T0& result_type;
 499    static result_type eval(T0& lhs, T1 const& rhs)
 500    { return lhs -= rhs; }
 501};
 502
 503//////////////////////////////////
 504template <typename T0, typename T1>
 505struct binary_operator<times_assign_op, T0, T1> {
 506
 507    typedef T0& result_type;
 508    static result_type eval(T0& lhs, T1 const& rhs)
 509    { return lhs *= rhs; }
 510};
 511
 512//////////////////////////////////
 513template <typename T0, typename T1>
 514struct binary_operator<divide_assign_op, T0, T1> {
 515
 516    typedef T0& result_type;
 517    static result_type eval(T0& lhs, T1 const& rhs)
 518    { return lhs /= rhs; }
 519};
 520
 521//////////////////////////////////
 522template <typename T0, typename T1>
 523struct binary_operator<mod_assign_op, T0, T1> {
 524
 525    typedef T0& result_type;
 526    static result_type eval(T0& lhs, T1 const& rhs)
 527    { return lhs %= rhs; }
 528};
 529
 530//////////////////////////////////
 531template <typename T0, typename T1>
 532struct binary_operator<and_assign_op, T0, T1> {
 533
 534    typedef T0& result_type;
 535    static result_type eval(T0& lhs, T1 const& rhs)
 536    { return lhs &= rhs; }
 537};
 538
 539//////////////////////////////////
 540template <typename T0, typename T1>
 541struct binary_operator<or_assign_op, T0, T1> {
 542
 543    typedef T0& result_type;
 544    static result_type eval(T0& lhs, T1 const& rhs)
 545    { return lhs |= rhs; }
 546};
 547
 548//////////////////////////////////
 549template <typename T0, typename T1>
 550struct binary_operator<xor_assign_op, T0, T1> {
 551
 552    typedef T0& result_type;
 553    static result_type eval(T0& lhs, T1 const& rhs)
 554    { return lhs ^= rhs; }
 555};
 556
 557//////////////////////////////////
 558template <typename T0, typename T1>
 559struct binary_operator<shift_l_assign_op, T0, T1> {
 560
 561    typedef T0& result_type;
 562    static result_type eval(T0& lhs, T1 const& rhs)
 563    { return lhs <<= rhs; }
 564};
 565
 566//////////////////////////////////
 567template <typename T0, typename T1>
 568struct binary_operator<shift_r_assign_op, T0, T1> {
 569
 570    typedef T0& result_type;
 571    static result_type eval(T0& lhs, T1 const& rhs)
 572    { return lhs >>= rhs; }
 573};
 574
 575//////////////////////////////////
 576template <typename T0, typename T1>
 577struct binary_operator<plus_op, T0, T1> {
 578
 579    typedef typename higher_rank<T0, T1>::type const result_type;
 580    static result_type eval(T0 const& lhs, T1 const& rhs)
 581    { return lhs + rhs; }
 582};
 583
 584//////////////////////////////////
 585template <typename T0, typename T1>
 586struct binary_operator<minus_op, T0, T1> {
 587
 588    typedef typename higher_rank<T0, T1>::type const result_type;
 589    static result_type eval(T0 const& lhs, T1 const& rhs)
 590    { return lhs - rhs; }
 591};
 592
 593//////////////////////////////////
 594template <typename T0, typename T1>
 595struct binary_operator<times_op, T0, T1> {
 596
 597    typedef typename higher_rank<T0, T1>::type const result_type;
 598    static result_type eval(T0 const& lhs, T1 const& rhs)
 599    { return lhs * rhs; }
 600};
 601
 602//////////////////////////////////
 603template <typename T0, typename T1>
 604struct binary_operator<divide_op, T0, T1> {
 605
 606    typedef typename higher_rank<T0, T1>::type const result_type;
 607    static result_type eval(T0 const& lhs, T1 const& rhs)
 608    { return lhs / rhs; }
 609};
 610
 611//////////////////////////////////
 612template <typename T0, typename T1>
 613struct binary_operator<mod_op, T0, T1> {
 614
 615    typedef typename higher_rank<T0, T1>::type const result_type;
 616    static result_type eval(T0 const& lhs, T1 const& rhs)
 617    { return lhs % rhs; }
 618};
 619
 620//////////////////////////////////
 621template <typename T0, typename T1>
 622struct binary_operator<and_op, T0, T1> {
 623
 624    typedef typename higher_rank<T0, T1>::type const result_type;
 625    static result_type eval(T0 const& lhs, T1 const& rhs)
 626    { return lhs & rhs; }
 627};
 628
 629//////////////////////////////////
 630template <typename T0, typename T1>
 631struct binary_operator<or_op, T0, T1> {
 632
 633    typedef typename higher_rank<T0, T1>::type const result_type;
 634    static result_type eval(T0 const& lhs, T1 const& rhs)
 635    { return lhs | rhs; }
 636};
 637
 638//////////////////////////////////
 639template <typename T0, typename T1>
 640struct binary_operator<xor_op, T0, T1> {
 641
 642    typedef typename higher_rank<T0, T1>::type const result_type;
 643    static result_type eval(T0 const& lhs, T1 const& rhs)
 644    { return lhs ^ rhs; }
 645};
 646
 647//////////////////////////////////
 648template <typename T0, typename T1>
 649struct binary_operator<shift_l_op, T0, T1> {
 650
 651    typedef T0 const result_type;
 652    static result_type eval(T0 const& lhs, T1 const& rhs)
 653    { return lhs << rhs; }
 654};
 655
 656//////////////////////////////////
 657template <typename T0, typename T1>
 658struct binary_operator<shift_r_op, T0, T1> {
 659
 660    typedef T0 const result_type;
 661    static result_type eval(T0 const& lhs, T1 const& rhs)
 662    { return lhs >> rhs; }
 663};
 664
 665//////////////////////////////////
 666template <typename T0, typename T1>
 667struct binary_operator<eq_op, T0, T1> {
 668
 669    typedef bool result_type;
 670    static result_type eval(T0 const& lhs, T1 const& rhs)
 671    { return lhs == rhs; }
 672};
 673
 674//////////////////////////////////
 675template <typename T0, typename T1>
 676struct binary_operator<not_eq_op, T0, T1> {
 677
 678    typedef bool result_type;
 679    static result_type eval(T0 const& lhs, T1 const& rhs)
 680    { return lhs != rhs; }
 681};
 682
 683//////////////////////////////////
 684template <typename T0, typename T1>
 685struct binary_operator<lt_op, T0, T1> {
 686
 687    typedef bool result_type;
 688    static result_type eval(T0 const& lhs, T1 const& rhs)
 689    { return lhs < rhs; }
 690};
 691
 692//////////////////////////////////
 693template <typename T0, typename T1>
 694struct binary_operator<lt_eq_op, T0, T1> {
 695
 696    typedef bool result_type;
 697    static result_type eval(T0 const& lhs, T1 const& rhs)
 698    { return lhs <= rhs; }
 699};
 700
 701//////////////////////////////////
 702template <typename T0, typename T1>
 703struct binary_operator<gt_op, T0, T1> {
 704
 705    typedef bool result_type;
 706    static result_type eval(T0 const& lhs, T1 const& rhs)
 707    { return lhs > rhs; }
 708};
 709
 710//////////////////////////////////
 711template <typename T0, typename T1>
 712struct binary_operator<gt_eq_op, T0, T1> {
 713
 714    typedef bool result_type;
 715    static result_type eval(T0 const& lhs, T1 const& rhs)
 716    { return lhs >= rhs; }
 717};
 718
 719//////////////////////////////////
 720template <typename T0, typename T1>
 721struct binary_operator<logical_and_op, T0, T1> {
 722
 723    typedef bool result_type;
 724    //  no eval function, see comment above.
 725};
 726
 727//////////////////////////////////
 728template <typename T0, typename T1>
 729struct binary_operator<logical_or_op, T0, T1> {
 730
 731    typedef bool result_type;
 732    //  no eval function, see comment above.
 733};
 734
 735///////////////////////////////////////////////////////////////////////////////
 736//
 737//  negative lazy operator (prefix -)
 738//
 739///////////////////////////////////////////////////////////////////////////////
 740struct negative_op {
 741
 742    template <typename T0>
 743    struct result {
 744
 745        typedef typename unary_operator<negative_op, T0>::result_type type;
 746    };
 747
 748    template <typename T0>
 749    typename unary_operator<negative_op, T0>::result_type
 750    operator()(T0& _0) const
 751    { return unary_operator<negative_op, T0>::eval(_0); }
 752};
 753
 754//////////////////////////////////
 755template <typename BaseT>
 756inline typename impl::make_unary<negative_op, BaseT>::type
 757operator-(actor<BaseT> const& _0)
 758{
 759    return impl::make_unary<negative_op, BaseT>::construct(_0);
 760}
 761
 762///////////////////////////////////////////////////////////////////////////////
 763//
 764//  positive lazy operator (prefix +)
 765//
 766///////////////////////////////////////////////////////////////////////////////
 767struct positive_op {
 768
 769    template <typename T0>
 770    struct result {
 771
 772        typedef typename unary_operator<positive_op, T0>::result_type type;
 773    };
 774
 775    template <typename T0>
 776    typename unary_operator<positive_op, T0>::result_type
 777    operator()(T0& _0) const
 778    { return unary_operator<positive_op, T0>::eval(_0); }
 779};
 780
 781//////////////////////////////////
 782template <typename BaseT>
 783inline typename impl::make_unary<positive_op, BaseT>::type
 784operator+(actor<BaseT> const& _0)
 785{
 786    return impl::make_unary<positive_op, BaseT>::construct(_0);
 787}
 788
 789///////////////////////////////////////////////////////////////////////////////
 790//
 791//  logical not lazy operator (prefix !)
 792//
 793///////////////////////////////////////////////////////////////////////////////
 794struct logical_not_op {
 795
 796    template <typename T0>
 797    struct result {
 798
 799        typedef typename unary_operator<logical_not_op, T0>::result_type type;
 800    };
 801
 802    template <typename T0>
 803    typename unary_operator<logical_not_op, T0>::result_type
 804    operator()(T0& _0) const
 805    { return unary_operator<logical_not_op, T0>::eval(_0); }
 806};
 807
 808//////////////////////////////////
 809template <typename BaseT>
 810inline typename impl::make_unary<logical_not_op, BaseT>::type
 811operator!(actor<BaseT> const& _0)
 812{
 813    return impl::make_unary<logical_not_op, BaseT>::construct(_0);
 814}
 815
 816///////////////////////////////////////////////////////////////////////////////
 817//
 818//  invert lazy operator (prefix ~)
 819//
 820///////////////////////////////////////////////////////////////////////////////
 821struct invert_op {
 822
 823    template <typename T0>
 824    struct result {
 825
 826        typedef typename unary_operator<invert_op, T0>::result_type type;
 827    };
 828
 829    template <typename T0>
 830    typename unary_operator<invert_op, T0>::result_type
 831    operator()(T0& _0) const
 832    { return unary_operator<invert_op, T0>::eval(_0); }
 833};
 834
 835//////////////////////////////////
 836template <typename BaseT>
 837inline typename impl::make_unary<invert_op, BaseT>::type
 838operator~(actor<BaseT> const& _0)
 839{
 840    return impl::make_unary<invert_op, BaseT>::construct(_0);
 841}
 842
 843///////////////////////////////////////////////////////////////////////////////
 844//
 845//  reference lazy operator (prefix &)
 846//
 847///////////////////////////////////////////////////////////////////////////////
 848struct reference_op {
 849
 850    template <typename T0>
 851    struct result {
 852
 853        typedef typename unary_operator<reference_op, T0>::result_type type;
 854    };
 855
 856    template <typename T0>
 857    typename unary_operator<reference_op, T0>::result_type
 858    operator()(T0& _0) const
 859    { return unary_operator<reference_op, T0>::eval(_0); }
 860};
 861
 862//////////////////////////////////
 863template <typename BaseT>
 864inline typename impl::make_unary<reference_op, BaseT>::type
 865operator&(actor<BaseT> const& _0)
 866{
 867    return impl::make_unary<reference_op, BaseT>::construct(_0);
 868}
 869
 870///////////////////////////////////////////////////////////////////////////////
 871//
 872//  dereference lazy operator (prefix *)
 873//
 874///////////////////////////////////////////////////////////////////////////////
 875struct dereference_op {
 876
 877    template <typename T0>
 878    struct result {
 879
 880        typedef typename unary_operator<dereference_op, T0>::result_type type;
 881    };
 882
 883    template <typename T0>
 884    typename unary_operator<dereference_op, T0>::result_type
 885    operator()(T0& _0) const
 886    { return unary_operator<dereference_op, T0>::eval(_0); }
 887};
 888
 889//////////////////////////////////
 890template <typename BaseT>
 891inline typename impl::make_unary<dereference_op, BaseT>::type
 892operator*(actor<BaseT> const& _0)
 893{
 894    return impl::make_unary<dereference_op, BaseT>::construct(_0);
 895}
 896
 897///////////////////////////////////////////////////////////////////////////////
 898//
 899//  pre increment lazy operator (prefix ++)
 900//
 901///////////////////////////////////////////////////////////////////////////////
 902struct pre_incr_op {
 903
 904    template <typename T0>
 905    struct result {
 906
 907        typedef typename unary_operator<pre_incr_op, T0>::result_type type;
 908    };
 909
 910    template <typename T0>
 911    typename unary_operator<pre_incr_op, T0>::result_type
 912    operator()(T0& _0) const
 913    { return unary_operator<pre_incr_op, T0>::eval(_0); }
 914};
 915
 916//////////////////////////////////
 917template <typename BaseT>
 918inline typename impl::make_unary<pre_incr_op, BaseT>::type
 919operator++(actor<BaseT> const& _0)
 920{
 921    return impl::make_unary<pre_incr_op, BaseT>::construct(_0);
 922}
 923
 924///////////////////////////////////////////////////////////////////////////////
 925//
 926//  pre decrement lazy operator (prefix --)
 927//
 928///////////////////////////////////////////////////////////////////////////////
 929struct pre_decr_op {
 930
 931    template <typename T0>
 932    struct result {
 933
 934        typedef typename unary_operator<pre_decr_op, T0>::result_type type;
 935    };
 936
 937    template <typename T0>
 938    typename unary_operator<pre_decr_op, T0>::result_type
 939    operator()(T0& _0) const
 940    { return unary_operator<pre_decr_op, T0>::eval(_0); }
 941};
 942
 943//////////////////////////////////
 944template <typename BaseT>
 945inline typename impl::make_unary<pre_decr_op, BaseT>::type
 946operator--(actor<BaseT> const& _0)
 947{
 948    return impl::make_unary<pre_decr_op, BaseT>::construct(_0);
 949}
 950
 951///////////////////////////////////////////////////////////////////////////////
 952//
 953//  post increment lazy operator (postfix ++)
 954//
 955///////////////////////////////////////////////////////////////////////////////
 956struct post_incr_op {
 957
 958    template <typename T0>
 959    struct result {
 960
 961        typedef typename unary_operator<post_incr_op, T0>::result_type type;
 962    };
 963
 964    template <typename T0>
 965    typename unary_operator<post_incr_op, T0>::result_type
 966    operator()(T0& _0) const
 967    { return unary_operator<post_incr_op, T0>::eval(_0); }
 968};
 969
 970//////////////////////////////////
 971template <typename BaseT>
 972inline typename impl::make_unary<post_incr_op, BaseT>::type
 973operator++(actor<BaseT> const& _0, int)
 974{
 975    return impl::make_unary<post_incr_op, BaseT>::construct(_0);
 976}
 977
 978///////////////////////////////////////////////////////////////////////////////
 979//
 980//  post decrement lazy operator (postfix --)
 981//
 982///////////////////////////////////////////////////////////////////////////////
 983struct post_decr_op {
 984
 985    template <typename T0>
 986    struct result {
 987
 988        typedef typename unary_operator<post_decr_op, T0>::result_type type;
 989    };
 990
 991    template <typename T0>
 992    typename unary_operator<post_decr_op, T0>::result_type
 993    operator()(T0& _0) const
 994    { return unary_operator<post_decr_op, T0>::eval(_0); }
 995};
 996
 997//////////////////////////////////
 998template <typename BaseT>
 999inline typename impl::make_unary<post_decr_op, BaseT>::type
1000operator--(actor<BaseT> const& _0, int)
1001{
1002    return impl::make_unary<post_decr_op, BaseT>::construct(_0);
1003}
1004
1005///////////////////////////////////////////////////////////////////////////////
1006//
1007//  assignment lazy operator (infix =)
1008//  The acual lazy operator is a member of the actor class.
1009//
1010///////////////////////////////////////////////////////////////////////////////
1011struct assign_op {
1012
1013    template <typename T0, typename T1>
1014    struct result {
1015
1016        typedef typename binary_operator<assign_op, T0, T1>
1017            ::result_type type;
1018    };
1019
1020    template <typename T0, typename T1>
1021    typename binary_operator<assign_op, T0, T1>::result_type
1022    operator()(T0& _0, T1& _1) const
1023    { return binary_operator<assign_op, T0, T1>::eval(_0, _1); }
1024};
1025
1026//////////////////////////////////
1027template <typename BaseT>
1028template <typename B>
1029inline typename impl::make_binary1<assign_op, BaseT, B>::type
1030actor<BaseT>::operator=(B const& _1) const
1031{
1032    return impl::make_binary1<assign_op, BaseT, B>::construct(*this, _1);
1033}
1034
1035///////////////////////////////////////////////////////////////////////////////
1036//
1037//  index lazy operator (array index [])
1038//  The acual lazy operator is a member of the actor class.
1039//
1040///////////////////////////////////////////////////////////////////////////////
1041struct index_op {
1042
1043    template <typename T0, typename T1>
1044    struct result {
1045
1046        typedef typename binary_operator<index_op, T0, T1>
1047            ::result_type type;
1048    };
1049
1050    template <typename T0, typename T1>
1051    typename binary_operator<index_op, T0, T1>::result_type
1052    operator()(T0& _0, T1& _1) const
1053    { return binary_operator<index_op, T0, T1>::eval(_0, _1); }
1054};
1055
1056//////////////////////////////////
1057template <typename BaseT>
1058template <typename B>
1059inline typename impl::make_binary1<index_op, BaseT, B>::type
1060actor<BaseT>::operator[](B const& _1) const
1061{
1062    return impl::make_binary1<index_op, BaseT, B>::construct(*this, _1);
1063}
1064
1065///////////////////////////////////////////////////////////////////////////////
1066//
1067//  plus assign lazy operator (infix +=)
1068//
1069///////////////////////////////////////////////////////////////////////////////
1070struct plus_assign_op {
1071
1072    template <typename T0, typename T1>
1073    struct result {
1074
1075        typedef typename binary_operator<plus_assign_op, T0, T1>
1076            ::result_type type;
1077    };
1078
1079    template <typename T0, typename T1>
1080    typename binary_operator<plus_assign_op, T0, T1>::result_type
1081    operator()(T0& _0, T1& _1) const
1082    { return binary_operator<plus_assign_op, T0, T1>::eval(_0, _1); }
1083};
1084
1085//////////////////////////////////
1086template <typename BaseT, typename T1>
1087inline typename impl::make_binary1<plus_assign_op, BaseT, T1>::type
1088operator+=(actor<BaseT> const& _0, T1 CREF _1)
1089{
1090    return impl::make_binary1<plus_assign_op, BaseT, T1>::construct(_0, _1);
1091}
1092
1093///////////////////////////////////////////////////////////////////////////////
1094//
1095//  minus assign lazy operator (infix -=)
1096//
1097///////////////////////////////////////////////////////////////////////////////
1098struct minus_assign_op {
1099
1100    template <typename T0, typename T1>
1101    struct result {
1102
1103        typedef typename binary_operator<minus_assign_op, T0, T1>
1104            ::result_type type;
1105    };
1106
1107    template <typename T0, typename T1>
1108    typename binary_operator<minus_assign_op, T0, T1>::result_type
1109    operator()(T0& _0, T1& _1) const
1110    { return binary_operator<minus_assign_op, T0, T1>::eval(_0, _1); }
1111};
1112
1113//////////////////////////////////
1114template <typename BaseT, typename T1>
1115inline typename impl::make_binary1<minus_assign_op, BaseT, T1>::type
1116operator-=(actor<BaseT> const& _0, T1 CREF _1)
1117{
1118    return impl::make_binary1<minus_assign_op, BaseT, T1>::construct(_0, _1);
1119}
1120
1121///////////////////////////////////////////////////////////////////////////////
1122//
1123//  times assign lazy operator (infix *=)
1124//
1125///////////////////////////////////////////////////////////////////////////////
1126struct times_assign_op {
1127
1128    template <typename T0, typename T1>
1129    struct result {
1130
1131        typedef typename binary_operator<times_assign_op, T0, T1>
1132            ::result_type type;
1133    };
1134
1135    template <typename T0, typename T1>
1136    typename binary_operator<times_assign_op, T0, T1>::result_type
1137    operator()(T0& _0, T1& _1) const
1138    { return binary_operator<times_assign_op, T0, T1>::eval(_0, _1); }
1139};
1140
1141//////////////////////////////////
1142template <typename BaseT, typename T1>
1143inline typename impl::make_binary1<times_assign_op, BaseT, T1>::type
1144operator*=(actor<BaseT> const& _0, T1 CREF _1)
1145{
1146    return impl::make_binary1<times_assign_op, BaseT, T1>::construct(_0, _1);
1147}
1148
1149///////////////////////////////////////////////////////////////////////////////
1150//
1151//  divide assign lazy operator (infix /=)
1152//
1153///////////////////////////////////////////////////////////////////////////////
1154struct divide_assign_op {
1155
1156    template <typename T0, typename T1>
1157    struct result {
1158
1159        typedef typename binary_operator<divide_assign_op, T0, T1>
1160            ::result_type type;
1161    };
1162
1163    template <typename T0, typename T1>
1164    typename binary_operator<divide_assign_op, T0, T1>::result_type
1165    operator()(T0& _0, T1& _1) const
1166    { return binary_operator<divide_assign_op, T0, T1>::eval(_0, _1); }
1167};
1168
1169//////////////////////////////////
1170template <typename BaseT, typename T1>
1171inline typename impl::make_binary1<divide_assign_op, BaseT, T1>::type
1172operator/=(actor<BaseT> const& _0, T1 CREF _1)
1173{
1174    return impl::make_binary1<divide_assign_op, BaseT, T1>::construct(_0, _1);
1175}
1176
1177///////////////////////////////////////////////////////////////////////////////
1178//
1179//  mod assign lazy operator (infix %=)
1180//
1181///////////////////////////////////////////////////////////////////////////////
1182struct mod_assign_op {
1183
1184    template <typename T0, typename T1>
1185    struct result {
1186
1187        typedef typename binary_operator<mod_assign_op, T0, T1>
1188            ::result_type type;
1189    };
1190
1191    template <typename T0, typename T1>
1192    typename binary_operator<mod_assign_op, T0, T1>::result_type
1193    operator()(T0& _0, T1& _1) const
1194    { return binary_operator<mod_assign_op, T0, T1>::eval(_0, _1); }
1195};
1196
1197//////////////////////////////////
1198template <typename BaseT, typename T1>
1199inline typename impl::make_binary1<mod_assign_op, BaseT, T1>::type
1200operator%=(actor<BaseT> const& _0, T1 CREF _1)
1201{
1202    return impl::make_binary1<mod_assign_op, BaseT, T1>::construct(_0, _1);
1203}
1204
1205///////////////////////////////////////////////////////////////////////////////
1206//
1207//  and assign lazy operator (infix &=)
1208//
1209///////////////////////////////////////////////////////////////////////////////
1210struct and_assign_op {
1211
1212    template <typename T0, typename T1>
1213    struct result {
1214
1215        typedef typename binary_operator<and_assign_op, T0, T1>
1216            ::result_type type;
1217    };
1218
1219    template <typename T0, typename T1>
1220    typename binary_operator<and_assign_op, T0, T1>::result_type
1221    operator()(T0& _0, T1& _1) const
1222    { return binary_operator<and_assign_op, T0, T1>::eval(_0, _1); }
1223};
1224
1225//////////////////////////////////
1226template <typename BaseT, typename T1>
1227inline typename impl::make_binary1<and_assign_op, BaseT, T1>::type
1228operator&=(actor<BaseT> const& _0, T1 CREF _1)
1229{
1230    return impl::make_binary1<and_assign_op, BaseT, T1>::construct(_0, _1);
1231}
1232
1233///////////////////////////////////////////////////////////////////////////////
1234//
1235//  or assign lazy operator (infix |=)
1236//
1237///////////////////////////////////////////////////////////////////////////////
1238struct or_assign_op {
1239
1240    template <typename T0, typename T1>
1241    struct result {
1242
1243        typedef typename binary_operator<or_assign_op, T0, T1>
1244            ::result_type type;
1245    };
1246
1247    template <typename T0, typename T1>
1248    typename binary_operator<or_assign_op, T0, T1>::result_type
1249    operator()(T0& _0, T1& _1) const
1250    { return binary_operator<or_assign_op, T0, T1>::eval(_0, _1); }
1251};
1252
1253//////////////////////////////////
1254template <typename BaseT, typename T1>
1255inline typename impl::make_binary1<or_assign_op, BaseT, T1>::type
1256operator|=(actor<BaseT> const& _0, T1 CREF _1)
1257{
1258    return impl::make_binary1<or_assign_op, BaseT, T1>::construct(_0, _1);
1259}
1260
1261///////////////////////////////////////////////////////////////////////////////
1262//
1263//  xor assign lazy operator (infix ^=)
1264//
1265///////////////////////////////////////////////////////////////////////////////
1266struct xor_assign_op {
1267
1268    template <typename T0, typename T1>
1269    struct result {
1270
1271        typedef typename binary_operator<xor_assign_op, T0, T1>
1272            ::result_type type;
1273    };
1274
1275    template <typename T0, typename T1>
1276    typename binary_operator<xor_assign_op, T0, T1>::result_type
1277    operator()(T0& _0, T1& _1) const
1278    { return binary_operator<xor_assign_op, T0, T1>::eval(_0, _1); }
1279};
1280
1281//////////////////////////////////
1282template <typename BaseT, typename T1>
1283inline typename impl::make_binary1<xor_assign_op, BaseT, T1>::type
1284operator^=(actor<BaseT> const& _0, T1 CREF _1)
1285{
1286    return impl::make_binary1<xor_assign_op, BaseT, T1>::construct(_0, _1);
1287}
1288
1289///////////////////////////////////////////////////////////////////////////////
1290//
1291//  shift left assign lazy operator (infix <<=)
1292//
1293///////////////////////////////////////////////////////////////////////////////
1294struct shift_l_assign_op {
1295
1296    template <typename T0, typename T1>
1297    struct result {
1298
1299        typedef typename binary_operator<shift_l_assign_op, T0, T1>
1300            ::result_type type;
1301    };
1302
1303    template <typename T0, typename T1>
1304    typename binary_operator<shift_l_assign_op, T0, T1>::result_type
1305    operator()(T0& _0, T1& _1) const
1306    { return binary_operator<shift_l_assign_op, T0, T1>::eval(_0, _1); }
1307};
1308
1309//////////////////////////////////
1310template <typename BaseT, typename T1>
1311inline typename impl::make_binary1<shift_l_assign_op, BaseT, T1>::type
1312operator<<=(actor<BaseT> const& _0, T1 CREF _1)
1313{
1314    return impl::make_binary1<shift_l_assign_op, BaseT, T1>::construct(_0, _1);
1315}
1316
1317///////////////////////////////////////////////////////////////////////////////
1318//
1319//  shift right assign lazy operator (infix >>=)
1320//
1321///////////////////////////////////////////////////////////////////////////////
1322struct shift_r_assign_op {
1323
1324    template <typename T0, typename T1>
1325    struct result {
1326
1327        typedef typename binary_operator<shift_r_assign_op, T0, T1>
1328            ::result_type type;
1329    };
1330
1331    template <typename T0, typename T1>
1332    typename binary_operator<shift_r_assign_op, T0, T1>::result_type
1333    operator()(T0& _0, T1& _1) const
1334    { return binary_operator<shift_r_assign_op, T0, T1>::eval(_0, _1); }
1335};
1336
1337//////////////////////////////////
1338template <typename BaseT, typename T1>
1339inline typename impl::make_binary1<shift_r_assign_op, BaseT, T1>::type
1340operator>>=(actor<BaseT> const& _0, T1 CREF _1)
1341{
1342    return impl::make_binary1<shift_r_assign_op, BaseT, T1>::construct(_0, _1);
1343}
1344
1345///////////////////////////////////////////////////////////////////////////////
1346//
1347//  plus lazy operator (infix +)
1348//
1349///////////////////////////////////////////////////////////////////////////////
1350struct plus_op {
1351
1352    template <typename T0, typename T1>
1353    struct result {
1354
1355        typedef typename binary_operator<plus_op, T0, T1>
1356            ::result_type type;
1357    };
1358
1359    template <typename T0, typename T1>
1360    typename binary_operator<plus_op, T0, T1>::result_type
1361    operator()(T0& _0, T1& _1) const
1362    { return binary_operator<plus_op, T0, T1>::eval(_0, _1); }
1363};
1364
1365//////////////////////////////////
1366template <typename BaseT, typename T1>
1367inline typename impl::make_binary1<plus_op, BaseT, T1>::type
1368operator+(actor<BaseT> const& _0, T1 CREF _1)
1369{
1370    return impl::make_binary1<plus_op, BaseT, T1>::construct(_0, _1);
1371}
1372
1373//////////////////////////////////
1374template <typename T0, typename BaseT>
1375inline typename impl::make_binary2<plus_op, T0, BaseT>::type
1376operator+(T0 CREF _0, actor<BaseT> const& _1)
1377{
1378    return impl::make_binary2<plus_op, T0, BaseT>::construct(_0, _1);
1379}
1380
1381//////////////////////////////////
1382template <typename BaseT0, typename BaseT1>
1383inline typename impl::make_binary3<plus_op, BaseT0, BaseT1>::type
1384operator+(actor<BaseT0> const& _0, actor<BaseT1> const& _1)
1385{
1386    return impl::make_binary3<plus_op, BaseT0, BaseT1>::construct(_0, _1);
1387}
1388
1389///////////////////////////////////////////////////////////////////////////////
1390//
1391//  minus lazy operator (infix -)
1392//
1393///////////////////////////////////////////////////////////////////////////////
1394struct minus_op {
1395
1396    template <typename T0, typename T1>
1397    struct result {
1398
1399        typedef typename binary_operator<minus_op, T0, T1>
1400            ::result_type type;
1401    };
1402
1403    template <typename T0, typename T1>
1404    typename binary_operator<minus_op, T0, T1>::result_type
1405    operator()(T0& _0, T1& _1) const
1406    { return binary_operator<minus_op, T0, T1>::eval(_0, _1); }
1407};
1408
1409//////////////////////////////////
1410template <typename BaseT, typename T1>
1411inline typename impl::make_binary1<minus_op, BaseT, T1>::type
1412operator-(actor<BaseT> const& _0, T1 CREF _1)
1413{
1414    return impl::make_binary1<minus_op, BaseT, T1>::construct(_0, _1);
1415}
1416
1417//////////////////////////////////
1418template <typename T0, typename BaseT>
1419inline typename impl::make_binary2<minus_op, T0, BaseT>::type
1420operator-(T0 CREF _0, actor<BaseT> const& _1)
1421{
1422    return impl::make_binary2<minus_op, T0, BaseT>::construct(_0, _1);
1423}
1424
1425//////////////////////////////////
1426template <typename BaseT0, typename BaseT1>
1427inline typename impl::make_binary3<minus_op, BaseT0, BaseT1>::type
1428operator-(actor<BaseT0> const& _0, actor<BaseT1> const& _1)
1429{
1430    return impl::make_binary3<minus_op, BaseT0, BaseT1>::construct(_0, _1);
1431}
1432
1433///////////////////////////////////////////////////////////////////////////////
1434//
1435//  times lazy operator (infix *)
1436//
1437///////////////////////////////////////////////////////////////////////////////
1438struct times_op {
1439
1440    template <typename T0, typename T1>
1441    struct result {
1442
1443        typedef typename binary_operator<times_op, T0, T1>
1444            ::result_type type;
1445    };
1446
1447    template <typename T0, typename T1>
1448    typename binary_operator<times_op, T0, T1>::result_type
1449    operator()(T0& _0, T1& _1) const
1450    { return binary_operator<times_op, T0, T1>::eval(_0, _1); }
1451};
1452
1453//////////////////////////////////
1454template <typename BaseT, typename T1>
1455inline typename impl::make_binary1<times_op, BaseT, T1>::type
1456operator*(actor<BaseT> const& _0, T1 CREF _1)
1457{
1458    return impl::make_binary1<times_op, BaseT, T1>::construct(_0, _1);
1459}
1460
1461//////////////////////////////////
1462template <typename T0, typename BaseT>
1463inline typename impl::make_binary2<times_op, T0, BaseT>::type
1464operator*(T0 CREF _0, actor<BaseT> const& _1)
1465{
1466    return impl::make_binary2<times_op, T0, BaseT>::construct(_0, _1);
1467}
1468
1469//////////////////////////////////
1470template <typename BaseT0, typename BaseT1>
1471inline typename impl::make_binary3<times_op, BaseT0, BaseT1>::type
1472operator*(actor<BaseT0> const& _0, actor<BaseT1> const& _1)
1473{
1474    return impl::make_binary3<times_op, BaseT0, BaseT1>::construct(_0, _1);
1475}
1476
1477///////////////////////////////////////////////////////////////////////////////
1478//
1479//  divide lazy operator (infix /)
1480//
1481///////////////////////////////////////////////////////////////////////////////
1482struct divide_op {
1483
1484    template <typename T0, typename T1>
1485    struct result {
1486
1487        typedef typename binary_operator<divide_op, T0, T1>
1488            ::result_type type;
1489    };
1490
1491    template <typename T0, typename T1>
1492    typename binary_operator<divide_op, T0, T1>::result_type
1493    operator()(T0& _0, T1& _1) const
1494    { return binary_operator<divide_op, T0, T1>::eval(_0, _1); }
1495};
1496
1497//////////////////////////////////
1498template <typename BaseT, typename T1>
1499inline typename impl::make_binary1<divide_op, BaseT, T1>::type
1500operator/(actor<BaseT> const& _0, T1 CREF _1)
1501{
1502    return impl::make_binary1<divide_op, BaseT, T1>::construct(_0, _1);
1503}
1504
1505//////////////////////////////////
1506template <typename T0, typename BaseT>
1507inline typename impl::make_binary2<divide_op, T0, BaseT>::type
1508operator/(T0 CREF _0, actor<BaseT> const& _1)
1509{
1510    return impl::make_binary2<divide_op, T0, BaseT>::construct(_0, _1);
1511}
1512
1513//////////////////////////////////
1514template <typename BaseT0, typename BaseT1>
1515inline typename impl::make_binary3<divide_op, BaseT0, BaseT1>::type
1516operator/(actor<BaseT0> const& _0, actor<BaseT1> const& _1)
1517{
1518    return impl::make_binary3<divide_op, BaseT0, BaseT1>::construct(_0, _1);
1519}
1520
1521///////////////////////////////////////////////////////////////////////////////
1522//
1523//  mod lazy operator (infix %)
1524//
1525///////////////////////////////////////////////////////////////////////////////
1526struct mod_op {
1527
1528    template <typename T0, typename T1>
1529    struct result {
1530
1531        typedef typename binary_operator<mod_op, T0, T1>
1532            ::result_type type;
1533    };
1534
1535    template <typename T0, typename T1>
1536    typename binary_operator<mod_op, T0, T1>::result_type
1537    operator()(T0& _0, T1& _1) const
1538    { return binary_operator<mod_op, T0, T1>::eval(_0, _1); }
1539};
1540
1541//////////////////////////////////
1542template <typename BaseT, typename T1>
1543inline typename impl::make_binary1<mod_op, BaseT, T1>::type
1544operator%(actor<BaseT> const& _0, T1 CREF _1)
1545{
1546    return impl::make_binary1<mod_op, BaseT, T1>::construct(_0, _1);
1547}
1548
1549//////////////////////////////////
1550template <typename T0, typename BaseT>
1551inline typename impl::make_binary2<mod_op, T0, BaseT>::type
1552operator%(T0 CREF _0, actor<BaseT> const& _1)
1553{
1554    return impl::make_binary2<mod_op, T0, BaseT>::construct(_0, _1);
1555}
1556
1557//////////////////////////////////
1558template <typename BaseT0, typename BaseT1>
1559inline typename impl::make_binary3<mod_op, BaseT0, BaseT1>::type
1560operator%(actor<BaseT0> const& _0, actor<BaseT1> const& _1)
1561{
1562    return impl::make_binary3<mod_op, BaseT0, BaseT1>::construct(_0, _1);
1563}
1564
1565///////////////////////////////////////////////////////////////////////////////
1566//
1567//  and lazy operator (infix &)
1568//
1569///////////////////////////////////////////////////////////////////////////////
1570struct and_op {
1571
1572    template <typename T0, typename T1>
1573    struct result {
1574
1575        typedef typename binary_operator<and_op, T0, T1>
1576            ::result_type type;
1577    };
1578
1579    template <typename T0, typename T1>
1580    typename binary_operator<and_op, T0, T1>::result_type
1581    operator()(T0& _0, T1& _1) const
1582    { return binary_operator<and_op, T0, T1>::eval(_0, _1); }
1583};
1584
1585//////////////////////////////////
1586template <typename BaseT, typename T1>
1587inline typename impl::make_binary1<and_op, BaseT, T1>::type
1588operator&(actor<BaseT> const& _0, T1 CREF _1)
1589{
1590    return impl::make_binary1<and_op, BaseT, T1>::construct(_0, _1);
1591}
1592
1593//////////////////////////////////
1594template <typename T0, typename BaseT>
1595inline typename impl::make_binary2<and_op, T0, BaseT>::type
1596operator&(T0 CREF _0, actor<BaseT> const& _1)
1597{
1598    return impl::make_binary2<and_op, T0, BaseT>::construct(_0, _1);
1599}
1600
1601//////////////////////////////////
1602template <typename BaseT0, typename BaseT1>
1603inline typename impl::make_binary3<and_op, BaseT0, BaseT1>::type
1604operator&(actor

Large files files are truncated, but you can click here to view the full file