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