Muesli
 All Classes Namespaces Files Functions Typedefs Enumerations
curry.h
1 /*
2  * curry.h
3  *
4  * Author: J. Striegnitz
5  *
6  * -------------------------------------------------------------------------------
7  *
8  * The MIT License
9  *
10  * Copyright 2001 J. Striegnitz.
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a copy
13  * of this software and associated documentation files (the "Software"), to deal
14  * in the Software without restriction, including without limitation the rights
15  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16  * copies of the Software, and to permit persons to whom the Software is
17  * furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be included in
20  * all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28  * THE SOFTWARE.
29  *
30  */
31 
32 #pragma once
33 
34 #include <iostream>
35 
36 namespace msl {
37 
38 template<typename T>
39 struct typeTraits
40 {
41  typedef T id_t;
42  typedef T plain_t;
43  typedef T* pointer_t;
44  typedef T& reference_t;
45  typedef const T const_t;
46  typedef const T* const_pointer_t;
47  typedef const T& const_reference_t;
48  typedef const T* const const_pointer_to_const_t;
49 
50  typedef const T& mkArg_t;
51 };
52 
53 template<typename T>
54 struct typeTraits<T*>
55 {
56  typedef T* id_t;
57  typedef T plain_t;
58  typedef T* pointer_t;
59  typedef T& reference_t;
60  typedef const T const_t;
61  typedef const T* const_pointer_t;
62  typedef const T& const_reference_t;
63  typedef const T* const const_pointer_to_const_t;
64 
65  typedef T* mkArg_t;
66 };
67 
68 template<typename T>
69 struct typeTraits<T&>
70 {
71  typedef T& id_t;
72  typedef T plain_t;
73  typedef T* pointer_t;
74  typedef T& reference_t;
75  typedef const T const_t;
76  typedef const T* const_pointer_t;
77  typedef const T& const_reference_t;
78  typedef const T* const const_pointer_to_const_t;
79 
80  typedef const T& mkArg_t;
81 };
82 
83 template<typename T>
84 struct typeTraits<const T>
85 {
86  typedef const T id_t;
87  typedef T plain_t;
88  typedef T* pointer_t;
89  typedef T& reference_t;
90  typedef const T const_t;
91  typedef const T* const_pointer_t;
92  typedef const T& const_reference_t;
93  typedef const T* const const_pointer_to_const_t;
94 
95  typedef const T& mkArg_t;
96 };
97 
98 template<typename T>
99 struct typeTraits<const T&>
100 {
101  typedef const T& id_t;
102  typedef T plain_t;
103  typedef T* pointer_t;
104  typedef T& reference_t;
105  typedef const T const_t;
106  typedef const T* const_pointer_t;
107  typedef const T& const_reference_t;
108  typedef const T* const const_pointer_to_const_t;
109 
110  typedef const T& mkArg_t;
111 };
112 
113 template<typename T>
114 struct typeTraits<const T*>
115 {
116  typedef const T* id_t;
117  typedef T plain_t;
118  typedef T* pointer_t;
119  typedef T& reference_t;
120  typedef const T const_t;
121  typedef const T* const_pointer_t;
122  typedef const T& const_reference_t;
123  typedef const T* const const_pointer_to_const_t;
124 
125  typedef const T* mkArg_t;
126 };
127 
128 template<typename T>
130 {
131 
132  typedef typename typeTraits<T>::mkArg_t Type_t;
133  // If you don't want to enforce constant references,
134  // you may use the following definition instead:
135  // typedef T Type_t;
136 
137 };
138 
139 template<typename R, typename F>
140 class Fct0
141 {
142 
143  F f;
144 
145 public:
146 
147  // Constructor, copy constructor and destructor
148  Fct0(const F& _f)
149  : f(_f)
150  {
151  }
152 
153  Fct0(const Fct0& rhs)
154  : f(rhs.f)
155  {
156  }
157 
158  ~Fct0()
159  {
160  }
161 
162  inline operator R() const
163  {
164  return f();
165  }
166  // Full application -> delegate to instance of F
167 
168  inline R operator()() const
169  {
170  return f();
171  }
172  // Support for partial application
173 
174 };
175 
176 // curry functions
177 template<typename R>
178 inline Fct0<R, R (*)()> curry(R (*f)())
179 {
180  return Fct0<R, R (*)()>(f);
181 }
182 
183 // stream inserters
184 template<typename R, typename F>
185 inline std::ostream& operator<<(std::ostream& os, const Fct0<R, F>&)
186 {
187  os << "0-ary function";
188  return os;
189 }
190 
191 template<typename A0, typename R, typename F>
192 class Fct1
193 {
194 
195  F f;
196 
197 public:
198 
199  // Constructor, copy constructor and destructor
200  Fct1(const F& _f)
201  : f(_f)
202  {
203  }
204 
205  Fct1(const Fct1& rhs)
206  : f(rhs.f)
207  {
208  }
209 
210  ~Fct1()
211  {
212  }
213 
214  // Closures
215  struct closureT
216  {
217 
218  F op;
219  A0 pa0;
220 
221  closureT(const F& _op, typename curryArgMode<A0>::Type_t _pa0)
222  : op(_op), pa0(_pa0)
223  {
224  }
225 
226  closureT(const closureT& rhs)
227  : op(rhs.op), pa0(rhs.pa0)
228  {
229  }
230 
231  inline R operator()() const
232  {
233  return op(pa0);
234  }
235 
236  };
237 
239 
240  inline closure_t closure(typename curryArgMode<A0>::Type_t a0) const
241  {
242  return closure_t(closureT(f, a0));
243  }
244  // Full application -> delegate to instance of F
245 
246  inline R operator()(typename curryArgMode<A0>::Type_t a0) const
247  {
248  return f(a0);
249  }
250  // Support for partial application
251 
252 };
253 
254 // curry functions
255 template<typename A0, typename R>
256 inline Fct1<A0, R, R (*)(A0)> curry(R (*f)(A0))
257 {
258  return Fct1<A0, R, R (*)(A0)>(f);
259 }
260 
261 // stream inserters
262 template<typename A0, typename R, typename F>
263 inline std::ostream& operator<<(std::ostream& os, const Fct1<A0, R, F>&)
264 {
265  os << "1-ary function";
266  return os;
267 }
268 template<typename A0, typename A1, typename R, typename F>
269 class Fct2
270 {
271 
272  F f;
273 
274 public:
275 
276  // Constructor, copy constructor and destructor
277  Fct2(const F& _f)
278  : f(_f)
279  {
280  }
281 
282  Fct2(const Fct2& rhs)
283  : f(rhs.f)
284  {
285  }
286 
287  ~Fct2()
288  {
289  }
290 
291  // Closures
292  struct closureT
293  {
294 
295  F op;
296  A0 pa0;
297  A1 pa1;
298 
299  closureT(const F& _op, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1)
300  : op(_op), pa0(_pa0), pa1(_pa1)
301  {
302  }
303 
304  closureT(const closureT& rhs)
305  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1)
306  {
307  }
308 
309  inline R operator()() const
310  {
311  return op(pa0, pa1);
312  }
313 
314  };
315 
317 
318  inline closure_t closure(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const
319  {
320  return closure_t(closureT(f, a0, a1));
321  }
322 
323  // Full application -> delegate to instance of F
324  inline R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const
325  {
326  return f(a0, a1);
327  }
328 
329  // Support for partial application
330  // F applied to 1 arguments
332  {
333 
334  F f;
335  A0 pa0;
336 
337  PartialAppl1(const F& _f, typename curryArgMode<A0>::Type_t _pa0)
338  : f(_f), pa0(_pa0)
339  {
340  }
341 
342  PartialAppl1(const PartialAppl1& rhs)
343  : f(rhs.f), pa0(rhs.pa0)
344  {
345  }
346 
347  inline R operator()(typename curryArgMode<A1>::Type_t a1) const
348  {
349  return f(pa0, a1);
350  }
351 
352  };
353 
355 
356  inline ffunc1_t operator()(typename curryArgMode<A0>::Type_t a0) const
357  {
358  return ffunc1_t(PartialAppl1(f, a0));
359  }
360 };
361 
362 // curry functions
363 template<typename A0, typename A1, typename R>
364 inline Fct2<A0, A1, R, R (*)(A0, A1)> curry(R (*f)(A0, A1))
365 {
366  return Fct2<A0, A1, R, R (*)(A0, A1)>(f);
367 }
368 
369 // stream inserters
370 template<typename A0, typename A1, typename R, typename F>
371 inline std::ostream& operator<<(std::ostream& os, const Fct2<A0, A1, R, F> &)
372 {
373  os << "2-ary function";
374  return os;
375 }
376 
377 template<typename A0, typename A1, typename A2, typename R, typename F>
378 class Fct3
379 {
380 
381  F f;
382 
383 public:
384 
385  // Constructor, copy constructor and destructor
386  Fct3(const F& _f)
387  : f(_f)
388  {
389  }
390 
391  Fct3(const Fct3& rhs)
392  : f(rhs.f)
393  {
394  }
395 
396  ~Fct3()
397  {
398  }
399 
400  // Closures
401  struct closureT
402  {
403 
404  F op;
405  A0 pa0;
406  A1 pa1;
407  A2 pa2;
408 
409  closureT(const F& _op, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1,
410  typename curryArgMode<A2>::Type_t _pa2)
411  : op(_op), pa0(_pa0), pa1(_pa1), pa2(_pa2)
412  {
413  }
414 
415  closureT(const closureT& rhs)
416  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2)
417  {
418  }
419 
420  inline R operator()() const
421  {
422  return op(pa0, pa1, pa2);
423  }
424 
425  };
426 
428 
429  inline closure_t closure(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
430  typename curryArgMode<A2>::Type_t a2) const
431  {
432  return closure_t(closureT(f, a0, a1, a2));
433  }
434 
435  // Full application -> delegate to instance of F
436  inline R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
437  typename curryArgMode<A2>::Type_t a2) const
438  {
439  return f(a0, a1, a2);
440  }
441 
442  // Support for partial application
443  // F applied to 1 arguments
445  {
446 
447  F f;
448  A0 pa0;
449 
450  PartialAppl1(const F& _f, typename curryArgMode<A0>::Type_t _pa0)
451  : f(_f), pa0(_pa0)
452  {
453  }
454 
455  PartialAppl1(const PartialAppl1& rhs)
456  : f(rhs.f), pa0(rhs.pa0)
457  {
458  }
459 
460  inline R operator()(typename curryArgMode<A1>::Type_t a1, typename curryArgMode<A2>::Type_t a2) const
461  {
462  return f(pa0, a1, a2);
463  }
464 
465  };
466 
468 
469  inline ffunc1_t operator()(typename curryArgMode<A0>::Type_t a0) const
470  {
471  return ffunc1_t(PartialAppl1(f, a0));
472  }
473 
474  // F applied to 2 arguments
476  {
477 
478  F f;
479  A0 pa0;
480  A1 pa1;
481 
482  PartialAppl2(const F& _f, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1)
483  : f(_f), pa0(_pa0), pa1(_pa1)
484  {
485  }
486 
487  PartialAppl2(const PartialAppl2& rhs)
488  : f(rhs.f), pa0(rhs.pa0), pa1(rhs.pa1)
489  {
490  }
491 
492  inline R operator()(typename curryArgMode<A2>::Type_t a2) const
493  {
494  return f(pa0, pa1, a2);
495  }
496 
497  };
498 
500 
501  inline ffunc2_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const
502  {
503  return ffunc2_t(PartialAppl2(f, a0, a1));
504  }
505 
506 };
507 
508 // curry functions
509 template<typename A0, typename A1, typename A2, typename R>
510 inline Fct3<A0, A1, A2, R, R (*)(A0, A1, A2)> curry(R (*f)(A0, A1, A2))
511 {
512  return Fct3<A0, A1, A2, R, R (*)(A0, A1, A2)>(f);
513 }
514 
515 // stream inserters
516 template<typename A0, typename A1, typename A2, typename R, typename F>
517 inline std::ostream& operator<<(std::ostream& os, const Fct3<A0, A1, A2, R, F> &)
518 {
519  os << "3-ary function";
520  return os;
521 }
522 
523 template<typename A0, typename A1, typename A2, typename A3, typename R, typename F>
524 class Fct4
525 {
526 
527  F f;
528 
529 public:
530 
531  // Constructor, copy constructor and destructor
532  Fct4(const F& _f)
533  : f(_f)
534  {
535  }
536 
537  Fct4(const Fct4& rhs)
538  : f(rhs.f)
539  {
540  }
541 
542  ~Fct4()
543  {
544  }
545 
546  // Closures
547  struct closureT
548  {
549 
550  F op;
551  A0 pa0;
552  A1 pa1;
553  A2 pa2;
554  A3 pa3;
555 
556  closureT(const F& _op, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1,
557  typename curryArgMode<A2>::Type_t _pa2, typename curryArgMode<A3>::Type_t _pa3)
558  : op(_op), pa0(_pa0), pa1(_pa1), pa2(_pa2), pa3(_pa3)
559  {
560  }
561 
562  closureT(const closureT& rhs)
563  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2), pa3(rhs.pa3)
564  {
565  }
566 
567  inline R operator()() const
568  {
569  return op(pa0, pa1, pa2, pa3);
570  }
571  };
572 
574 
575  inline closure_t closure(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
576  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3) const
577  {
578  return closure_t(closureT(f, a0, a1, a2, a3));
579  }
580 
581  // Full application -> delegate to instance of F
582  inline R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
583  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3) const
584  {
585  return f(a0, a1, a2, a3);
586  }
587 
588  // Support for partial application
589  // F applied to 1 arguments
591  {
592 
593  F f;
594  A0 pa0;
595 
596  PartialAppl1(const F& _f, typename curryArgMode<A0>::Type_t _pa0)
597  : f(_f), pa0(_pa0)
598  {
599  }
600 
601  PartialAppl1(const PartialAppl1& rhs)
602  : f(rhs.f), pa0(rhs.pa0)
603  {
604  }
605 
606  inline R operator()(typename curryArgMode<A1>::Type_t a1, typename curryArgMode<A2>::Type_t a2,
607  typename curryArgMode<A3>::Type_t a3) const
608  {
609  return f(pa0, a1, a2, a3);
610  }
611  };
612 
614 
615  inline ffunc1_t operator()(typename curryArgMode<A0>::Type_t a0) const
616  {
617  return ffunc1_t(PartialAppl1(f, a0));
618  }
619 
620  // F applied to 2 arguments
622  {
623 
624  F f;
625  A0 pa0;
626  A1 pa1;
627 
628  PartialAppl2(const F& _f, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1)
629  : f(_f), pa0(_pa0), pa1(_pa1)
630  {
631  }
632 
633  PartialAppl2(const PartialAppl2& rhs)
634  : f(rhs.f), pa0(rhs.pa0), pa1(rhs.pa1)
635  {
636  }
637 
638  inline R operator()(typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3) const
639  {
640  return f(pa0, pa1, a2, a3);
641  }
642  };
643 
645 
646  inline ffunc2_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const
647  {
648  return ffunc2_t(PartialAppl2(f, a0, a1));
649  }
650 
651  // F applied to 3 arguments
653  {
654 
655  F f;
656  A0 pa0;
657  A1 pa1;
658  A2 pa2;
659 
660  PartialAppl3(const F& _f, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1,
661  typename curryArgMode<A2>::Type_t _pa2)
662  : f(_f), pa0(_pa0), pa1(_pa1), pa2(_pa2)
663  {
664  }
665 
666  PartialAppl3(const PartialAppl3& rhs)
667  : f(rhs.f), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2)
668  {
669  }
670 
671  inline R operator()(typename curryArgMode<A3>::Type_t a3) const
672  {
673  return f(pa0, pa1, pa2, a3);
674  }
675  };
676 
678 
679  inline ffunc3_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
680  typename curryArgMode<A2>::Type_t a2) const
681  {
682  return ffunc3_t(PartialAppl3(f, a0, a1, a2));
683  }
684 };
685 
686 // curry functions
687 template<typename A0, typename A1, typename A2, typename A3, typename R>
688 inline Fct4<A0, A1, A2, A3, R, R (*)(A0, A1, A2, A3)> curry(R (*f)(A0, A1, A2, A3))
689 {
690  return Fct4<A0, A1, A2, A3, R, R (*)(A0, A1, A2, A3)>(f);
691 }
692 
693 // stream inserters
694 template<typename A0, typename A1, typename A2, typename A3, typename R, typename F>
695 inline std::ostream& operator<<(std::ostream& os, const Fct4<A0, A1, A2, A3, R, F> &)
696 {
697  os << "4-ary function";
698  return os;
699 }
700 
701 template<typename A0, typename A1, typename A2, typename A3, typename A4, typename R, typename F>
702 class Fct5
703 {
704 
705  F f;
706 
707 public:
708 
709  // Constructor, copy constructor and destructor
710  Fct5(const F& _f)
711  : f(_f)
712  {
713  }
714 
715  Fct5(const Fct5& rhs)
716  : f(rhs.f)
717  {
718  }
719 
720  ~Fct5()
721  {
722  }
723 
724  // Closures
725  struct closureT
726  {
727 
728  F op;
729  A0 pa0;
730  A1 pa1;
731  A2 pa2;
732  A3 pa3;
733  A4 pa4;
734 
735  closureT(const F& _op, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1,
736  typename curryArgMode<A2>::Type_t _pa2, typename curryArgMode<A3>::Type_t _pa3,
737  typename curryArgMode<A4>::Type_t _pa4)
738  : op(_op), pa0(_pa0), pa1(_pa1), pa2(_pa2), pa3(_pa3), pa4(_pa4)
739  {
740  }
741 
742  closureT(const closureT& rhs)
743  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2), pa3(rhs.pa3), pa4(rhs.pa4)
744  {
745  }
746 
747  inline R operator()() const
748  {
749  return op(pa0, pa1, pa2, pa3, pa4);
750  }
751  };
752 
754 
755  inline closure_t closure(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
756  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
757  typename curryArgMode<A4>::Type_t a4) const
758  {
759  return closure_t(closureT(f, a0, a1, a2, a3, a4));
760  }
761 
762  // Full application -> delegate to instance of F
763  inline R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
764  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
765  typename curryArgMode<A4>::Type_t a4) const
766  {
767  return f(a0, a1, a2, a3, a4);
768  }
769 
770  // Support for partial application
771  // F applied to 1 arguments
773  {
774 
775  F f;
776  A0 pa0;
777 
778  PartialAppl1(const F& _f, typename curryArgMode<A0>::Type_t _pa0)
779  : f(_f), pa0(_pa0)
780  {
781  }
782 
783  PartialAppl1(const PartialAppl1& rhs)
784  : f(rhs.f), pa0(rhs.pa0)
785  {
786  }
787 
788  inline R operator()(typename curryArgMode<A1>::Type_t a1, typename curryArgMode<A2>::Type_t a2,
789  typename curryArgMode<A3>::Type_t a3, typename curryArgMode<A4>::Type_t a4) const
790  {
791  return f(pa0, a1, a2, a3, a4);
792  }
793  };
794 
796 
797  inline ffunc1_t operator()(typename curryArgMode<A0>::Type_t a0) const
798  {
799  return ffunc1_t(PartialAppl1(f, a0));
800  }
801 
802  // F applied to 2 arguments
804  {
805 
806  F f;
807  A0 pa0;
808  A1 pa1;
809 
810  PartialAppl2(const F& _f, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1)
811  : f(_f), pa0(_pa0), pa1(_pa1)
812  {
813  }
814 
815  PartialAppl2(const PartialAppl2& rhs)
816  : f(rhs.f), pa0(rhs.pa0), pa1(rhs.pa1)
817  {
818  }
819 
820  inline R operator()(typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
821  typename curryArgMode<A4>::Type_t a4) const
822  {
823  return f(pa0, pa1, a2, a3, a4);
824  }
825  };
826 
828 
829  inline ffunc2_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const
830  {
831  return ffunc2_t(PartialAppl2(f, a0, a1));
832  }
833 
834  // F applied to 3 arguments
836  {
837 
838  F f;
839  A0 pa0;
840  A1 pa1;
841  A2 pa2;
842 
843  PartialAppl3(const F& _f, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1,
844  typename curryArgMode<A2>::Type_t _pa2)
845  : f(_f), pa0(_pa0), pa1(_pa1), pa2(_pa2)
846  {
847  }
848 
849  PartialAppl3(const PartialAppl3& rhs)
850  : f(rhs.f), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2)
851  {
852  }
853 
854  inline R operator()(typename curryArgMode<A3>::Type_t a3, typename curryArgMode<A4>::Type_t a4) const
855  {
856  return f(pa0, pa1, pa2, a3, a4);
857  }
858  };
859 
861 
862  inline ffunc3_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
863  typename curryArgMode<A2>::Type_t a2) const
864  {
865  return ffunc3_t(PartialAppl3(f, a0, a1, a2));
866  }
867 
868  // F applied to 4 arguments
870  {
871 
872  F f;
873  A0 pa0;
874  A1 pa1;
875  A2 pa2;
876  A3 pa3;
877 
878  PartialAppl4(const F& _f, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1,
879  typename curryArgMode<A2>::Type_t _pa2, typename curryArgMode<A3>::Type_t _pa3)
880  : f(_f), pa0(_pa0), pa1(_pa1), pa2(_pa2), pa3(_pa3)
881  {
882  }
883 
884  PartialAppl4(const PartialAppl4& rhs)
885  : f(rhs.f), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2), pa3(rhs.pa3)
886  {
887  }
888 
889  inline R operator()(typename curryArgMode<A4>::Type_t a4) const
890  {
891  return f(pa0, pa1, pa2, pa3, a4);
892  }
893  };
894 
896 
897  inline ffunc4_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
898  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3) const
899  {
900  return ffunc4_t(PartialAppl4(f, a0, a1, a2, a3));
901  }
902 };
903 
904 // curry functions
905 template<typename A0, typename A1, typename A2, typename A3, typename A4, typename R>
906 inline Fct5<A0, A1, A2, A3, A4, R, R (*)(A0, A1, A2, A3, A4)> curry(R (*f)(A0, A1, A2, A3, A4))
907 {
908  return Fct5<A0, A1, A2, A3, A4, R, R (*)(A0, A1, A2, A3, A4)>(f);
909 }
910 
911 // stream inserters
912 template<typename A0, typename A1, typename A2, typename A3, typename A4, typename R, typename F>
913 inline std::ostream& operator<<(std::ostream& os, const Fct5<A0, A1, A2, A3, A4, R, F> &)
914 {
915  os << "5-ary function";
916  return os;
917 }
918 
919 template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename R, typename F>
920 class Fct6
921 {
922 
923  F f;
924 
925 public:
926 
927  // Constructor, copy constructor and destructor
928  Fct6(const F& _f)
929  : f(_f)
930  {
931  }
932 
933  Fct6(const Fct6& rhs)
934  : f(rhs.f)
935  {
936  }
937 
938  ~Fct6()
939  {
940  }
941 
942  // Closures
943  struct closureT
944  {
945 
946  F op;
947  A0 pa0;
948  A1 pa1;
949  A2 pa2;
950  A3 pa3;
951  A4 pa4;
952  A5 pa5;
953 
954  closureT(const F& _op, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1,
955  typename curryArgMode<A2>::Type_t _pa2, typename curryArgMode<A3>::Type_t _pa3,
956  typename curryArgMode<A4>::Type_t _pa4, typename curryArgMode<A5>::Type_t _pa5)
957  : op(_op), pa0(_pa0), pa1(_pa1), pa2(_pa2), pa3(_pa3), pa4(_pa4), pa5(_pa5)
958  {
959  }
960 
961  closureT(const closureT& rhs)
962  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2), pa3(rhs.pa3), pa4(rhs.pa4), pa5(rhs.pa5)
963  {
964  }
965 
966  inline R operator()() const
967  {
968  return op(pa0, pa1, pa2, pa3, pa4, pa5);
969  }
970  };
971 
973 
974  inline closure_t closure(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
975  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
976  typename curryArgMode<A4>::Type_t a4, typename curryArgMode<A5>::Type_t a5) const
977  {
978  return closure_t(closureT(f, a0, a1, a2, a3, a4, a5));
979  }
980 
981  // Full application -> delegate to instance of F
982  inline R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
983  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
984  typename curryArgMode<A4>::Type_t a4, typename curryArgMode<A5>::Type_t a5) const
985  {
986  return f(a0, a1, a2, a3, a4, a5);
987  }
988 
989  // Support for partial application
990  // F applied to 1 arguments
992  {
993 
994  F f;
995  A0 pa0;
996 
997  PartialAppl1(const F& _f, typename curryArgMode<A0>::Type_t _pa0)
998  : f(_f), pa0(_pa0)
999  {
1000  }
1001 
1002  PartialAppl1(const PartialAppl1& rhs)
1003  : f(rhs.f), pa0(rhs.pa0)
1004  {
1005  }
1006 
1007  inline R operator()(typename curryArgMode<A1>::Type_t a1, typename curryArgMode<A2>::Type_t a2,
1008  typename curryArgMode<A3>::Type_t a3, typename curryArgMode<A4>::Type_t a4,
1009  typename curryArgMode<A5>::Type_t a5) const
1010  {
1011  return f(pa0, a1, a2, a3, a4, a5);
1012  }
1013  };
1014 
1016 
1017  inline ffunc1_t operator()(typename curryArgMode<A0>::Type_t a0) const
1018  {
1019  return ffunc1_t(PartialAppl1(f, a0));
1020  }
1021 
1022  // F applied to 2 arguments
1024  {
1025 
1026  F f;
1027  A0 pa0;
1028  A1 pa1;
1029 
1030  PartialAppl2(const F& _f, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1)
1031  : f(_f), pa0(_pa0), pa1(_pa1)
1032  {
1033  }
1034 
1035  PartialAppl2(const PartialAppl2& rhs)
1036  : f(rhs.f), pa0(rhs.pa0), pa1(rhs.pa1)
1037  {
1038  }
1039 
1040  inline R operator()(typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
1041  typename curryArgMode<A4>::Type_t a4, typename curryArgMode<A5>::Type_t a5) const
1042  {
1043  return f(pa0, pa1, a2, a3, a4, a5);
1044  }
1045  };
1046 
1048 
1049  inline ffunc2_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const
1050  {
1051  return ffunc2_t(PartialAppl2(f, a0, a1));
1052  }
1053 
1054  // F applied to 3 arguments
1056  {
1057 
1058  F f;
1059  A0 pa0;
1060  A1 pa1;
1061  A2 pa2;
1062 
1063  PartialAppl3(const F& _f, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1,
1064  typename curryArgMode<A2>::Type_t _pa2)
1065  : f(_f), pa0(_pa0), pa1(_pa1), pa2(_pa2)
1066  {
1067  }
1068 
1069  PartialAppl3(const PartialAppl3& rhs)
1070  : f(rhs.f), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2)
1071  {
1072  }
1073 
1074  inline R operator()(typename curryArgMode<A3>::Type_t a3, typename curryArgMode<A4>::Type_t a4,
1075  typename curryArgMode<A5>::Type_t a5) const
1076  {
1077  return f(pa0, pa1, pa2, a3, a4, a5);
1078  }
1079  };
1080 
1082 
1083  inline ffunc3_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
1084  typename curryArgMode<A2>::Type_t a2) const
1085  {
1086  return ffunc3_t(PartialAppl3(f, a0, a1, a2));
1087  }
1088 
1089  // F applied to 4 arguments
1091  {
1092 
1093  F f;
1094  A0 pa0;
1095  A1 pa1;
1096  A2 pa2;
1097  A3 pa3;
1098 
1099  PartialAppl4(const F& _f, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1,
1100  typename curryArgMode<A2>::Type_t _pa2, typename curryArgMode<A3>::Type_t _pa3)
1101  : f(_f), pa0(_pa0), pa1(_pa1), pa2(_pa2), pa3(_pa3)
1102  {
1103  }
1104 
1105  PartialAppl4(const PartialAppl4& rhs)
1106  : f(rhs.f), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2), pa3(rhs.pa3)
1107  {
1108  }
1109 
1110  inline R operator()(typename curryArgMode<A4>::Type_t a4, typename curryArgMode<A5>::Type_t a5) const
1111  {
1112  return f(pa0, pa1, pa2, pa3, a4, a5);
1113  }
1114  };
1115 
1117 
1118  inline ffunc4_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
1119  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3) const
1120  {
1121  return ffunc4_t(PartialAppl4(f, a0, a1, a2, a3));
1122  }
1123 
1124  // F applied to 5 arguments
1126  {
1127 
1128  F f;
1129  A0 pa0;
1130  A1 pa1;
1131  A2 pa2;
1132  A3 pa3;
1133  A4 pa4;
1134 
1135  PartialAppl5(const F& _f, typename curryArgMode<A0>::Type_t _pa0, typename curryArgMode<A1>::Type_t _pa1,
1136  typename curryArgMode<A2>::Type_t _pa2, typename curryArgMode<A3>::Type_t _pa3,
1137  typename curryArgMode<A4>::Type_t _pa4)
1138  : f(_f), pa0(_pa0), pa1(_pa1), pa2(_pa2), pa3(_pa3), pa4(_pa4)
1139  {
1140  }
1141 
1142  PartialAppl5(const PartialAppl5& rhs)
1143  : f(rhs.f), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2), pa3(rhs.pa3), pa4(rhs.pa4)
1144  {
1145  }
1146 
1147  inline R operator()(typename curryArgMode<A5>::Type_t a5) const
1148  {
1149  return f(pa0, pa1, pa2, pa3, pa4, a5);
1150  }
1151  };
1152 
1154 
1155  inline ffunc5_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
1156  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
1157  typename curryArgMode<A4>::Type_t a4) const
1158  {
1159  return ffunc5_t(PartialAppl5(f, a0, a1, a2, a3, a4));
1160  }
1161 };
1162 
1163 // curry functions
1164 template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename R>
1165 inline Fct6<A0, A1, A2, A3, A4, A5, R, R (*)(A0, A1, A2, A3, A4, A5)> curry(R (*f)(A0, A1, A2, A3, A4, A5))
1166 {
1167  return Fct6<A0, A1, A2, A3, A4, A5, R, R (*)(A0, A1, A2, A3, A4, A5)>(f);
1168 }
1169 
1170 // stream inserters
1171 template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename R, typename F>
1172 inline std::ostream& operator<<(std::ostream& os, const Fct6<A0, A1, A2, A3, A4, A5, R, F> &)
1173 {
1174  os << "6-ary function";
1175  return os;
1176 }
1177 
1178 template<typename R>
1179 struct anyOp0
1180 {
1181 
1182  anyOp0()
1183  {
1184  }
1185 
1186  anyOp0(const anyOp0& rhs)
1187  {
1188  }
1189 
1190  virtual ~anyOp0()
1191  {
1192  }
1193 
1194  inline virtual R operator()() const = 0;
1195 
1196 };
1197 
1198 template<typename R, typename F>
1199 struct anyFunc0: public anyOp0<R>
1200 {
1201 
1202  typedef Fct0<R, F> ffunc_t;
1203  ffunc_t f;
1204 
1205  anyFunc0(const ffunc_t& _f)
1206  : f(_f)
1207  {
1208  }
1209 
1210  anyFunc0(const anyFunc0& rhs)
1211  : f(rhs.f)
1212  {
1213  }
1214 
1215  virtual ~anyFunc0()
1216  {
1217  }
1218 
1219  inline virtual R operator()() const
1220  {
1221  return f();
1222  }
1223 
1224 };
1225 
1226 template<typename R>
1227 struct DFct0
1228 {
1229 
1230  int* refCount;
1231  anyOp0<R>* op;
1232 
1233  template<typename F>
1234  DFct0(const Fct0<R, F>& f)
1235  {
1236  op = new anyFunc0<R, F>(f);
1237  refCount = new int(1);
1238  }
1239 
1240  DFct0(const DFct0& rhs)
1241  : refCount(rhs.refCount), op(rhs.op)
1242  {
1243  (*refCount)++;
1244  }
1245 
1246  ~DFct0()
1247  {
1248  if (--(*refCount) == 0) {
1249  delete refCount;
1250  delete op;
1251  }
1252  }
1253 
1254  DFct0<R> operator=(const DFct0<R>& rhs)
1255  {
1256  if (rhs.op == op) return *this;
1257 
1258  if (--(*refCount) == 0) {
1259  delete refCount;
1260  delete op;
1261  }
1262 
1263  op = rhs.op;
1264  refCount = rhs.refCount;
1265  (*refCount)++;
1266  return *this;
1267  }
1268 
1269  template<typename F>
1270  DFct0<R> operator=(const Fct0<R, F>& rhs)
1271  {
1272  if (rhs.op == op) return *this;
1273 
1274  if (--(*refCount) == 0) {
1275  delete refCount;
1276  delete op;
1277  }
1278 
1279  op = new anyFunc0<R, F>(rhs); // error: f was not declared; f = rhs?
1280  refCount = new int(1);
1281  (*refCount)++;
1282  return *this;
1283  }
1284 
1285  inline R operator()() const
1286  {
1287  return (*op)();
1288  }
1289 
1290 };
1291 
1292 template<typename A0, typename R>
1293 struct anyOp1
1294 {
1295 
1296  anyOp1()
1297  {
1298  }
1299 
1300  anyOp1(const anyOp1& rhs)
1301  {
1302  }
1303 
1304  virtual ~anyOp1()
1305  {
1306  }
1307 
1308  inline virtual R operator()(typename curryArgMode<A0>::Type_t a0) const = 0;
1309 
1310 };
1311 
1312 template<typename A0, typename R, typename F>
1313 struct anyFunc1: public anyOp1<A0, R>
1314 {
1315 
1316  typedef Fct1<A0, R, F> ffunc_t;
1317  ffunc_t f;
1318 
1319  anyFunc1(const ffunc_t& _f)
1320  : f(_f)
1321  {
1322  }
1323 
1324  anyFunc1(const anyFunc1& rhs)
1325  : f(rhs.f)
1326  {
1327  }
1328 
1329  virtual ~anyFunc1()
1330  {
1331  }
1332 
1333  inline virtual R operator()(typename curryArgMode<A0>::Type_t a0) const
1334  {
1335  return f(a0);
1336  }
1337 
1338 };
1339 
1340 template<typename A0, typename R>
1341 struct DFct1
1342 {
1343 
1344  int* refCount;
1345  anyOp1<A0, R>* op;
1346 
1347  template<typename F>
1348  DFct1(const Fct1<A0, R, F>& f)
1349  {
1350  op = new anyFunc1<A0, R, F>(f);
1351  refCount = new int(1);
1352  }
1353 
1354  DFct1(const DFct1& rhs)
1355  : refCount(rhs.refCount), op(rhs.op)
1356  {
1357  (*refCount)++;
1358  }
1359 
1360  ~DFct1()
1361  {
1362  if (--(*refCount) == 0) {
1363  delete refCount;
1364  delete op;
1365  }
1366  }
1367 
1368  DFct1<A0, R> operator=(const DFct1<A0, R>& rhs)
1369  {
1370  if (rhs.op == op) return *this;
1371 
1372  if (--(*refCount) == 0) {
1373  delete refCount;
1374  delete op;
1375  }
1376 
1377  op = rhs.op;
1378  refCount = rhs.refCount;
1379  (*refCount)++;
1380  return *this;
1381  }
1382 
1383  template<typename F>
1384  DFct1<A0, R> operator=(const Fct1<A0, R, F>& rhs)
1385  {
1386  if (rhs.op == op) return *this;
1387 
1388  if (--(*refCount) == 0) {
1389  delete refCount;
1390  delete op;
1391  }
1392 
1393  op = new anyFunc1<A0, R, F>(rhs); // f = rhs?
1394  refCount = new int(1);
1395  (*refCount)++;
1396  return *this;
1397  }
1398 
1399  inline R operator()(typename curryArgMode<A0>::Type_t a0) const
1400  {
1401  return (*op)(a0);
1402  }
1403 
1404 };
1405 template<typename A0, typename A1, typename R>
1406 struct anyOp2
1407 {
1408 
1409  anyOp2()
1410  {
1411  }
1412 
1413  anyOp2(const anyOp2& rhs)
1414  {
1415  }
1416 
1417  virtual ~anyOp2()
1418  {
1419  }
1420 
1421  inline virtual R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const = 0;
1422 
1423 };
1424 
1425 template<typename A0, typename A1, typename R, typename F>
1426 struct anyFunc2: public anyOp2<A0, A1, R>
1427 {
1428 
1429  typedef Fct2<A0, A1, R, F> ffunc_t;
1430  ffunc_t f;
1431 
1432  anyFunc2(const ffunc_t& _f)
1433  : f(_f)
1434  {
1435  }
1436 
1437  anyFunc2(const anyFunc2& rhs)
1438  : f(rhs.f)
1439  {
1440  }
1441 
1442  virtual ~anyFunc2()
1443  {
1444  }
1445 
1446  inline virtual R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const
1447  {
1448  return f(a0, a1);
1449  }
1450 
1451 };
1452 
1453 template<typename A0, typename A1, typename R>
1454 struct DFct2
1455 {
1456 
1457  int* refCount;
1458  anyOp2<A0, A1, R>* op;
1459 
1460  template<typename F>
1461  DFct2(const Fct2<A0, A1, R, F>& f)
1462  {
1463  op = new anyFunc2<A0, A1, R, F>(f);
1464  refCount = new int(1);
1465  }
1466 
1467  DFct2(const DFct2& rhs)
1468  : refCount(rhs.refCount), op(rhs.op)
1469  {
1470  (*refCount)++;
1471  }
1472 
1473  ~DFct2()
1474  {
1475  if (--(*refCount) == 0) {
1476  delete refCount;
1477  delete op;
1478  }
1479  }
1480 
1481  DFct2<A0, A1, R> operator=(const DFct2<A0, A1, R>& rhs)
1482  {
1483  if (rhs.op == op) return *this;
1484 
1485  if (--(*refCount) == 0) {
1486  delete refCount;
1487  delete op;
1488  }
1489 
1490  op = rhs.op;
1491  refCount = rhs.refCount;
1492  (*refCount)++;
1493  return *this;
1494  }
1495 
1496  template<typename F>
1497  DFct2<A0, A1, R> operator=(const Fct2<A0, A1, R, F>& rhs)
1498  {
1499  if (rhs.op == op) return *this;
1500 
1501  if (--(*refCount) == 0) {
1502  delete refCount;
1503  delete op;
1504  }
1505 
1506  op = new anyFunc2<A0, A1, R, F>(rhs); // f = rhs?
1507  refCount = new int(1);
1508  (*refCount)++;
1509  return *this;
1510  }
1511 
1512  inline R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const
1513  {
1514  return (*op)(a0, a1);
1515  }
1516 
1518  { // F applied to 1 arguments
1519 
1520  anyOp2<A0, A1, R> op;
1521  A0 pa0;
1522 
1523  // _op = op?
1524  PartialAppl1(const anyOp2<A0, A1, R>& _op, typename curryArgMode<A0>::Type_t _pa0)
1525  : op(_op), pa0(_pa0)
1526  {
1527  }
1528 
1529  PartialAppl1(const PartialAppl1& rhs)
1530  : op(rhs.op), pa0(rhs.pa0)
1531  {
1532  }
1533 
1534  inline R operator()(typename curryArgMode<A1>::Type_t a1) const
1535  {
1536  return (*op)(pa0, a1);
1537  }
1538 
1539  };
1540 
1542 
1543  inline ffunc1_t operator()(typename curryArgMode<A0>::Type_t a0) const
1544  {
1545  return ffunc1_t(PartialAppl1(*op, a0));
1546  }
1547 
1548 };
1549 
1550 template<typename A0, typename A1, typename A2, typename R>
1551 struct anyOp3
1552 {
1553 
1554  anyOp3()
1555  {
1556  }
1557 
1558  anyOp3(const anyOp3& rhs)
1559  {
1560  }
1561 
1562  virtual ~anyOp3()
1563  {
1564  }
1565 
1566  inline virtual R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
1567  typename curryArgMode<A2>::Type_t a2) const = 0;
1568 
1569 };
1570 
1571 template<typename A0, typename A1, typename A2, typename R, typename F>
1572 struct anyFunc3: public anyOp3<A0, A1, A2, R>
1573 {
1574 
1576  ffunc_t f;
1577 
1578  anyFunc3(const ffunc_t& _f)
1579  : f(_f)
1580  {
1581  }
1582 
1583  anyFunc3(const anyFunc3& rhs)
1584  : f(rhs.f)
1585  {
1586  }
1587 
1588  virtual ~anyFunc3()
1589  {
1590  }
1591 
1592  inline virtual R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
1593  typename curryArgMode<A2>::Type_t a2) const
1594  {
1595  return f(a0, a1, a2);
1596  }
1597 
1598 };
1599 
1600 template<typename A0, typename A1, typename A2, typename R>
1601 struct DFct3
1602 {
1603 
1604  int* refCount;
1606 
1607  template<typename F>
1608  DFct3(const Fct3<A0, A1, A2, R, F>& f)
1609  {
1610  op = new anyFunc3<A0, A1, A2, R, F>(f);
1611  refCount = new int(1);
1612  }
1613 
1614  DFct3(const DFct3& rhs)
1615  : refCount(rhs.refCount), op(rhs.op)
1616  {
1617  (*refCount)++;
1618  }
1619 
1620  ~DFct3()
1621  {
1622  if (--(*refCount) == 0) {
1623  delete refCount;
1624  delete op;
1625  }
1626  }
1627 
1628  DFct3<A0, A1, A2, R> operator=(const DFct3<A0, A1, A2, R>& rhs)
1629  {
1630  if (rhs.op == op) return *this;
1631 
1632  if (--(*refCount) == 0) {
1633  delete refCount;
1634  delete op;
1635  }
1636 
1637  op = rhs.op;
1638  refCount = rhs.refCount;
1639  (*refCount)++;
1640  return *this;
1641  }
1642 
1643  template<typename F>
1644  DFct3<A0, A1, A2, R> operator=(const Fct3<A0, A1, A2, R, F>& rhs)
1645  {
1646  if (rhs.op == op) return *this;
1647 
1648  if (--(*refCount) == 0) {
1649  delete refCount;
1650  delete op;
1651  }
1652 
1653  op = new anyFunc3<A0, A1, A2, R, F>(rhs); // f = rhs?
1654  refCount = new int(1);
1655  (*refCount)++;
1656  return *this;
1657  }
1658 
1659  inline R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
1660  typename curryArgMode<A2>::Type_t a2) const
1661  {
1662  return (*op)(a0, a1, a2);
1663  }
1664 
1665  // F applied to 1 arguments
1667  {
1668 
1670  A0 pa0;
1671 
1672  // op = _op?
1673  PartialAppl1(const anyOp3<A0, A1, A2, R>& _op, typename curryArgMode<A0>::Type_t _pa0)
1674  : op(_op), pa0(_pa0)
1675  {
1676  }
1677 
1678  PartialAppl1(const PartialAppl1& rhs)
1679  : op(rhs.op), pa0(rhs.pa0)
1680  {
1681  }
1682 
1683  inline R operator()(typename curryArgMode<A1>::Type_t a1, typename curryArgMode<A2>::Type_t a2) const
1684  {
1685  return (*op)(pa0, a1, a2);
1686  }
1687 
1688  };
1689 
1691 
1692  inline ffunc1_t operator()(typename curryArgMode<A0>::Type_t a0) const
1693  {
1694  return ffunc1_t(PartialAppl1(*op, a0));
1695  }
1696 
1697  // F applied to 2 arguments
1699  {
1700 
1702  A0 pa0;
1703  A1 pa1;
1704 
1705  // op = _op?
1706  PartialAppl2(const anyOp3<A0, A1, A2, R>& _op, typename curryArgMode<A0>::Type_t _pa0,
1707  typename curryArgMode<A1>::Type_t _pa1)
1708  : op(_op), pa0(_pa0), pa1(_pa1)
1709  {
1710  }
1711 
1712  PartialAppl2(const PartialAppl2& rhs)
1713  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1)
1714  {
1715  }
1716 
1717  inline R operator()(typename curryArgMode<A2>::Type_t a2) const
1718  {
1719  return (*op)(pa0, pa1, a2);
1720  }
1721  };
1722 
1724 
1725  inline ffunc2_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const
1726  {
1727  return ffunc2_t(PartialAppl2(*op, a0, a1));
1728  }
1729 
1730 };
1731 
1732 template<typename A0, typename A1, typename A2, typename A3, typename R>
1733 struct anyOp4
1734 {
1735 
1736  anyOp4()
1737  {
1738  }
1739 
1740  anyOp4(const anyOp4& rhs)
1741  {
1742  }
1743 
1744  virtual ~anyOp4()
1745  {
1746  }
1747 
1748  inline virtual R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
1749  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3) const = 0;
1750 
1751 };
1752 
1753 template<typename A0, typename A1, typename A2, typename A3, typename R, typename F>
1754 struct anyFunc4: public anyOp4<A0, A1, A2, A3, R>
1755 {
1756 
1758  ffunc_t f;
1759 
1760  anyFunc4(const ffunc_t& _f)
1761  : f(_f)
1762  {
1763  }
1764 
1765  anyFunc4(const anyFunc4& rhs)
1766  : f(rhs.f)
1767  {
1768  }
1769 
1770  virtual ~anyFunc4()
1771  {
1772  }
1773 
1774  inline virtual R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
1775  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3) const
1776  {
1777  return f(a0, a1, a2, a3);
1778  }
1779 
1780 };
1781 
1782 template<typename A0, typename A1, typename A2, typename A3, typename R>
1783 struct DFct4
1784 {
1785 
1786  int* refCount;
1788 
1789  template<typename F>
1791  {
1792  op = new anyFunc4<A0, A1, A2, A3, R, F>(f);
1793  refCount = new int(1);
1794  }
1795 
1796  DFct4(const DFct4& rhs)
1797  : refCount(rhs.refCount), op(rhs.op)
1798  {
1799  (*refCount)++;
1800  }
1801 
1802  ~DFct4()
1803  {
1804  if (--(*refCount) == 0) {
1805  delete refCount;
1806  delete op;
1807  }
1808  }
1809 
1811  {
1812  if (rhs.op == op) return *this;
1813 
1814  if (--(*refCount) == 0) {
1815  delete refCount;
1816  delete op;
1817  }
1818 
1819  op = rhs.op;
1820  refCount = rhs.refCount;
1821  (*refCount)++;
1822  return *this;
1823  }
1824 
1825  template<typename F>
1827  {
1828  if (rhs.op == op) return *this;
1829 
1830  if (--(*refCount) == 0) {
1831  delete refCount;
1832  delete op;
1833  }
1834 
1835  op = new anyFunc4<A0, A1, A2, A3, R, F>(rhs); // f = rhs?
1836  refCount = new int(1);
1837  (*refCount)++;
1838  return *this;
1839  }
1840 
1841  inline R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
1842  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3) const
1843  {
1844  return (*op)(a0, a1, a2, a3);
1845  }
1846 
1847  // F applied to 1 arguments
1849  {
1850 
1852  A0 pa0;
1853 
1854  // op = _op?
1855  PartialAppl1(const anyOp4<A0, A1, A2, A3, R>& _op, typename curryArgMode<A0>::Type_t _pa0)
1856  : op(_op), pa0(_pa0)
1857  {
1858  }
1859 
1860  PartialAppl1(const PartialAppl1& rhs)
1861  : op(rhs.op), pa0(rhs.pa0)
1862  {
1863  }
1864 
1865  inline R operator()(typename curryArgMode<A1>::Type_t a1, typename curryArgMode<A2>::Type_t a2,
1866  typename curryArgMode<A3>::Type_t a3) const
1867  {
1868  return (*op)(pa0, a1, a2, a3);
1869  }
1870 
1871  };
1872 
1874 
1875  inline ffunc1_t operator()(typename curryArgMode<A0>::Type_t a0) const
1876  {
1877  return ffunc1_t(PartialAppl1(*op, a0));
1878  }
1879 
1881  { // F applied to 2 arguments
1882 
1884  A0 pa0;
1885  A1 pa1;
1886 
1887  // op = _op?
1888  PartialAppl2(const anyOp4<A0, A1, A2, A3, R>& _op, typename curryArgMode<A0>::Type_t _pa0,
1889  typename curryArgMode<A1>::Type_t _pa1)
1890  : op(_op), pa0(_pa0), pa1(_pa1)
1891  {
1892  }
1893 
1894  PartialAppl2(const PartialAppl2& rhs)
1895  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1)
1896  {
1897  }
1898 
1899  inline R operator()(typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3) const
1900  {
1901  return (*op)(pa0, pa1, a2, a3);
1902  }
1903 
1904  };
1905 
1907 
1908  inline ffunc2_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const
1909  {
1910  return ffunc2_t(PartialAppl2(*op, a0, a1));
1911  }
1912 
1913  // F applied to 3 arguments
1915  {
1916 
1918  A0 pa0;
1919  A1 pa1;
1920  A2 pa2;
1921 
1922  // op = _op?
1923  PartialAppl3(const anyOp4<A0, A1, A2, A3, R>& _op, typename curryArgMode<A0>::Type_t _pa0,
1924  typename curryArgMode<A1>::Type_t _pa1, typename curryArgMode<A2>::Type_t _pa2)
1925  : op(_op), pa0(_pa0), pa1(_pa1), pa2(_pa2)
1926  {
1927  }
1928 
1929  PartialAppl3(const PartialAppl3& rhs)
1930  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2)
1931  {
1932  }
1933 
1934  inline R operator()(typename curryArgMode<A3>::Type_t a3) const
1935  {
1936  return (*op)(pa0, pa1, pa2, a3);
1937  }
1938 
1939  };
1940 
1942 
1943  inline ffunc3_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
1944  typename curryArgMode<A2>::Type_t a2) const
1945  {
1946  return ffunc3_t(PartialAppl3(*op, a0, a1, a2));
1947  }
1948 
1949 };
1950 
1951 template<typename A0, typename A1, typename A2, typename A3, typename A4, typename R>
1952 struct anyOp5
1953 {
1954 
1955  anyOp5()
1956  {
1957  }
1958 
1959  anyOp5(const anyOp5& rhs)
1960  {
1961  }
1962 
1963  virtual ~anyOp5()
1964  {
1965  }
1966 
1967  inline virtual R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
1968  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
1969  typename curryArgMode<A4>::Type_t a4) const = 0;
1970 
1971 };
1972 
1973 template<typename A0, typename A1, typename A2, typename A3, typename A4, typename R, typename F>
1974 struct anyFunc5: public anyOp5<A0, A1, A2, A3, A4, R>
1975 {
1976 
1978 
1979  ffunc_t f;
1980 
1981  anyFunc5(const ffunc_t& _f)
1982  : f(_f)
1983  {
1984  }
1985 
1986  anyFunc5(const anyFunc5& rhs)
1987  : f(rhs.f)
1988  {
1989  }
1990 
1991  virtual ~anyFunc5()
1992  {
1993  }
1994 
1995  inline virtual R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
1996  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
1997  typename curryArgMode<A4>::Type_t a4) const
1998  {
1999  return f(a0, a1, a2, a3, a4);
2000  }
2001 
2002 };
2003 
2004 template<typename A0, typename A1, typename A2, typename A3, typename A4, typename R>
2005 struct DFct5
2006 {
2007 
2008  int* refCount;
2010 
2011  template<typename F>
2013  {
2015  refCount = new int(1);
2016  }
2017 
2018  DFct5(const DFct5& rhs)
2019  : refCount(rhs.refCount), op(rhs.op)
2020  {
2021  (*refCount)++;
2022  }
2023 
2024  ~DFct5()
2025  {
2026  if (--(*refCount) == 0) {
2027  delete refCount;
2028  delete op;
2029  }
2030  }
2032  {
2033  if (rhs.op == op) return *this;
2034 
2035  if (--(*refCount) == 0) {
2036  delete refCount;
2037  delete op;
2038  }
2039 
2040  op = rhs.op;
2041  refCount = rhs.refCount;
2042  (*refCount)++;
2043  return *this;
2044  }
2045 
2046  template<typename F>
2048  {
2049  if (rhs.op == op) return *this;
2050 
2051  if (--(*refCount) == 0) {
2052  delete refCount;
2053  delete op;
2054  }
2055 
2056  op = new anyFunc5<A0, A1, A2, A3, A4, R, F>(rhs); // f = rhs?
2057  refCount = new int(1);
2058  (*refCount)++;
2059  return *this;
2060  }
2061 
2062  inline R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
2063  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
2064  typename curryArgMode<A4>::Type_t a4) const
2065  {
2066  return (*op)(a0, a1, a2, a3, a4);
2067  }
2068 
2069  // F applied to 1 arguments
2071  {
2072 
2074  A0 pa0;
2075 
2076  // op = _op?
2077  PartialAppl1(const anyOp5<A0, A1, A2, A3, A4, R>& _op, typename curryArgMode<A0>::Type_t _pa0)
2078  : op(_op), pa0(_pa0)
2079  {
2080  }
2081 
2082  PartialAppl1(const PartialAppl1& rhs)
2083  : op(rhs.op), pa0(rhs.pa0)
2084  {
2085  }
2086 
2087  inline R operator()(typename curryArgMode<A1>::Type_t a1, typename curryArgMode<A2>::Type_t a2,
2088  typename curryArgMode<A3>::Type_t a3, typename curryArgMode<A4>::Type_t a4) const
2089  {
2090  return (*op)(pa0, a1, a2, a3, a4);
2091  }
2092 
2093  };
2094 
2096 
2097  inline ffunc1_t operator()(typename curryArgMode<A0>::Type_t a0) const
2098  {
2099  return ffunc1_t(PartialAppl1(*op, a0));
2100  }
2101 
2102  // F applied to 2 arguments
2104  {
2105 
2107  A0 pa0;
2108  A1 pa1;
2109 
2110  // op = _op?
2111  PartialAppl2(const anyOp5<A0, A1, A2, A3, A4, R>& _op, typename curryArgMode<A0>::Type_t _pa0,
2112  typename curryArgMode<A1>::Type_t _pa1)
2113  : op(_op), pa0(_pa0), pa1(_pa1)
2114  {
2115  }
2116 
2117  PartialAppl2(const PartialAppl2& rhs)
2118  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1)
2119  {
2120  }
2121 
2122  inline R operator()(typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
2123  typename curryArgMode<A4>::Type_t a4) const
2124  {
2125  return (*op)(pa0, pa1, a2, a3, a4);
2126  }
2127 
2128  };
2129 
2131 
2132  inline ffunc2_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const
2133  {
2134  return ffunc2_t(PartialAppl2(*op, a0, a1));
2135  }
2136 
2137  // F applied to 3 arguments
2139  {
2140 
2142  A0 pa0;
2143  A1 pa1;
2144  A2 pa2;
2145 
2146  // op = _op?
2147  PartialAppl3(const anyOp5<A0, A1, A2, A3, A4, R>& _op, typename curryArgMode<A0>::Type_t _pa0,
2148  typename curryArgMode<A1>::Type_t _pa1, typename curryArgMode<A2>::Type_t _pa2)
2149  : op(_op), pa0(_pa0), pa1(_pa1), pa2(_pa2)
2150  {
2151  }
2152 
2153  PartialAppl3(const PartialAppl3& rhs)
2154  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2)
2155  {
2156  }
2157 
2158  inline R operator()(typename curryArgMode<A3>::Type_t a3, typename curryArgMode<A4>::Type_t a4) const
2159  {
2160  return (*op)(pa0, pa1, pa2, a3, a4);
2161  }
2162 
2163  };
2164 
2166 
2167  inline ffunc3_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
2168  typename curryArgMode<A2>::Type_t a2) const
2169  {
2170  return ffunc3_t(PartialAppl3(*op, a0, a1, a2));
2171  }
2172 
2173  // F applied to 4 arguments
2175  {
2176 
2178  A0 pa0;
2179  A1 pa1;
2180  A2 pa2;
2181  A3 pa3;
2182 
2183  // op = _op?
2184  PartialAppl4(const anyOp5<A0, A1, A2, A3, A4, R>& _op, typename curryArgMode<A0>::Type_t _pa0,
2185  typename curryArgMode<A1>::Type_t _pa1, typename curryArgMode<A2>::Type_t _pa2,
2186  typename curryArgMode<A3>::Type_t _pa3)
2187  : op(_op), pa0(_pa0), pa1(_pa1), pa2(_pa2), pa3(_pa3)
2188  {
2189  }
2190 
2191  PartialAppl4(const PartialAppl4& rhs)
2192  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2), pa3(rhs.pa3)
2193  {
2194  }
2195 
2196  inline R operator()(typename curryArgMode<A4>::Type_t a4) const
2197  {
2198  return (*op)(pa0, pa1, pa2, pa3, a4);
2199  }
2200  };
2201 
2203 
2204  inline ffunc4_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
2205  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3) const
2206  {
2207  return ffunc4_t(PartialAppl4(*op, a0, a1, a2, a3));
2208  }
2209 
2210 };
2211 
2212 template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename R>
2213 struct anyOp6
2214 {
2215 
2216  anyOp6()
2217  {
2218  }
2219 
2220  anyOp6(const anyOp6& rhs)
2221  {
2222  }
2223 
2224  virtual ~anyOp6()
2225  {
2226  }
2227 
2228  inline virtual R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
2229  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
2230  typename curryArgMode<A4>::Type_t a4, typename curryArgMode<A5>::Type_t a5) const = 0;
2231 
2232 };
2233 
2234 template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename R, typename F>
2235 struct anyFunc6: public anyOp6<A0, A1, A2, A3, A4, A5, R>
2236 {
2237 
2239  ffunc_t f;
2240 
2241  anyFunc6(const ffunc_t& _f)
2242  : f(_f)
2243  {
2244  }
2245 
2246  anyFunc6(const anyFunc6& rhs)
2247  : f(rhs.f)
2248  {
2249  }
2250 
2251  virtual ~anyFunc6()
2252  {
2253  }
2254 
2255  inline virtual R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
2256  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
2257  typename curryArgMode<A4>::Type_t a4, typename curryArgMode<A5>::Type_t a5) const
2258  {
2259  return f(a0, a1, a2, a3, a4, a5);
2260  }
2261 
2262 };
2263 
2264 template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename R>
2265 struct DFct6
2266 {
2267 
2268  int* refCount;
2270 
2271  template<typename F>
2273  {
2275  refCount = new int(1);
2276  }
2277 
2278  DFct6(const DFct6& rhs)
2279  : refCount(rhs.refCount), op(rhs.op)
2280  {
2281  (*refCount)++;
2282  }
2283 
2284  ~DFct6()
2285  {
2286  if (--(*refCount) == 0) {
2287  delete refCount;
2288  delete op;
2289  }
2290  }
2291 
2293  {
2294  if (rhs.op == op) return *this;
2295 
2296  if (--(*refCount) == 0) {
2297  delete refCount;
2298  delete op;
2299  }
2300 
2301  op = rhs.op;
2302  refCount = rhs.refCount;
2303  (*refCount)++;
2304  return *this;
2305  }
2306 
2307  template<typename F>
2309  {
2310  if (rhs.op == op) return *this;
2311 
2312  if (--(*refCount) == 0) {
2313  delete refCount;
2314  delete op;
2315  }
2316 
2317  op = new anyFunc6<A0, A1, A2, A3, A4, A5, R, F>(rhs); // f = rhs?
2318  refCount = new int(1);
2319  (*refCount)++;
2320  return *this;
2321  }
2322 
2323  inline R operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
2324  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
2325  typename curryArgMode<A4>::Type_t a4, typename curryArgMode<A5>::Type_t a5) const
2326  {
2327  return (*op)(a0, a1, a2, a3, a4, a5);
2328  }
2329 
2330  // F applied to 1 arguments
2332  {
2333 
2335  A0 pa0;
2336 
2337  // op = _op?
2338  PartialAppl1(const anyOp6<A0, A1, A2, A3, A4, A5, R>& _op, typename curryArgMode<A0>::Type_t _pa0)
2339  : op(_op), pa0(_pa0)
2340  {
2341  }
2342 
2343  PartialAppl1(const PartialAppl1& rhs)
2344  : op(rhs.op), pa0(rhs.pa0)
2345  {
2346  }
2347 
2348  inline R operator()(typename curryArgMode<A1>::Type_t a1, typename curryArgMode<A2>::Type_t a2,
2349  typename curryArgMode<A3>::Type_t a3, typename curryArgMode<A4>::Type_t a4,
2350  typename curryArgMode<A5>::Type_t a5) const
2351  {
2352  return (*op)(pa0, a1, a2, a3, a4, a5);
2353  }
2354 
2355  };
2356 
2358 
2359  inline ffunc1_t operator()(typename curryArgMode<A0>::Type_t a0) const
2360  {
2361  return ffunc1_t(PartialAppl1(*op, a0));
2362  }
2363 
2364  // F applied to 2 arguments
2366  {
2367 
2369  A0 pa0;
2370  A1 pa1;
2371 
2372  // op = _op?
2373  PartialAppl2(const anyOp6<A0, A1, A2, A3, A4, A5, R>& _op, typename curryArgMode<A0>::Type_t _pa0,
2374  typename curryArgMode<A1>::Type_t _pa1)
2375  : op(_op), pa0(_pa0), pa1(_pa1)
2376  {
2377  }
2378 
2379  PartialAppl2(const PartialAppl2& rhs)
2380  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1)
2381  {
2382  }
2383 
2384  inline R operator()(typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
2385  typename curryArgMode<A4>::Type_t a4, typename curryArgMode<A5>::Type_t a5) const
2386  {
2387  return (*op)(pa0, pa1, a2, a3, a4, a5);
2388  }
2389 
2390  };
2391 
2393 
2394  inline ffunc2_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1) const
2395  {
2396  return ffunc2_t(PartialAppl2(*op, a0, a1));
2397  }
2398 
2399  // F applied to 3 arguments
2401  {
2402 
2404  A0 pa0;
2405  A1 pa1;
2406  A2 pa2;
2407 
2408  // op = _op?
2409  PartialAppl3(const anyOp6<A0, A1, A2, A3, A4, A5, R>& _op, typename curryArgMode<A0>::Type_t _pa0,
2410  typename curryArgMode<A1>::Type_t _pa1, typename curryArgMode<A2>::Type_t _pa2)
2411  : op(_op), pa0(_pa0), pa1(_pa1), pa2(_pa2)
2412  {
2413  }
2414 
2415  PartialAppl3(const PartialAppl3& rhs)
2416  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2)
2417  {
2418  }
2419 
2420  inline R operator()(typename curryArgMode<A3>::Type_t a3, typename curryArgMode<A4>::Type_t a4,
2421  typename curryArgMode<A5>::Type_t a5) const
2422  {
2423  return (*op)(pa0, pa1, pa2, a3, a4, a5);
2424  }
2425 
2426  };
2427 
2429 
2430  inline ffunc3_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
2431  typename curryArgMode<A2>::Type_t a2) const
2432  {
2433  return ffunc3_t(PartialAppl3(*op, a0, a1, a2));
2434  }
2435 
2436  // F applied to 4 arguments
2438  {
2439 
2441  A0 pa0;
2442  A1 pa1;
2443  A2 pa2;
2444  A3 pa3;
2445 
2446  // op = _op?
2447  PartialAppl4(const anyOp6<A0, A1, A2, A3, A4, A5, R>& _op, typename curryArgMode<A0>::Type_t _pa0,
2448  typename curryArgMode<A1>::Type_t _pa1, typename curryArgMode<A2>::Type_t _pa2,
2449  typename curryArgMode<A3>::Type_t _pa3)
2450  : op(_op), pa0(_pa0), pa1(_pa1), pa2(_pa2), pa3(_pa3)
2451  {
2452  }
2453 
2454  PartialAppl4(const PartialAppl4& rhs)
2455  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2), pa3(rhs.pa3)
2456  {
2457  }
2458 
2459  inline R operator()(typename curryArgMode<A4>::Type_t a4, typename curryArgMode<A5>::Type_t a5) const
2460  {
2461  return (*op)(pa0, pa1, pa2, pa3, a4, a5);
2462  }
2463 
2464  };
2465 
2467 
2468  inline ffunc4_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
2469  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3) const
2470  {
2471  return ffunc4_t(PartialAppl4(*op, a0, a1, a2, a3));
2472  }
2473 
2474  // F applied to 5 arguments
2476  {
2477 
2479  A0 pa0;
2480  A1 pa1;
2481  A2 pa2;
2482  A3 pa3;
2483  A4 pa4;
2484 
2485  // op = _op?
2486  PartialAppl5(const anyOp6<A0, A1, A2, A3, A4, A5, R>& _op, typename curryArgMode<A0>::Type_t _pa0,
2487  typename curryArgMode<A1>::Type_t _pa1, typename curryArgMode<A2>::Type_t _pa2,
2488  typename curryArgMode<A3>::Type_t _pa3, typename curryArgMode<A4>::Type_t _pa4)
2489  : op(_op), pa0(_pa0), pa1(_pa1), pa2(_pa2), pa3(_pa3), pa4(_pa4)
2490  {
2491  }
2492 
2493  PartialAppl5(const PartialAppl5& rhs)
2494  : op(rhs.op), pa0(rhs.pa0), pa1(rhs.pa1), pa2(rhs.pa2), pa3(rhs.pa3), pa4(rhs.pa4)
2495  {
2496  }
2497 
2498  inline R operator()(typename curryArgMode<A5>::Type_t a5) const
2499  {
2500  return (*op)(pa0, pa1, pa2, pa3, pa4, a5);
2501  }
2502  };
2503 
2505 
2506  inline ffunc5_t operator()(typename curryArgMode<A0>::Type_t a0, typename curryArgMode<A1>::Type_t a1,
2507  typename curryArgMode<A2>::Type_t a2, typename curryArgMode<A3>::Type_t a3,
2508  typename curryArgMode<A4>::Type_t a4) const
2509  {
2510  return ffunc5_t(PartialAppl5(*op, a0, a1, a2, a3, a4));
2511  }
2512 
2513 };
2514 
2515 }
2516 
Definition: curry.h:1952
Definition: curry.h:129
Definition: curry.h:869
Definition: curry.h:2174
Definition: curry.h:192
Definition: curry.h:652
Definition: curry.h:1227
Definition: curry.h:1313
Definition: curry.h:1179
Definition: curry.h:1517
Definition: curry.h:772
Definition: curry.h:2070
Definition: curry.h:920
Definition: curry.h:1601
Definition: curry.h:1754
Definition: curry.h:475
Definition: curry.h:1698
Definition: curry.h:292
Definition: curry.h:2213
Definition: curry.h:1055
Definition: curry.h:1914
Definition: curry.h:269
Definition: curry.h:401
Definition: curry.h:1199
Definition: curry.h:803
Definition: curry.h:2103
Definition: curry.h:378
Definition: curry.h:590
Definition: curry.h:1572
Definition: curry.h:2400
Definition: curry.h:39
Definition: curry.h:725
Definition: curry.h:1551
Definition: curry.h:1090
Definition: curry.h:2265
Definition: curry.h:991
Definition: curry.h:1848
Definition: curry.h:524
Definition: curry.h:215
Definition: curry.h:621
Definition: curry.h:943
Definition: curry.h:1454
Definition: curry.h:2437
Definition: curry.h:1406
Definition: curry.h:547
Definition: curry.h:1733
Definition: curry.h:1293
Definition: curry.h:1125
Definition: curry.h:140
Definition: curry.h:2005
Definition: curry.h:2235
Definition: curry.h:2331
Definition: curry.h:1023
Definition: curry.h:1880
Definition: curry.h:835
Definition: curry.h:2138
Definition: curry.h:1341
Definition: curry.h:1426
Definition: curry.h:2475
Definition: curry.h:331
Definition: curry.h:702
Definition: curry.h:1783
Definition: curry.h:1974
Definition: curry.h:2365
Definition: curry.h:444
Definition: curry.h:1666