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