[857] | 1 | /*=============================================================================
|
---|
| 2 | Phoenix V1.2.1
|
---|
| 3 | Copyright (c) 2001-2002 Joel de Guzman
|
---|
| 4 |
|
---|
| 5 | Use, modification and distribution is subject to the Boost Software
|
---|
| 6 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 7 | http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 8 | ==============================================================================*/
|
---|
| 9 | #ifndef PHOENIX_COMPOSITE_HPP
|
---|
| 10 | #define PHOENIX_COMPOSITE_HPP
|
---|
| 11 |
|
---|
| 12 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 13 | #include <boost/spirit/phoenix/actor.hpp>
|
---|
| 14 |
|
---|
| 15 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 16 | namespace phoenix {
|
---|
| 17 |
|
---|
| 18 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 19 | //
|
---|
| 20 | // composite class
|
---|
| 21 | //
|
---|
| 22 | // A composite is an actor base class composed of zero or more
|
---|
| 23 | // actors (see actor.hpp) and an operation. A composite is itself
|
---|
| 24 | // an actor superclass and conforms to its conceptual interface.
|
---|
| 25 | // Its eval member function un-funnels the tupled actual arguments
|
---|
| 26 | // from the tuple by invoking each of the actors' eval member
|
---|
| 27 | // function. The results of each are then passed on as arguments to
|
---|
| 28 | // the operation. Specializations are provided to handle different
|
---|
| 29 | // numbers of actors.
|
---|
| 30 | //
|
---|
| 31 | // Schematically:
|
---|
| 32 | //
|
---|
| 33 | // actor0.eval(tupled_args) --> arg0 --> |
|
---|
| 34 | // actor1.eval(tupled_args) --> arg1 --> |
|
---|
| 35 | // actor2.eval(tupled_args) --> arg3 --> | --> operation(arg0...argN)
|
---|
| 36 | // ... |
|
---|
| 37 | // actorN.eval(tupled_args) --> argN --> |
|
---|
| 38 | //
|
---|
| 39 | // The operation can be any suitable functor that can accept the
|
---|
| 40 | // arguments passed in by the composite. The operation is expected
|
---|
| 41 | // to have a member operator() that carries out the actual
|
---|
| 42 | // operation. There should be a one to one correspondence between
|
---|
| 43 | // actors of the composite and the arguments of the operation's
|
---|
| 44 | // member operator().
|
---|
| 45 | //
|
---|
| 46 | // The operation is also expected to have a nested template class
|
---|
| 47 | // result<T0...TN>. The nested template class result should have a
|
---|
| 48 | // typedef 'type' that reflects the return type of its member
|
---|
| 49 | // operator(). This is essentially a type computer that answers the
|
---|
| 50 | // metaprogramming question "Given arguments of type T0...TN, what
|
---|
| 51 | // will be its operator()'s return type?".
|
---|
| 52 | //
|
---|
| 53 | // There is a special case for operations that accept no arguments.
|
---|
| 54 | // Such nullary operations are only required to define a typedef
|
---|
| 55 | // result_type that reflects the return type of its operator().
|
---|
| 56 | //
|
---|
| 57 | // Here's an example of a simple operation that squares a number:
|
---|
| 58 | //
|
---|
| 59 | // struct square {
|
---|
| 60 | //
|
---|
| 61 | // template <typename ArgT>
|
---|
| 62 | // struct result { typedef ArgT type; };
|
---|
| 63 | //
|
---|
| 64 | // template <typename ArgT>
|
---|
| 65 | // ArgT operator()(ArgT n) const { return n * n; }
|
---|
| 66 | // };
|
---|
| 67 | //
|
---|
| 68 | // As can be seen, operations can be polymorphic. Its arguments and
|
---|
| 69 | // return type are not fixed to a particular type. The example
|
---|
| 70 | // above for example, can handle any ArgT type as long as it has a
|
---|
| 71 | // multiplication operator.
|
---|
| 72 | //
|
---|
| 73 | // Composites are not created directly. Instead, there are meta-
|
---|
| 74 | // programs provided that indirectly create composites. See
|
---|
| 75 | // operators.hpp, binders.hpp and functions.hpp for examples.
|
---|
| 76 | //
|
---|
| 77 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 78 | template <
|
---|
| 79 | typename OperationT
|
---|
| 80 | , typename A = nil_t
|
---|
| 81 | , typename B = nil_t
|
---|
| 82 | , typename C = nil_t
|
---|
| 83 |
|
---|
| 84 | #if PHOENIX_LIMIT > 3
|
---|
| 85 | , typename D = nil_t
|
---|
| 86 | , typename E = nil_t
|
---|
| 87 | , typename F = nil_t
|
---|
| 88 |
|
---|
| 89 | #if PHOENIX_LIMIT > 6
|
---|
| 90 | , typename G = nil_t
|
---|
| 91 | , typename H = nil_t
|
---|
| 92 | , typename I = nil_t
|
---|
| 93 |
|
---|
| 94 | #if PHOENIX_LIMIT > 9
|
---|
| 95 | , typename J = nil_t
|
---|
| 96 | , typename K = nil_t
|
---|
| 97 | , typename L = nil_t
|
---|
| 98 |
|
---|
| 99 | #if PHOENIX_LIMIT > 12
|
---|
| 100 | , typename M = nil_t
|
---|
| 101 | , typename N = nil_t
|
---|
| 102 | , typename O = nil_t
|
---|
| 103 |
|
---|
| 104 | #endif
|
---|
| 105 | #endif
|
---|
| 106 | #endif
|
---|
| 107 | #endif
|
---|
| 108 |
|
---|
| 109 | , typename NU = nil_t // Not used
|
---|
| 110 | >
|
---|
| 111 | struct composite;
|
---|
| 112 |
|
---|
| 113 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 114 | //
|
---|
| 115 | // composite <0 actor> class
|
---|
| 116 | //
|
---|
| 117 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 118 | template <typename OperationT, typename TupleT>
|
---|
| 119 | struct composite0_result {
|
---|
| 120 |
|
---|
| 121 | typedef typename OperationT::result_type type;
|
---|
| 122 | };
|
---|
| 123 |
|
---|
| 124 | //////////////////////////////////
|
---|
| 125 | template <typename OperationT>
|
---|
| 126 | struct composite<OperationT,
|
---|
| 127 | nil_t, nil_t, nil_t,
|
---|
| 128 | #if PHOENIX_LIMIT > 3
|
---|
| 129 | nil_t, nil_t, nil_t,
|
---|
| 130 | #if PHOENIX_LIMIT > 6
|
---|
| 131 | nil_t, nil_t, nil_t,
|
---|
| 132 | #if PHOENIX_LIMIT > 9
|
---|
| 133 | nil_t, nil_t, nil_t,
|
---|
| 134 | #if PHOENIX_LIMIT > 12
|
---|
| 135 | nil_t, nil_t, nil_t,
|
---|
| 136 | #endif
|
---|
| 137 | #endif
|
---|
| 138 | #endif
|
---|
| 139 | #endif
|
---|
| 140 | nil_t // Unused
|
---|
| 141 | > {
|
---|
| 142 |
|
---|
| 143 | typedef composite<OperationT> self_t;
|
---|
| 144 |
|
---|
| 145 | template <typename TupleT>
|
---|
| 146 | struct result {
|
---|
| 147 |
|
---|
| 148 | typedef typename composite0_result<
|
---|
| 149 | OperationT, TupleT
|
---|
| 150 | >::type type;
|
---|
| 151 | };
|
---|
| 152 |
|
---|
| 153 | composite(OperationT const& op_)
|
---|
| 154 | : op(op_) {}
|
---|
| 155 |
|
---|
| 156 | template <typename TupleT>
|
---|
| 157 | typename OperationT::result_type
|
---|
| 158 | eval(TupleT const& /*args*/) const
|
---|
| 159 | {
|
---|
| 160 | return op();
|
---|
| 161 | }
|
---|
| 162 |
|
---|
| 163 | mutable OperationT op; // operation
|
---|
| 164 | };
|
---|
| 165 |
|
---|
| 166 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 167 | //
|
---|
| 168 | // composite <1 actor> class
|
---|
| 169 | //
|
---|
| 170 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 171 | template <typename OperationT, typename TupleT,
|
---|
| 172 | typename A>
|
---|
| 173 | struct composite1_result {
|
---|
| 174 |
|
---|
| 175 | typedef typename OperationT::template result<
|
---|
| 176 | typename actor_result<A, TupleT>::plain_type
|
---|
| 177 | >::type type;
|
---|
| 178 | };
|
---|
| 179 |
|
---|
| 180 | //////////////////////////////////
|
---|
| 181 | template <typename OperationT,
|
---|
| 182 | typename A>
|
---|
| 183 | struct composite<OperationT,
|
---|
| 184 | A, nil_t, nil_t,
|
---|
| 185 | #if PHOENIX_LIMIT > 3
|
---|
| 186 | nil_t, nil_t, nil_t,
|
---|
| 187 | #if PHOENIX_LIMIT > 6
|
---|
| 188 | nil_t, nil_t, nil_t,
|
---|
| 189 | #if PHOENIX_LIMIT > 9
|
---|
| 190 | nil_t, nil_t, nil_t,
|
---|
| 191 | #if PHOENIX_LIMIT > 12
|
---|
| 192 | nil_t, nil_t, nil_t,
|
---|
| 193 | #endif
|
---|
| 194 | #endif
|
---|
| 195 | #endif
|
---|
| 196 | #endif
|
---|
| 197 | nil_t // Unused
|
---|
| 198 | > {
|
---|
| 199 |
|
---|
| 200 | typedef composite<OperationT, A> self_t;
|
---|
| 201 |
|
---|
| 202 | template <typename TupleT>
|
---|
| 203 | struct result {
|
---|
| 204 |
|
---|
| 205 | typedef typename composite1_result<
|
---|
| 206 | OperationT, TupleT, A
|
---|
| 207 | >::type type;
|
---|
| 208 | };
|
---|
| 209 |
|
---|
| 210 | composite(OperationT const& op_,
|
---|
| 211 | A const& a_)
|
---|
| 212 | : op(op_), a(a_) {}
|
---|
| 213 |
|
---|
| 214 | template <typename TupleT>
|
---|
| 215 | typename actor_result<self_t, TupleT>::type
|
---|
| 216 | eval(TupleT const& args) const
|
---|
| 217 | {
|
---|
| 218 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 219 | return op(ra);
|
---|
| 220 | }
|
---|
| 221 |
|
---|
| 222 | mutable OperationT op; // operation
|
---|
| 223 | A a; // actors
|
---|
| 224 | };
|
---|
| 225 |
|
---|
| 226 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 227 | //
|
---|
| 228 | // composite <2 actors> class
|
---|
| 229 | //
|
---|
| 230 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 231 | template <typename OperationT, typename TupleT,
|
---|
| 232 | typename A, typename B>
|
---|
| 233 | struct composite2_result {
|
---|
| 234 |
|
---|
| 235 | typedef typename OperationT::template result<
|
---|
| 236 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 237 | typename actor_result<B, TupleT>::plain_type
|
---|
| 238 | >::type type;
|
---|
| 239 | };
|
---|
| 240 |
|
---|
| 241 | //////////////////////////////////
|
---|
| 242 | template <typename OperationT,
|
---|
| 243 | typename A, typename B>
|
---|
| 244 | struct composite<OperationT,
|
---|
| 245 | A, B, nil_t,
|
---|
| 246 | #if PHOENIX_LIMIT > 3
|
---|
| 247 | nil_t, nil_t, nil_t,
|
---|
| 248 | #if PHOENIX_LIMIT > 6
|
---|
| 249 | nil_t, nil_t, nil_t,
|
---|
| 250 | #if PHOENIX_LIMIT > 9
|
---|
| 251 | nil_t, nil_t, nil_t,
|
---|
| 252 | #if PHOENIX_LIMIT > 12
|
---|
| 253 | nil_t, nil_t, nil_t,
|
---|
| 254 | #endif
|
---|
| 255 | #endif
|
---|
| 256 | #endif
|
---|
| 257 | #endif
|
---|
| 258 | nil_t // Unused
|
---|
| 259 | > {
|
---|
| 260 |
|
---|
| 261 | typedef composite<OperationT, A, B> self_t;
|
---|
| 262 |
|
---|
| 263 | template <typename TupleT>
|
---|
| 264 | struct result {
|
---|
| 265 |
|
---|
| 266 | typedef typename composite2_result<
|
---|
| 267 | OperationT, TupleT, A, B
|
---|
| 268 | >::type type;
|
---|
| 269 | };
|
---|
| 270 |
|
---|
| 271 | composite(OperationT const& op_,
|
---|
| 272 | A const& a_, B const& b_)
|
---|
| 273 | : op(op_), a(a_), b(b_) {}
|
---|
| 274 |
|
---|
| 275 | template <typename TupleT>
|
---|
| 276 | typename actor_result<self_t, TupleT>::type
|
---|
| 277 | eval(TupleT const& args) const
|
---|
| 278 | {
|
---|
| 279 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 280 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 281 | return op(ra, rb);
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | mutable OperationT op; // operation
|
---|
| 285 | A a; B b; // actors
|
---|
| 286 | };
|
---|
| 287 |
|
---|
| 288 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 289 | //
|
---|
| 290 | // composite <3 actors> class
|
---|
| 291 | //
|
---|
| 292 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 293 | template <typename OperationT, typename TupleT,
|
---|
| 294 | typename A, typename B, typename C>
|
---|
| 295 | struct composite3_result {
|
---|
| 296 |
|
---|
| 297 | typedef typename OperationT::template result<
|
---|
| 298 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 299 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 300 | typename actor_result<C, TupleT>::plain_type
|
---|
| 301 | >::type type;
|
---|
| 302 | };
|
---|
| 303 |
|
---|
| 304 | //////////////////////////////////
|
---|
| 305 | template <typename OperationT,
|
---|
| 306 | typename A, typename B, typename C>
|
---|
| 307 | struct composite<OperationT,
|
---|
| 308 | A, B, C,
|
---|
| 309 | #if PHOENIX_LIMIT > 3
|
---|
| 310 | nil_t, nil_t, nil_t,
|
---|
| 311 | #if PHOENIX_LIMIT > 6
|
---|
| 312 | nil_t, nil_t, nil_t,
|
---|
| 313 | #if PHOENIX_LIMIT > 9
|
---|
| 314 | nil_t, nil_t, nil_t,
|
---|
| 315 | #if PHOENIX_LIMIT > 12
|
---|
| 316 | nil_t, nil_t, nil_t,
|
---|
| 317 | #endif
|
---|
| 318 | #endif
|
---|
| 319 | #endif
|
---|
| 320 | #endif
|
---|
| 321 | nil_t // Unused
|
---|
| 322 | > {
|
---|
| 323 |
|
---|
| 324 | typedef composite<OperationT, A, B, C> self_t;
|
---|
| 325 |
|
---|
| 326 | template <typename TupleT>
|
---|
| 327 | struct result {
|
---|
| 328 |
|
---|
| 329 | typedef typename composite3_result<
|
---|
| 330 | OperationT, TupleT, A, B, C
|
---|
| 331 | >::type type;
|
---|
| 332 | };
|
---|
| 333 |
|
---|
| 334 | composite(OperationT const& op_,
|
---|
| 335 | A const& a_, B const& b_, C const& c_)
|
---|
| 336 | : op(op_), a(a_), b(b_), c(c_) {}
|
---|
| 337 |
|
---|
| 338 | template <typename TupleT>
|
---|
| 339 | typename actor_result<self_t, TupleT>::type
|
---|
| 340 | eval(TupleT const& args) const
|
---|
| 341 | {
|
---|
| 342 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 343 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 344 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 345 | return op(ra, rb, rc);
|
---|
| 346 | }
|
---|
| 347 |
|
---|
| 348 | mutable OperationT op; // operation
|
---|
| 349 | A a; B b; C c; // actors
|
---|
| 350 | };
|
---|
| 351 |
|
---|
| 352 | #if PHOENIX_LIMIT > 3
|
---|
| 353 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 354 | //
|
---|
| 355 | // composite <4 actors> class
|
---|
| 356 | //
|
---|
| 357 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 358 | template <typename OperationT, typename TupleT,
|
---|
| 359 | typename A, typename B, typename C, typename D>
|
---|
| 360 | struct composite4_result {
|
---|
| 361 |
|
---|
| 362 | typedef typename OperationT::template result<
|
---|
| 363 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 364 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 365 | typename actor_result<C, TupleT>::plain_type,
|
---|
| 366 | typename actor_result<D, TupleT>::plain_type
|
---|
| 367 | >::type type;
|
---|
| 368 | };
|
---|
| 369 |
|
---|
| 370 | //////////////////////////////////
|
---|
| 371 | template <typename OperationT,
|
---|
| 372 | typename A, typename B, typename C, typename D>
|
---|
| 373 | struct composite<OperationT,
|
---|
| 374 | A, B, C, D, nil_t, nil_t,
|
---|
| 375 | #if PHOENIX_LIMIT > 6
|
---|
| 376 | nil_t, nil_t, nil_t,
|
---|
| 377 | #if PHOENIX_LIMIT > 9
|
---|
| 378 | nil_t, nil_t, nil_t,
|
---|
| 379 | #if PHOENIX_LIMIT > 12
|
---|
| 380 | nil_t, nil_t, nil_t,
|
---|
| 381 | #endif
|
---|
| 382 | #endif
|
---|
| 383 | #endif
|
---|
| 384 | nil_t // Unused
|
---|
| 385 | > {
|
---|
| 386 |
|
---|
| 387 | typedef composite<OperationT, A, B, C, D> self_t;
|
---|
| 388 |
|
---|
| 389 | template <typename TupleT>
|
---|
| 390 | struct result {
|
---|
| 391 |
|
---|
| 392 | typedef typename composite4_result<
|
---|
| 393 | OperationT, TupleT, A, B, C, D
|
---|
| 394 | >::type type;
|
---|
| 395 | };
|
---|
| 396 |
|
---|
| 397 | composite(OperationT const& op_,
|
---|
| 398 | A const& a_, B const& b_, C const& c_, D const& d_)
|
---|
| 399 | : op(op_), a(a_), b(b_), c(c_), d(d_) {}
|
---|
| 400 |
|
---|
| 401 | template <typename TupleT>
|
---|
| 402 | typename actor_result<self_t, TupleT>::type
|
---|
| 403 | eval(TupleT const& args) const
|
---|
| 404 | {
|
---|
| 405 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 406 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 407 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 408 | typename actor_result<D, TupleT>::type rd = d.eval(args);
|
---|
| 409 | return op(ra, rb, rc, rd);
|
---|
| 410 | }
|
---|
| 411 |
|
---|
| 412 | mutable OperationT op; // operation
|
---|
| 413 | A a; B b; C c; D d; // actors
|
---|
| 414 | };
|
---|
| 415 |
|
---|
| 416 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 417 | //
|
---|
| 418 | // composite <5 actors> class
|
---|
| 419 | //
|
---|
| 420 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 421 | template <typename OperationT, typename TupleT,
|
---|
| 422 | typename A, typename B, typename C, typename D, typename E>
|
---|
| 423 | struct composite5_result {
|
---|
| 424 |
|
---|
| 425 | typedef typename OperationT::template result<
|
---|
| 426 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 427 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 428 | typename actor_result<C, TupleT>::plain_type,
|
---|
| 429 | typename actor_result<D, TupleT>::plain_type,
|
---|
| 430 | typename actor_result<E, TupleT>::plain_type
|
---|
| 431 | >::type type;
|
---|
| 432 | };
|
---|
| 433 |
|
---|
| 434 | //////////////////////////////////
|
---|
| 435 | template <typename OperationT,
|
---|
| 436 | typename A, typename B, typename C, typename D, typename E>
|
---|
| 437 | struct composite<OperationT,
|
---|
| 438 | A, B, C, D, E, nil_t,
|
---|
| 439 | #if PHOENIX_LIMIT > 6
|
---|
| 440 | nil_t, nil_t, nil_t,
|
---|
| 441 | #if PHOENIX_LIMIT > 9
|
---|
| 442 | nil_t, nil_t, nil_t,
|
---|
| 443 | #if PHOENIX_LIMIT > 12
|
---|
| 444 | nil_t, nil_t, nil_t,
|
---|
| 445 | #endif
|
---|
| 446 | #endif
|
---|
| 447 | #endif
|
---|
| 448 | nil_t // Unused
|
---|
| 449 | > {
|
---|
| 450 |
|
---|
| 451 | typedef composite<OperationT, A, B, C, D, E> self_t;
|
---|
| 452 |
|
---|
| 453 | template <typename TupleT>
|
---|
| 454 | struct result {
|
---|
| 455 |
|
---|
| 456 | typedef typename composite5_result<
|
---|
| 457 | OperationT, TupleT, A, B, C, D, E
|
---|
| 458 | >::type type;
|
---|
| 459 | };
|
---|
| 460 |
|
---|
| 461 | composite(OperationT const& op_,
|
---|
| 462 | A const& a_, B const& b_, C const& c_, D const& d_, E const& e_)
|
---|
| 463 | : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_) {}
|
---|
| 464 |
|
---|
| 465 | template <typename TupleT>
|
---|
| 466 | typename actor_result<self_t, TupleT>::type
|
---|
| 467 | eval(TupleT const& args) const
|
---|
| 468 | {
|
---|
| 469 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 470 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 471 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 472 | typename actor_result<D, TupleT>::type rd = d.eval(args);
|
---|
| 473 | typename actor_result<E, TupleT>::type re = e.eval(args);
|
---|
| 474 | return op(ra, rb, rc, rd, re);
|
---|
| 475 | }
|
---|
| 476 |
|
---|
| 477 | mutable OperationT op; // operation
|
---|
| 478 | A a; B b; C c; D d; E e; // actors
|
---|
| 479 | };
|
---|
| 480 |
|
---|
| 481 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 482 | //
|
---|
| 483 | // composite <6 actors> class
|
---|
| 484 | //
|
---|
| 485 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 486 | template <typename OperationT, typename TupleT,
|
---|
| 487 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 488 | typename F>
|
---|
| 489 | struct composite6_result {
|
---|
| 490 |
|
---|
| 491 | typedef typename OperationT::template result<
|
---|
| 492 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 493 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 494 | typename actor_result<C, TupleT>::plain_type,
|
---|
| 495 | typename actor_result<D, TupleT>::plain_type,
|
---|
| 496 | typename actor_result<E, TupleT>::plain_type,
|
---|
| 497 | typename actor_result<F, TupleT>::plain_type
|
---|
| 498 | >::type type;
|
---|
| 499 | };
|
---|
| 500 |
|
---|
| 501 | //////////////////////////////////
|
---|
| 502 | template <typename OperationT,
|
---|
| 503 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 504 | typename F>
|
---|
| 505 | struct composite<OperationT,
|
---|
| 506 | A, B, C, D, E, F,
|
---|
| 507 | #if PHOENIX_LIMIT > 6
|
---|
| 508 | nil_t, nil_t, nil_t,
|
---|
| 509 | #if PHOENIX_LIMIT > 9
|
---|
| 510 | nil_t, nil_t, nil_t,
|
---|
| 511 | #if PHOENIX_LIMIT > 12
|
---|
| 512 | nil_t, nil_t, nil_t,
|
---|
| 513 | #endif
|
---|
| 514 | #endif
|
---|
| 515 | #endif
|
---|
| 516 | nil_t // Unused
|
---|
| 517 | > {
|
---|
| 518 |
|
---|
| 519 | typedef composite<OperationT, A, B, C, D, E, F> self_t;
|
---|
| 520 |
|
---|
| 521 | template <typename TupleT>
|
---|
| 522 | struct result {
|
---|
| 523 |
|
---|
| 524 | typedef typename composite6_result<
|
---|
| 525 | OperationT, TupleT, A, B, C, D, E, F
|
---|
| 526 | >::type type;
|
---|
| 527 | };
|
---|
| 528 |
|
---|
| 529 | composite(OperationT const& op_,
|
---|
| 530 | A const& a_, B const& b_, C const& c_, D const& d_, E const& e_,
|
---|
| 531 | F const& f_)
|
---|
| 532 | : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_),
|
---|
| 533 | f(f_) {}
|
---|
| 534 |
|
---|
| 535 | template <typename TupleT>
|
---|
| 536 | typename actor_result<self_t, TupleT>::type
|
---|
| 537 | eval(TupleT const& args) const
|
---|
| 538 | {
|
---|
| 539 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 540 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 541 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 542 | typename actor_result<D, TupleT>::type rd = d.eval(args);
|
---|
| 543 | typename actor_result<E, TupleT>::type re = e.eval(args);
|
---|
| 544 | typename actor_result<F, TupleT>::type rf = f.eval(args);
|
---|
| 545 | return op(ra, rb, rc, rd, re, rf);
|
---|
| 546 | }
|
---|
| 547 |
|
---|
| 548 | mutable OperationT op; // operation
|
---|
| 549 | A a; B b; C c; D d; E e; F f; // actors
|
---|
| 550 | };
|
---|
| 551 |
|
---|
| 552 | #if PHOENIX_LIMIT > 6
|
---|
| 553 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 554 | //
|
---|
| 555 | // composite <7 actors> class
|
---|
| 556 | //
|
---|
| 557 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 558 | template <typename OperationT, typename TupleT,
|
---|
| 559 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 560 | typename F, typename G>
|
---|
| 561 | struct composite7_result {
|
---|
| 562 |
|
---|
| 563 | typedef typename OperationT::template result<
|
---|
| 564 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 565 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 566 | typename actor_result<C, TupleT>::plain_type,
|
---|
| 567 | typename actor_result<D, TupleT>::plain_type,
|
---|
| 568 | typename actor_result<E, TupleT>::plain_type,
|
---|
| 569 | typename actor_result<F, TupleT>::plain_type,
|
---|
| 570 | typename actor_result<G, TupleT>::plain_type
|
---|
| 571 | >::type type;
|
---|
| 572 | };
|
---|
| 573 |
|
---|
| 574 | //////////////////////////////////
|
---|
| 575 | template <typename OperationT,
|
---|
| 576 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 577 | typename F, typename G>
|
---|
| 578 | struct composite<OperationT,
|
---|
| 579 | A, B, C, D, E, F, G, nil_t, nil_t,
|
---|
| 580 | #if PHOENIX_LIMIT > 9
|
---|
| 581 | nil_t, nil_t, nil_t,
|
---|
| 582 | #if PHOENIX_LIMIT > 12
|
---|
| 583 | nil_t, nil_t, nil_t,
|
---|
| 584 | #endif
|
---|
| 585 | #endif
|
---|
| 586 | nil_t // Unused
|
---|
| 587 | > {
|
---|
| 588 |
|
---|
| 589 | typedef composite<OperationT, A, B, C, D, E, F, G> self_t;
|
---|
| 590 |
|
---|
| 591 | template <typename TupleT>
|
---|
| 592 | struct result {
|
---|
| 593 |
|
---|
| 594 | typedef typename composite7_result<
|
---|
| 595 | OperationT, TupleT, A, B, C, D, E, F, G
|
---|
| 596 | >::type type;
|
---|
| 597 | };
|
---|
| 598 |
|
---|
| 599 | composite(OperationT const& op_,
|
---|
| 600 | A const& a_, B const& b_, C const& c_, D const& d_, E const& e_,
|
---|
| 601 | F const& f_, G const& g_)
|
---|
| 602 | : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_),
|
---|
| 603 | f(f_), g(g_) {}
|
---|
| 604 |
|
---|
| 605 | template <typename TupleT>
|
---|
| 606 | typename actor_result<self_t, TupleT>::type
|
---|
| 607 | eval(TupleT const& args) const
|
---|
| 608 | {
|
---|
| 609 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 610 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 611 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 612 | typename actor_result<D, TupleT>::type rd = d.eval(args);
|
---|
| 613 | typename actor_result<E, TupleT>::type re = e.eval(args);
|
---|
| 614 | typename actor_result<F, TupleT>::type rf = f.eval(args);
|
---|
| 615 | typename actor_result<G, TupleT>::type rg = g.eval(args);
|
---|
| 616 | return op(ra, rb, rc, rd, re, rf, rg);
|
---|
| 617 | }
|
---|
| 618 |
|
---|
| 619 | mutable OperationT op; // operation
|
---|
| 620 | A a; B b; C c; D d; E e; F f; G g; // actors
|
---|
| 621 | };
|
---|
| 622 |
|
---|
| 623 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 624 | //
|
---|
| 625 | // composite <8 actors> class
|
---|
| 626 | //
|
---|
| 627 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 628 | template <typename OperationT, typename TupleT,
|
---|
| 629 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 630 | typename F, typename G, typename H>
|
---|
| 631 | struct composite8_result {
|
---|
| 632 |
|
---|
| 633 | typedef typename OperationT::template result<
|
---|
| 634 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 635 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 636 | typename actor_result<C, TupleT>::plain_type,
|
---|
| 637 | typename actor_result<D, TupleT>::plain_type,
|
---|
| 638 | typename actor_result<E, TupleT>::plain_type,
|
---|
| 639 | typename actor_result<F, TupleT>::plain_type,
|
---|
| 640 | typename actor_result<G, TupleT>::plain_type,
|
---|
| 641 | typename actor_result<H, TupleT>::plain_type
|
---|
| 642 | >::type type;
|
---|
| 643 | };
|
---|
| 644 |
|
---|
| 645 | //////////////////////////////////
|
---|
| 646 | template <typename OperationT,
|
---|
| 647 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 648 | typename F, typename G, typename H>
|
---|
| 649 | struct composite<OperationT,
|
---|
| 650 | A, B, C, D, E, F, G, H, nil_t,
|
---|
| 651 | #if PHOENIX_LIMIT > 9
|
---|
| 652 | nil_t, nil_t, nil_t,
|
---|
| 653 | #if PHOENIX_LIMIT > 12
|
---|
| 654 | nil_t, nil_t, nil_t,
|
---|
| 655 | #endif
|
---|
| 656 | #endif
|
---|
| 657 | nil_t // Unused
|
---|
| 658 | > {
|
---|
| 659 |
|
---|
| 660 | typedef composite<OperationT, A, B, C, D, E, F, G, H> self_t;
|
---|
| 661 |
|
---|
| 662 | template <typename TupleT>
|
---|
| 663 | struct result {
|
---|
| 664 |
|
---|
| 665 | typedef typename composite8_result<
|
---|
| 666 | OperationT, TupleT, A, B, C, D, E, F, G, H
|
---|
| 667 | >::type type;
|
---|
| 668 | };
|
---|
| 669 |
|
---|
| 670 | composite(OperationT const& op_,
|
---|
| 671 | A const& a_, B const& b_, C const& c_, D const& d_, E const& e_,
|
---|
| 672 | F const& f_, G const& g_, H const& h_)
|
---|
| 673 | : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_),
|
---|
| 674 | f(f_), g(g_), h(h_) {}
|
---|
| 675 |
|
---|
| 676 | template <typename TupleT>
|
---|
| 677 | typename actor_result<self_t, TupleT>::type
|
---|
| 678 | eval(TupleT const& args) const
|
---|
| 679 | {
|
---|
| 680 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 681 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 682 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 683 | typename actor_result<D, TupleT>::type rd = d.eval(args);
|
---|
| 684 | typename actor_result<E, TupleT>::type re = e.eval(args);
|
---|
| 685 | typename actor_result<F, TupleT>::type rf = f.eval(args);
|
---|
| 686 | typename actor_result<G, TupleT>::type rg = g.eval(args);
|
---|
| 687 | typename actor_result<H, TupleT>::type rh = h.eval(args);
|
---|
| 688 | return op(ra, rb, rc, rd, re, rf, rg, rh);
|
---|
| 689 | }
|
---|
| 690 |
|
---|
| 691 | mutable OperationT op; // operation
|
---|
| 692 | A a; B b; C c; D d; E e; F f; G g; H h; // actors
|
---|
| 693 | };
|
---|
| 694 |
|
---|
| 695 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 696 | //
|
---|
| 697 | // composite <9 actors> class
|
---|
| 698 | //
|
---|
| 699 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 700 | template <typename OperationT, typename TupleT,
|
---|
| 701 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 702 | typename F, typename G, typename H, typename I>
|
---|
| 703 | struct composite9_result {
|
---|
| 704 |
|
---|
| 705 | typedef typename OperationT::template result<
|
---|
| 706 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 707 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 708 | typename actor_result<C, TupleT>::plain_type,
|
---|
| 709 | typename actor_result<D, TupleT>::plain_type,
|
---|
| 710 | typename actor_result<E, TupleT>::plain_type,
|
---|
| 711 | typename actor_result<F, TupleT>::plain_type,
|
---|
| 712 | typename actor_result<G, TupleT>::plain_type,
|
---|
| 713 | typename actor_result<H, TupleT>::plain_type,
|
---|
| 714 | typename actor_result<I, TupleT>::plain_type
|
---|
| 715 | >::type type;
|
---|
| 716 | };
|
---|
| 717 |
|
---|
| 718 | //////////////////////////////////
|
---|
| 719 | template <typename OperationT,
|
---|
| 720 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 721 | typename F, typename G, typename H, typename I>
|
---|
| 722 | struct composite<OperationT,
|
---|
| 723 | A, B, C, D, E, F, G, H, I,
|
---|
| 724 | #if PHOENIX_LIMIT > 9
|
---|
| 725 | nil_t, nil_t, nil_t,
|
---|
| 726 | #if PHOENIX_LIMIT > 12
|
---|
| 727 | nil_t, nil_t, nil_t,
|
---|
| 728 | #endif
|
---|
| 729 | #endif
|
---|
| 730 | nil_t // Unused
|
---|
| 731 | > {
|
---|
| 732 |
|
---|
| 733 | typedef composite<OperationT, A, B, C, D, E, F, G, H, I> self_t;
|
---|
| 734 |
|
---|
| 735 | template <typename TupleT>
|
---|
| 736 | struct result {
|
---|
| 737 |
|
---|
| 738 | typedef typename composite9_result<
|
---|
| 739 | OperationT, TupleT, A, B, C, D, E, F, G, H, I
|
---|
| 740 | >::type type;
|
---|
| 741 | };
|
---|
| 742 |
|
---|
| 743 | composite(OperationT const& op_,
|
---|
| 744 | A const& a_, B const& b_, C const& c_, D const& d_, E const& e_,
|
---|
| 745 | F const& f_, G const& g_, H const& h_, I const& i_)
|
---|
| 746 | : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_),
|
---|
| 747 | f(f_), g(g_), h(h_), i(i_) {}
|
---|
| 748 |
|
---|
| 749 | template <typename TupleT>
|
---|
| 750 | typename actor_result<self_t, TupleT>::type
|
---|
| 751 | eval(TupleT const& args) const
|
---|
| 752 | {
|
---|
| 753 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 754 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 755 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 756 | typename actor_result<D, TupleT>::type rd = d.eval(args);
|
---|
| 757 | typename actor_result<E, TupleT>::type re = e.eval(args);
|
---|
| 758 | typename actor_result<F, TupleT>::type rf = f.eval(args);
|
---|
| 759 | typename actor_result<G, TupleT>::type rg = g.eval(args);
|
---|
| 760 | typename actor_result<H, TupleT>::type rh = h.eval(args);
|
---|
| 761 | typename actor_result<I, TupleT>::type ri = i.eval(args);
|
---|
| 762 | return op(ra, rb, rc, rd, re, rf, rg, rh, ri);
|
---|
| 763 | }
|
---|
| 764 |
|
---|
| 765 | mutable OperationT op; // operation
|
---|
| 766 | A a; B b; C c; D d; E e; F f; G g; H h; I i; // actors
|
---|
| 767 | };
|
---|
| 768 |
|
---|
| 769 | #if PHOENIX_LIMIT > 9
|
---|
| 770 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 771 | //
|
---|
| 772 | // composite <10 actors> class
|
---|
| 773 | //
|
---|
| 774 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 775 | template <typename OperationT, typename TupleT,
|
---|
| 776 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 777 | typename F, typename G, typename H, typename I, typename J>
|
---|
| 778 | struct composite10_result {
|
---|
| 779 |
|
---|
| 780 | typedef typename OperationT::template result<
|
---|
| 781 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 782 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 783 | typename actor_result<C, TupleT>::plain_type,
|
---|
| 784 | typename actor_result<D, TupleT>::plain_type,
|
---|
| 785 | typename actor_result<E, TupleT>::plain_type,
|
---|
| 786 | typename actor_result<F, TupleT>::plain_type,
|
---|
| 787 | typename actor_result<G, TupleT>::plain_type,
|
---|
| 788 | typename actor_result<H, TupleT>::plain_type,
|
---|
| 789 | typename actor_result<I, TupleT>::plain_type,
|
---|
| 790 | typename actor_result<J, TupleT>::plain_type
|
---|
| 791 | >::type type;
|
---|
| 792 | };
|
---|
| 793 |
|
---|
| 794 | //////////////////////////////////
|
---|
| 795 | template <typename OperationT,
|
---|
| 796 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 797 | typename F, typename G, typename H, typename I, typename J>
|
---|
| 798 | struct composite<OperationT,
|
---|
| 799 | A, B, C, D, E, F, G, H, I, J, nil_t, nil_t,
|
---|
| 800 | #if PHOENIX_LIMIT > 12
|
---|
| 801 | nil_t, nil_t, nil_t,
|
---|
| 802 | #endif
|
---|
| 803 | nil_t // Unused
|
---|
| 804 | > {
|
---|
| 805 |
|
---|
| 806 | typedef composite<OperationT, A, B, C, D, E, F, G, H, I, J> self_t;
|
---|
| 807 |
|
---|
| 808 | template <typename TupleT>
|
---|
| 809 | struct result {
|
---|
| 810 |
|
---|
| 811 | typedef typename composite10_result<
|
---|
| 812 | OperationT, TupleT, A, B, C, D, E, F, G, H, I, J
|
---|
| 813 | >::type type;
|
---|
| 814 | };
|
---|
| 815 |
|
---|
| 816 | composite(OperationT const& op_,
|
---|
| 817 | A const& a_, B const& b_, C const& c_, D const& d_, E const& e_,
|
---|
| 818 | F const& f_, G const& g_, H const& h_, I const& i_, J const& j_)
|
---|
| 819 | : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_),
|
---|
| 820 | f(f_), g(g_), h(h_), i(i_), j(j_) {}
|
---|
| 821 |
|
---|
| 822 | template <typename TupleT>
|
---|
| 823 | typename actor_result<self_t, TupleT>::type
|
---|
| 824 | eval(TupleT const& args) const
|
---|
| 825 | {
|
---|
| 826 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 827 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 828 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 829 | typename actor_result<D, TupleT>::type rd = d.eval(args);
|
---|
| 830 | typename actor_result<E, TupleT>::type re = e.eval(args);
|
---|
| 831 | typename actor_result<F, TupleT>::type rf = f.eval(args);
|
---|
| 832 | typename actor_result<G, TupleT>::type rg = g.eval(args);
|
---|
| 833 | typename actor_result<H, TupleT>::type rh = h.eval(args);
|
---|
| 834 | typename actor_result<I, TupleT>::type ri = i.eval(args);
|
---|
| 835 | typename actor_result<J, TupleT>::type rj = j.eval(args);
|
---|
| 836 | return op(ra, rb, rc, rd, re, rf, rg, rh, ri, rj);
|
---|
| 837 | }
|
---|
| 838 |
|
---|
| 839 | mutable OperationT op; // operation
|
---|
| 840 | A a; B b; C c; D d; E e; F f; G g; H h; I i; J j; // actors
|
---|
| 841 | };
|
---|
| 842 |
|
---|
| 843 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 844 | //
|
---|
| 845 | // composite <11 actors> class
|
---|
| 846 | //
|
---|
| 847 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 848 | template <typename OperationT, typename TupleT,
|
---|
| 849 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 850 | typename F, typename G, typename H, typename I, typename J,
|
---|
| 851 | typename K>
|
---|
| 852 | struct composite11_result {
|
---|
| 853 |
|
---|
| 854 | typedef typename OperationT::template result<
|
---|
| 855 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 856 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 857 | typename actor_result<C, TupleT>::plain_type,
|
---|
| 858 | typename actor_result<D, TupleT>::plain_type,
|
---|
| 859 | typename actor_result<E, TupleT>::plain_type,
|
---|
| 860 | typename actor_result<F, TupleT>::plain_type,
|
---|
| 861 | typename actor_result<G, TupleT>::plain_type,
|
---|
| 862 | typename actor_result<H, TupleT>::plain_type,
|
---|
| 863 | typename actor_result<I, TupleT>::plain_type,
|
---|
| 864 | typename actor_result<J, TupleT>::plain_type,
|
---|
| 865 | typename actor_result<K, TupleT>::plain_type
|
---|
| 866 | >::type type;
|
---|
| 867 | };
|
---|
| 868 |
|
---|
| 869 | //////////////////////////////////
|
---|
| 870 | template <typename OperationT,
|
---|
| 871 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 872 | typename F, typename G, typename H, typename I, typename J,
|
---|
| 873 | typename K>
|
---|
| 874 | struct composite<OperationT,
|
---|
| 875 | A, B, C, D, E, F, G, H, I, J, K, nil_t,
|
---|
| 876 | #if PHOENIX_LIMIT > 12
|
---|
| 877 | nil_t, nil_t, nil_t,
|
---|
| 878 | #endif
|
---|
| 879 | nil_t // Unused
|
---|
| 880 | > {
|
---|
| 881 |
|
---|
| 882 | typedef composite<OperationT,
|
---|
| 883 | A, B, C, D, E, F, G, H, I, J, K> self_t;
|
---|
| 884 |
|
---|
| 885 | template <typename TupleT>
|
---|
| 886 | struct result {
|
---|
| 887 |
|
---|
| 888 | typedef typename composite11_result<
|
---|
| 889 | OperationT, TupleT, A, B, C, D, E, F, G, H, I, J, K
|
---|
| 890 | >::type type;
|
---|
| 891 | };
|
---|
| 892 |
|
---|
| 893 | composite(OperationT const& op_,
|
---|
| 894 | A const& a_, B const& b_, C const& c_, D const& d_, E const& e_,
|
---|
| 895 | F const& f_, G const& g_, H const& h_, I const& i_, J const& j_,
|
---|
| 896 | K const& k_)
|
---|
| 897 | : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_),
|
---|
| 898 | f(f_), g(g_), h(h_), i(i_), j(j_),
|
---|
| 899 | k(k_) {}
|
---|
| 900 |
|
---|
| 901 | template <typename TupleT>
|
---|
| 902 | typename actor_result<self_t, TupleT>::type
|
---|
| 903 | eval(TupleT const& args) const
|
---|
| 904 | {
|
---|
| 905 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 906 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 907 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 908 | typename actor_result<D, TupleT>::type rd = d.eval(args);
|
---|
| 909 | typename actor_result<E, TupleT>::type re = e.eval(args);
|
---|
| 910 | typename actor_result<F, TupleT>::type rf = f.eval(args);
|
---|
| 911 | typename actor_result<G, TupleT>::type rg = g.eval(args);
|
---|
| 912 | typename actor_result<H, TupleT>::type rh = h.eval(args);
|
---|
| 913 | typename actor_result<I, TupleT>::type ri = i.eval(args);
|
---|
| 914 | typename actor_result<J, TupleT>::type rj = j.eval(args);
|
---|
| 915 | typename actor_result<K, TupleT>::type rk = k.eval(args);
|
---|
| 916 | return op(ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk);
|
---|
| 917 | }
|
---|
| 918 |
|
---|
| 919 | mutable OperationT op; // operation
|
---|
| 920 | A a; B b; C c; D d; E e; F f; G g; H h; I i; J j;
|
---|
| 921 | K k;// actors
|
---|
| 922 | };
|
---|
| 923 |
|
---|
| 924 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 925 | //
|
---|
| 926 | // composite <12 actors> class
|
---|
| 927 | //
|
---|
| 928 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 929 | template <typename OperationT, typename TupleT,
|
---|
| 930 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 931 | typename F, typename G, typename H, typename I, typename J,
|
---|
| 932 | typename K, typename L>
|
---|
| 933 | struct composite12_result {
|
---|
| 934 |
|
---|
| 935 | typedef typename OperationT::template result<
|
---|
| 936 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 937 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 938 | typename actor_result<C, TupleT>::plain_type,
|
---|
| 939 | typename actor_result<D, TupleT>::plain_type,
|
---|
| 940 | typename actor_result<E, TupleT>::plain_type,
|
---|
| 941 | typename actor_result<F, TupleT>::plain_type,
|
---|
| 942 | typename actor_result<G, TupleT>::plain_type,
|
---|
| 943 | typename actor_result<H, TupleT>::plain_type,
|
---|
| 944 | typename actor_result<I, TupleT>::plain_type,
|
---|
| 945 | typename actor_result<J, TupleT>::plain_type,
|
---|
| 946 | typename actor_result<K, TupleT>::plain_type,
|
---|
| 947 | typename actor_result<L, TupleT>::plain_type
|
---|
| 948 | >::type type;
|
---|
| 949 | };
|
---|
| 950 |
|
---|
| 951 | //////////////////////////////////
|
---|
| 952 | template <typename OperationT,
|
---|
| 953 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 954 | typename F, typename G, typename H, typename I, typename J,
|
---|
| 955 | typename K, typename L>
|
---|
| 956 | struct composite<OperationT,
|
---|
| 957 | A, B, C, D, E, F, G, H, I, J, K, L,
|
---|
| 958 | #if PHOENIX_LIMIT > 12
|
---|
| 959 | nil_t, nil_t, nil_t,
|
---|
| 960 | #endif
|
---|
| 961 | nil_t // Unused
|
---|
| 962 | > {
|
---|
| 963 |
|
---|
| 964 | typedef composite<OperationT,
|
---|
| 965 | A, B, C, D, E, F, G, H, I, J, K, L> self_t;
|
---|
| 966 |
|
---|
| 967 | template <typename TupleT>
|
---|
| 968 | struct result {
|
---|
| 969 |
|
---|
| 970 | typedef typename composite12_result<
|
---|
| 971 | OperationT, TupleT, A, B, C, D, E, F, G, H, I, J, K, L
|
---|
| 972 | >::type type;
|
---|
| 973 | };
|
---|
| 974 |
|
---|
| 975 | composite(OperationT const& op_,
|
---|
| 976 | A const& a_, B const& b_, C const& c_, D const& d_, E const& e_,
|
---|
| 977 | F const& f_, G const& g_, H const& h_, I const& i_, J const& j_,
|
---|
| 978 | K const& k_, L const& l_)
|
---|
| 979 | : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_),
|
---|
| 980 | f(f_), g(g_), h(h_), i(i_), j(j_),
|
---|
| 981 | k(k_), l(l_) {}
|
---|
| 982 |
|
---|
| 983 | template <typename TupleT>
|
---|
| 984 | typename actor_result<self_t, TupleT>::type
|
---|
| 985 | eval(TupleT const& args) const
|
---|
| 986 | {
|
---|
| 987 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 988 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 989 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 990 | typename actor_result<D, TupleT>::type rd = d.eval(args);
|
---|
| 991 | typename actor_result<E, TupleT>::type re = e.eval(args);
|
---|
| 992 | typename actor_result<F, TupleT>::type rf = f.eval(args);
|
---|
| 993 | typename actor_result<G, TupleT>::type rg = g.eval(args);
|
---|
| 994 | typename actor_result<H, TupleT>::type rh = h.eval(args);
|
---|
| 995 | typename actor_result<I, TupleT>::type ri = i.eval(args);
|
---|
| 996 | typename actor_result<J, TupleT>::type rj = j.eval(args);
|
---|
| 997 | typename actor_result<K, TupleT>::type rk = k.eval(args);
|
---|
| 998 | typename actor_result<L, TupleT>::type rl = l.eval(args);
|
---|
| 999 | return op(ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl);
|
---|
| 1000 | }
|
---|
| 1001 |
|
---|
| 1002 | mutable OperationT op; // operation
|
---|
| 1003 | A a; B b; C c; D d; E e; F f; G g; H h; I i; J j;
|
---|
| 1004 | K k; L l;// actors
|
---|
| 1005 | };
|
---|
| 1006 |
|
---|
| 1007 | #if PHOENIX_LIMIT > 12
|
---|
| 1008 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 1009 | //
|
---|
| 1010 | // composite <13 actors> class
|
---|
| 1011 | //
|
---|
| 1012 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 1013 | template <typename OperationT, typename TupleT,
|
---|
| 1014 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 1015 | typename F, typename G, typename H, typename I, typename J,
|
---|
| 1016 | typename K, typename L, typename M>
|
---|
| 1017 | struct composite13_result {
|
---|
| 1018 |
|
---|
| 1019 | typedef typename OperationT::template result<
|
---|
| 1020 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 1021 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 1022 | typename actor_result<C, TupleT>::plain_type,
|
---|
| 1023 | typename actor_result<D, TupleT>::plain_type,
|
---|
| 1024 | typename actor_result<E, TupleT>::plain_type,
|
---|
| 1025 | typename actor_result<F, TupleT>::plain_type,
|
---|
| 1026 | typename actor_result<G, TupleT>::plain_type,
|
---|
| 1027 | typename actor_result<H, TupleT>::plain_type,
|
---|
| 1028 | typename actor_result<I, TupleT>::plain_type,
|
---|
| 1029 | typename actor_result<J, TupleT>::plain_type,
|
---|
| 1030 | typename actor_result<K, TupleT>::plain_type,
|
---|
| 1031 | typename actor_result<L, TupleT>::plain_type,
|
---|
| 1032 | typename actor_result<M, TupleT>::plain_type
|
---|
| 1033 | >::type type;
|
---|
| 1034 | };
|
---|
| 1035 |
|
---|
| 1036 | //////////////////////////////////
|
---|
| 1037 | template <typename OperationT,
|
---|
| 1038 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 1039 | typename F, typename G, typename H, typename I, typename J,
|
---|
| 1040 | typename K, typename L, typename M>
|
---|
| 1041 | struct composite<OperationT,
|
---|
| 1042 | A, B, C, D, E, F, G, H, I, J, K, L, M, nil_t, nil_t, nil_t
|
---|
| 1043 | > {
|
---|
| 1044 |
|
---|
| 1045 | typedef composite<OperationT,
|
---|
| 1046 | A, B, C, D, E, F, G, H, I, J, K, L, M> self_t;
|
---|
| 1047 |
|
---|
| 1048 | template <typename TupleT>
|
---|
| 1049 | struct result {
|
---|
| 1050 |
|
---|
| 1051 | typedef typename composite13_result<
|
---|
| 1052 | OperationT, TupleT, A, B, C, D, E, F, G, H, I, J, K, L, M
|
---|
| 1053 | >::type type;
|
---|
| 1054 | };
|
---|
| 1055 |
|
---|
| 1056 | composite(OperationT const& op_,
|
---|
| 1057 | A const& a_, B const& b_, C const& c_, D const& d_, E const& e_,
|
---|
| 1058 | F const& f_, G const& g_, H const& h_, I const& i_, J const& j_,
|
---|
| 1059 | K const& k_, L const& l_, M const& m_)
|
---|
| 1060 | : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_),
|
---|
| 1061 | f(f_), g(g_), h(h_), i(i_), j(j_),
|
---|
| 1062 | k(k_), l(l_), m(m_) {}
|
---|
| 1063 |
|
---|
| 1064 | template <typename TupleT>
|
---|
| 1065 | typename actor_result<self_t, TupleT>::type
|
---|
| 1066 | eval(TupleT const& args) const
|
---|
| 1067 | {
|
---|
| 1068 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 1069 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 1070 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 1071 | typename actor_result<D, TupleT>::type rd = d.eval(args);
|
---|
| 1072 | typename actor_result<E, TupleT>::type re = e.eval(args);
|
---|
| 1073 | typename actor_result<F, TupleT>::type rf = f.eval(args);
|
---|
| 1074 | typename actor_result<G, TupleT>::type rg = g.eval(args);
|
---|
| 1075 | typename actor_result<H, TupleT>::type rh = h.eval(args);
|
---|
| 1076 | typename actor_result<I, TupleT>::type ri = i.eval(args);
|
---|
| 1077 | typename actor_result<J, TupleT>::type rj = j.eval(args);
|
---|
| 1078 | typename actor_result<K, TupleT>::type rk = k.eval(args);
|
---|
| 1079 | typename actor_result<L, TupleT>::type rl = l.eval(args);
|
---|
| 1080 | typename actor_result<M, TupleT>::type rm = m.eval(args);
|
---|
| 1081 | return op(ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm);
|
---|
| 1082 | }
|
---|
| 1083 |
|
---|
| 1084 | mutable OperationT op; // operation
|
---|
| 1085 | A a; B b; C c; D d; E e; F f; G g; H h; I i; J j;
|
---|
| 1086 | K k; L l; M m; // actors
|
---|
| 1087 | };
|
---|
| 1088 |
|
---|
| 1089 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 1090 | //
|
---|
| 1091 | // composite <14 actors> class
|
---|
| 1092 | //
|
---|
| 1093 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 1094 | template <typename OperationT, typename TupleT,
|
---|
| 1095 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 1096 | typename F, typename G, typename H, typename I, typename J,
|
---|
| 1097 | typename K, typename L, typename M, typename N>
|
---|
| 1098 | struct composite14_result {
|
---|
| 1099 |
|
---|
| 1100 | typedef typename OperationT::template result<
|
---|
| 1101 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 1102 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 1103 | typename actor_result<C, TupleT>::plain_type,
|
---|
| 1104 | typename actor_result<D, TupleT>::plain_type,
|
---|
| 1105 | typename actor_result<E, TupleT>::plain_type,
|
---|
| 1106 | typename actor_result<F, TupleT>::plain_type,
|
---|
| 1107 | typename actor_result<G, TupleT>::plain_type,
|
---|
| 1108 | typename actor_result<H, TupleT>::plain_type,
|
---|
| 1109 | typename actor_result<I, TupleT>::plain_type,
|
---|
| 1110 | typename actor_result<J, TupleT>::plain_type,
|
---|
| 1111 | typename actor_result<K, TupleT>::plain_type,
|
---|
| 1112 | typename actor_result<L, TupleT>::plain_type,
|
---|
| 1113 | typename actor_result<M, TupleT>::plain_type,
|
---|
| 1114 | typename actor_result<N, TupleT>::plain_type
|
---|
| 1115 | >::type type;
|
---|
| 1116 | };
|
---|
| 1117 |
|
---|
| 1118 | //////////////////////////////////
|
---|
| 1119 | template <typename OperationT,
|
---|
| 1120 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 1121 | typename F, typename G, typename H, typename I, typename J,
|
---|
| 1122 | typename K, typename L, typename M, typename N>
|
---|
| 1123 | struct composite<OperationT,
|
---|
| 1124 | A, B, C, D, E, F, G, H, I, J, K, L, M, N, nil_t, nil_t
|
---|
| 1125 | > {
|
---|
| 1126 |
|
---|
| 1127 | typedef composite<OperationT,
|
---|
| 1128 | A, B, C, D, E, F, G, H, I, J, K, L, M, N> self_t;
|
---|
| 1129 |
|
---|
| 1130 | template <typename TupleT>
|
---|
| 1131 | struct result {
|
---|
| 1132 |
|
---|
| 1133 | typedef typename composite14_result<
|
---|
| 1134 | OperationT, TupleT, A, B, C, D, E, F, G, H, I, J, K, L, M, N
|
---|
| 1135 | >::type type;
|
---|
| 1136 | };
|
---|
| 1137 |
|
---|
| 1138 | composite(OperationT const& op_,
|
---|
| 1139 | A const& a_, B const& b_, C const& c_, D const& d_, E const& e_,
|
---|
| 1140 | F const& f_, G const& g_, H const& h_, I const& i_, J const& j_,
|
---|
| 1141 | K const& k_, L const& l_, M const& m_, N const& n_)
|
---|
| 1142 | : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_),
|
---|
| 1143 | f(f_), g(g_), h(h_), i(i_), j(j_),
|
---|
| 1144 | k(k_), l(l_), m(m_), n(n_) {}
|
---|
| 1145 |
|
---|
| 1146 | template <typename TupleT>
|
---|
| 1147 | typename actor_result<self_t, TupleT>::type
|
---|
| 1148 | eval(TupleT const& args) const
|
---|
| 1149 | {
|
---|
| 1150 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 1151 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 1152 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 1153 | typename actor_result<D, TupleT>::type rd = d.eval(args);
|
---|
| 1154 | typename actor_result<E, TupleT>::type re = e.eval(args);
|
---|
| 1155 | typename actor_result<F, TupleT>::type rf = f.eval(args);
|
---|
| 1156 | typename actor_result<G, TupleT>::type rg = g.eval(args);
|
---|
| 1157 | typename actor_result<H, TupleT>::type rh = h.eval(args);
|
---|
| 1158 | typename actor_result<I, TupleT>::type ri = i.eval(args);
|
---|
| 1159 | typename actor_result<J, TupleT>::type rj = j.eval(args);
|
---|
| 1160 | typename actor_result<K, TupleT>::type rk = k.eval(args);
|
---|
| 1161 | typename actor_result<L, TupleT>::type rl = l.eval(args);
|
---|
| 1162 | typename actor_result<M, TupleT>::type rm = m.eval(args);
|
---|
| 1163 | typename actor_result<N, TupleT>::type rn = n.eval(args);
|
---|
| 1164 | return op(ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm, rn);
|
---|
| 1165 | }
|
---|
| 1166 |
|
---|
| 1167 | mutable OperationT op; // operation
|
---|
| 1168 | A a; B b; C c; D d; E e; F f; G g; H h; I i; J j;
|
---|
| 1169 | K k; L l; M m; N n; // actors
|
---|
| 1170 | };
|
---|
| 1171 |
|
---|
| 1172 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 1173 | //
|
---|
| 1174 | // composite <15 actors> class
|
---|
| 1175 | //
|
---|
| 1176 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 1177 | template <typename OperationT, typename TupleT,
|
---|
| 1178 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 1179 | typename F, typename G, typename H, typename I, typename J,
|
---|
| 1180 | typename K, typename L, typename M, typename N, typename O>
|
---|
| 1181 | struct composite15_result {
|
---|
| 1182 |
|
---|
| 1183 | typedef typename OperationT::template result<
|
---|
| 1184 | typename actor_result<A, TupleT>::plain_type,
|
---|
| 1185 | typename actor_result<B, TupleT>::plain_type,
|
---|
| 1186 | typename actor_result<C, TupleT>::plain_type,
|
---|
| 1187 | typename actor_result<D, TupleT>::plain_type,
|
---|
| 1188 | typename actor_result<E, TupleT>::plain_type,
|
---|
| 1189 | typename actor_result<F, TupleT>::plain_type,
|
---|
| 1190 | typename actor_result<G, TupleT>::plain_type,
|
---|
| 1191 | typename actor_result<H, TupleT>::plain_type,
|
---|
| 1192 | typename actor_result<I, TupleT>::plain_type,
|
---|
| 1193 | typename actor_result<J, TupleT>::plain_type,
|
---|
| 1194 | typename actor_result<K, TupleT>::plain_type,
|
---|
| 1195 | typename actor_result<L, TupleT>::plain_type,
|
---|
| 1196 | typename actor_result<M, TupleT>::plain_type,
|
---|
| 1197 | typename actor_result<N, TupleT>::plain_type,
|
---|
| 1198 | typename actor_result<O, TupleT>::plain_type
|
---|
| 1199 | >::type type;
|
---|
| 1200 | };
|
---|
| 1201 |
|
---|
| 1202 | //////////////////////////////////
|
---|
| 1203 | template <typename OperationT,
|
---|
| 1204 | typename A, typename B, typename C, typename D, typename E,
|
---|
| 1205 | typename F, typename G, typename H, typename I, typename J,
|
---|
| 1206 | typename K, typename L, typename M, typename N, typename O>
|
---|
| 1207 | struct composite<OperationT,
|
---|
| 1208 | A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, nil_t
|
---|
| 1209 | > {
|
---|
| 1210 |
|
---|
| 1211 | typedef composite<OperationT,
|
---|
| 1212 | A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> self_t;
|
---|
| 1213 |
|
---|
| 1214 | template <typename TupleT>
|
---|
| 1215 | struct result {
|
---|
| 1216 |
|
---|
| 1217 | typedef typename composite15_result<
|
---|
| 1218 | OperationT, TupleT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O
|
---|
| 1219 | >::type type;
|
---|
| 1220 | };
|
---|
| 1221 |
|
---|
| 1222 | composite(OperationT const& op_,
|
---|
| 1223 | A const& a_, B const& b_, C const& c_, D const& d_, E const& e_,
|
---|
| 1224 | F const& f_, G const& g_, H const& h_, I const& i_, J const& j_,
|
---|
| 1225 | K const& k_, L const& l_, M const& m_, N const& n_, O const& o_)
|
---|
| 1226 | : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_),
|
---|
| 1227 | f(f_), g(g_), h(h_), i(i_), j(j_),
|
---|
| 1228 | k(k_), l(l_), m(m_), n(n_), o(o_) {}
|
---|
| 1229 |
|
---|
| 1230 | template <typename TupleT>
|
---|
| 1231 | typename actor_result<self_t, TupleT>::type
|
---|
| 1232 | eval(TupleT const& args) const
|
---|
| 1233 | {
|
---|
| 1234 | typename actor_result<A, TupleT>::type ra = a.eval(args);
|
---|
| 1235 | typename actor_result<B, TupleT>::type rb = b.eval(args);
|
---|
| 1236 | typename actor_result<C, TupleT>::type rc = c.eval(args);
|
---|
| 1237 | typename actor_result<D, TupleT>::type rd = d.eval(args);
|
---|
| 1238 | typename actor_result<E, TupleT>::type re = e.eval(args);
|
---|
| 1239 | typename actor_result<F, TupleT>::type rf = f.eval(args);
|
---|
| 1240 | typename actor_result<G, TupleT>::type rg = g.eval(args);
|
---|
| 1241 | typename actor_result<H, TupleT>::type rh = h.eval(args);
|
---|
| 1242 | typename actor_result<I, TupleT>::type ri = i.eval(args);
|
---|
| 1243 | typename actor_result<J, TupleT>::type rj = j.eval(args);
|
---|
| 1244 | typename actor_result<K, TupleT>::type rk = k.eval(args);
|
---|
| 1245 | typename actor_result<L, TupleT>::type rl = l.eval(args);
|
---|
| 1246 | typename actor_result<M, TupleT>::type rm = m.eval(args);
|
---|
| 1247 | typename actor_result<N, TupleT>::type rn = n.eval(args);
|
---|
| 1248 | typename actor_result<O, TupleT>::type ro = o.eval(args);
|
---|
| 1249 | return op(ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm, rn, ro);
|
---|
| 1250 | }
|
---|
| 1251 |
|
---|
| 1252 | mutable OperationT op; // operation
|
---|
| 1253 | A a; B b; C c; D d; E e; F f; G g; H h; I i; J j;
|
---|
| 1254 | K k; L l; M m; N n; O o; // actors
|
---|
| 1255 | };
|
---|
| 1256 |
|
---|
| 1257 | #endif
|
---|
| 1258 | #endif
|
---|
| 1259 | #endif
|
---|
| 1260 | #endif
|
---|
| 1261 |
|
---|
| 1262 | namespace impl {
|
---|
| 1263 |
|
---|
| 1264 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 1265 | //
|
---|
| 1266 | // make_composite is basically a type computer that answers the
|
---|
| 1267 | // question "Given types T0..TN, what composite type should I
|
---|
| 1268 | // create <composite_type> and if I were to generate an actual
|
---|
| 1269 | // composite, what type <type> should I return?"
|
---|
| 1270 | //
|
---|
| 1271 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 1272 | template <
|
---|
| 1273 | typename OperationT
|
---|
| 1274 | , typename A = nil_t
|
---|
| 1275 | , typename B = nil_t
|
---|
| 1276 | , typename C = nil_t
|
---|
| 1277 |
|
---|
| 1278 | #if PHOENIX_LIMIT > 3
|
---|
| 1279 | , typename D = nil_t
|
---|
| 1280 | , typename E = nil_t
|
---|
| 1281 | , typename F = nil_t
|
---|
| 1282 |
|
---|
| 1283 | #if PHOENIX_LIMIT > 6
|
---|
| 1284 | , typename G = nil_t
|
---|
| 1285 | , typename H = nil_t
|
---|
| 1286 | , typename I = nil_t
|
---|
| 1287 |
|
---|
| 1288 | #if PHOENIX_LIMIT > 9
|
---|
| 1289 | , typename J = nil_t
|
---|
| 1290 | , typename K = nil_t
|
---|
| 1291 | , typename L = nil_t
|
---|
| 1292 |
|
---|
| 1293 | #if PHOENIX_LIMIT > 12
|
---|
| 1294 | , typename M = nil_t
|
---|
| 1295 | , typename N = nil_t
|
---|
| 1296 | , typename O = nil_t
|
---|
| 1297 |
|
---|
| 1298 | #endif
|
---|
| 1299 | #endif
|
---|
| 1300 | #endif
|
---|
| 1301 | #endif
|
---|
| 1302 | >
|
---|
| 1303 | struct make_composite {
|
---|
| 1304 |
|
---|
| 1305 | typedef composite<OperationT
|
---|
| 1306 | , typename as_actor<A>::type
|
---|
| 1307 | , typename as_actor<B>::type
|
---|
| 1308 | , typename as_actor<C>::type
|
---|
| 1309 |
|
---|
| 1310 | #if PHOENIX_LIMIT > 3
|
---|
| 1311 | , typename as_actor<D>::type
|
---|
| 1312 | , typename as_actor<E>::type
|
---|
| 1313 | , typename as_actor<F>::type
|
---|
| 1314 |
|
---|
| 1315 | #if PHOENIX_LIMIT > 6
|
---|
| 1316 | , typename as_actor<G>::type
|
---|
| 1317 | , typename as_actor<H>::type
|
---|
| 1318 | , typename as_actor<I>::type
|
---|
| 1319 |
|
---|
| 1320 | #if PHOENIX_LIMIT > 9
|
---|
| 1321 | , typename as_actor<J>::type
|
---|
| 1322 | , typename as_actor<K>::type
|
---|
| 1323 | , typename as_actor<L>::type
|
---|
| 1324 |
|
---|
| 1325 | #if PHOENIX_LIMIT > 12
|
---|
| 1326 | , typename as_actor<M>::type
|
---|
| 1327 | , typename as_actor<N>::type
|
---|
| 1328 | , typename as_actor<O>::type
|
---|
| 1329 |
|
---|
| 1330 | #endif
|
---|
| 1331 | #endif
|
---|
| 1332 | #endif
|
---|
| 1333 | #endif
|
---|
| 1334 | > composite_type;
|
---|
| 1335 |
|
---|
| 1336 | typedef actor<composite_type> type;
|
---|
| 1337 | };
|
---|
| 1338 |
|
---|
| 1339 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 1340 | //
|
---|
| 1341 | // make_unary, make_binary, make_binary1, make_binary2 and
|
---|
| 1342 | // make_binary3 utilities are provided here for easy creation of
|
---|
| 1343 | // unary and binary composites.
|
---|
| 1344 | //
|
---|
| 1345 | ///////////////////////////////////////////////////////////////////////////
|
---|
| 1346 |
|
---|
| 1347 | ////////////////////////////////// input is an actor
|
---|
| 1348 | template <typename OperationT, typename BaseT>
|
---|
| 1349 | struct make_unary {
|
---|
| 1350 |
|
---|
| 1351 | typedef typename make_composite
|
---|
| 1352 | <OperationT, actor<BaseT> >::type type;
|
---|
| 1353 |
|
---|
| 1354 | static type
|
---|
| 1355 | construct(actor<BaseT> const& _0)
|
---|
| 1356 | {
|
---|
| 1357 | typedef typename make_composite
|
---|
| 1358 | <OperationT, actor<BaseT> >::composite_type
|
---|
| 1359 | ret_t;
|
---|
| 1360 |
|
---|
| 1361 | return ret_t(OperationT(), _0);
|
---|
| 1362 | }
|
---|
| 1363 | };
|
---|
| 1364 |
|
---|
| 1365 | ////////////////////////////////// LHS is an actor, RHS is unknown
|
---|
| 1366 | template <typename OperationT, typename BaseT, typename B>
|
---|
| 1367 | struct make_binary1 {
|
---|
| 1368 |
|
---|
| 1369 | typedef typename make_composite
|
---|
| 1370 | <OperationT, actor<BaseT>, B>::type type;
|
---|
| 1371 |
|
---|
| 1372 | static type
|
---|
| 1373 | construct(actor<BaseT> const& _0, B const& _1)
|
---|
| 1374 | {
|
---|
| 1375 | typedef typename make_composite
|
---|
| 1376 | <OperationT, actor<BaseT>, B>::composite_type
|
---|
| 1377 | ret_t;
|
---|
| 1378 |
|
---|
| 1379 | return ret_t(OperationT(), _0, as_actor<B>::convert(_1));
|
---|
| 1380 | }
|
---|
| 1381 | };
|
---|
| 1382 |
|
---|
| 1383 | ////////////////////////////////// LHS is unknown, RHS is an actor
|
---|
| 1384 | template <typename OperationT, typename A, typename BaseT>
|
---|
| 1385 | struct make_binary2 {
|
---|
| 1386 |
|
---|
| 1387 | typedef typename make_composite
|
---|
| 1388 | <OperationT, A, actor<BaseT> >::type type;
|
---|
| 1389 |
|
---|
| 1390 | static type
|
---|
| 1391 | construct(A const& _0, actor<BaseT> const& _1)
|
---|
| 1392 | {
|
---|
| 1393 | typedef typename make_composite
|
---|
| 1394 | <OperationT, A, actor<BaseT> >::composite_type
|
---|
| 1395 | ret_t;
|
---|
| 1396 |
|
---|
| 1397 | return ret_t(OperationT(), as_actor<A>::convert(_0), _1);
|
---|
| 1398 | }
|
---|
| 1399 | };
|
---|
| 1400 |
|
---|
| 1401 | ////////////////////////////////// Both LHS and RHS are actors
|
---|
| 1402 | template <typename OperationT, typename BaseA, typename BaseB>
|
---|
| 1403 | struct make_binary3 {
|
---|
| 1404 |
|
---|
| 1405 | typedef typename make_composite
|
---|
| 1406 | <OperationT, actor<BaseA>, actor<BaseB> >::type type;
|
---|
| 1407 |
|
---|
| 1408 | static type
|
---|
| 1409 | construct(actor<BaseA> const& _0, actor<BaseB> const& _1)
|
---|
| 1410 | {
|
---|
| 1411 | typedef typename make_composite
|
---|
| 1412 | <OperationT, actor<BaseA>, actor<BaseB> >::composite_type
|
---|
| 1413 | ret_t;
|
---|
| 1414 |
|
---|
| 1415 | return ret_t(OperationT(), _0, _1);
|
---|
| 1416 | }
|
---|
| 1417 | };
|
---|
| 1418 |
|
---|
| 1419 | } // namespace impl
|
---|
| 1420 |
|
---|
| 1421 | } // namespace phoenix
|
---|
| 1422 |
|
---|
| 1423 | #endif
|
---|