libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
functional.hpp
Go to the documentation of this file.
1 #ifndef LIBJMMCG_CORE_FUNCTIONAL_HPP
2 #define LIBJMMCG_CORE_FUNCTIONAL_HPP
3 
4 // TITLE:
5 //
6 // AUTHOR:
7 // Created by J.M.McGuiness, E-mail: coder@hussar.me.uk
8 //
9 // DESCRIPTION:
10 // If these adaptor classes look similar to the STL variants, you'd be right.
11 // They are. But I need adaptors for functions with more than just 1 argument.
12 //
13 // LEGALITIES:
14 // Copyright © 2004 by J.M.McGuiness, all rights reserved.
15 //
16 // This library is free software; you can redistribute it and/or
17 // modify it under the terms of the GNU Lesser General Public
18 // License as published by the Free Software Foundation; either
19 // version 2.1 of the License, or (at your option) any later version.
20 //
21 // This library is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 // Lesser General Public License for more details.
25 //
26 // You should have received a copy of the GNU Lesser General Public
27 // License along with this library; if not, write to the Free Software
28 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 //
30 /////////////////////////////////////////////////////////////////////////////
31 
32 #include "config.h"
33 
34 #include <cassert>
35 
36 namespace jmmcg { namespace LIBJMMCG_VER_NAMESPACE {
37 
38 /*
39 
40  Member function functors.
41 
42 */
43 
44  template<typename RetType,typename ObjType>
46  public:
47  typedef typename ObjType object_type;
48  typedef typename RetType result_type;
49  typedef RetType (__fastcall ObjType::*fun_type)(void) const;
50 
51  explicit __stdcall const_mem_fun_ref_t(const fun_type p) noexcept(true)
52  : pmf(p) {
53  assert(pmf);
54  }
55  __stdcall const_mem_fun_ref_t(const const_mem_fun_ref_t &p) noexcept(true)
56  : pmf(p.pmf) {
57  assert(pmf);
58  }
59  __stdcall ~const_mem_fun_ref_t(void) noexcept(true) {
60  }
61 
62  RetType __fastcall operator()(const ObjType &p) const {
63  return (p.*pmf)();
64  }
65  RetType __fastcall operator()(ObjType &p) const {
66  return (p.*pmf)();
67  }
68 
69  private:
70  const fun_type pmf;
71  };
72 
73  template<typename RetType,typename ObjType,typename Arg1>
75  public:
76  typedef typename ObjType object_type;
77  typedef typename RetType result_type;
78  typedef typename Arg1 first_argument_type;
79  typedef RetType (__fastcall ObjType::*fun_type)(const Arg1 &) const;
80 
81  explicit __stdcall const_mem_fun1_ref_t(const fun_type p) noexcept(true)
82  : pmf(p) {
83  assert(pmf);
84  }
85  __stdcall const_mem_fun1_ref_t(const const_mem_fun1_ref_t &p) noexcept(true)
86  : pmf(p.pmf) {
87  assert(pmf);
88  }
89  __stdcall ~const_mem_fun1_ref_t(void) noexcept(true) {
90  }
91 
92  RetType __fastcall operator()(const ObjType &p,const Arg1 &b) const {
93  return (p.*pmf)(b);
94  }
95  RetType __fastcall operator()(ObjType &p,const Arg1 &b) const {
96  return (p.*pmf)(b);
97  }
98 
99  private:
100  const fun_type pmf;
101  };
102 
103  template<typename RetType,typename ObjType,typename Arg1,typename Arg2>
105  public:
106  typedef typename ObjType object_type;
107  typedef typename RetType result_type;
108  typedef typename Arg1 first_argument_type;
109  typedef typename Arg2 second_argument_type;
110  typedef RetType (__fastcall ObjType::*fun_type)(const Arg1 &,const Arg2 &) const;
111 
112  explicit __stdcall const_mem_fun2_ref_t(const fun_type p) noexcept(true)
113  : pmf(p) {
114  assert(pmf);
115  }
116  __stdcall const_mem_fun2_ref_t(const const_mem_fun2_ref_t &p) noexcept(true)
117  : pmf(p.pmf) {
118  assert(pmf);
119  }
120  __stdcall ~const_mem_fun2_ref_t(void) noexcept(true) {
121  }
122 
123  RetType __fastcall operator()(const ObjType &p,const Arg1 &b,const Arg2 &c) const {
124  return (p.*pmf)(b,c);
125  }
126  RetType __fastcall operator()(ObjType &p,const Arg1 &b,const Arg2 &c) const {
127  return (p.*pmf)(b,c);
128  }
129 
130  private:
131  const fun_type pmf;
132  };
133 
134  template<typename RetType,typename ObjType>
136  public:
137  typedef typename ObjType object_type;
138  typedef typename RetType result_type;
139  typedef RetType (__fastcall ObjType::*fun_type)(void);
140 
141  explicit __stdcall mem_fun_ref_t(const fun_type p) noexcept(true)
142  : pmf(p) {
143  assert(pmf);
144  }
145  __stdcall mem_fun_ref_t(const mem_fun_ref_t &p) noexcept(true)
146  : pmf(p.pmf) {
147  assert(pmf);
148  }
149  __stdcall ~mem_fun_ref_t(void) noexcept(true) {
150  }
151 
152  RetType __fastcall operator()(void) const {
153  return (obj.*pmf)();
154  }
155  RetType __fastcall operator()(void) {
156  return (obj.*pmf)();
157  }
158 
159  private:
160  const fun_type pmf;
161  ObjType obj;
162  };
163 
164  template<typename RetType,typename ObjType,typename Arg1>
166  public:
167  typedef typename ObjType object_type;
168  typedef typename RetType result_type;
169  typedef typename Arg1 first_argument_type;
170  typedef RetType (__fastcall ObjType::*fun_type)(const Arg1 &);
171 
172  explicit __stdcall mem_fun1_ref_t(const fun_type p) noexcept(true)
173  : pmf(p) {
174  assert(pmf);
175  }
176  __stdcall mem_fun1_ref_t(const mem_fun1_ref_t &p) noexcept(true)
177  : pmf(p.pmf) {
178  assert(pmf);
179  }
180  __stdcall ~mem_fun1_ref_t(void) noexcept(true) {
181  }
182 
183  RetType __fastcall operator()(const Arg1 &a) const {
184  return (obj.*pmf)(a);
185  }
186  RetType __fastcall operator()(const Arg1 &a) {
187  return (obj.*pmf)(a);
188  }
189 
190  private:
191  const fun_type pmf;
192  ObjType obj;
193  };
194 /* TODO JMG: not apparently needed....?
195  template<typename RetType,typename ObjType,typename Arg1,typename Arg2>
196  class mem_fun2_ref_t {
197  public:
198  typedef typename ObjType object_type;
199  typedef typename RetType result_type;
200  typedef typename Arg1 first_argument_type;
201  typedef typename Arg2 second_argument_type;
202  typedef RetType (__fastcall ObjType::*fun_type)(const Arg1 &,const Arg2 &);
203 
204  explicit __stdcall mem_fun2_ref_t(const fun_type p) noexcept(true)
205  : pmf(p) {
206  assert(pmf);
207  }
208  __stdcall mem_fun2_ref_t(const mem_fun2_ref_t &p) noexcept(true)
209  : pmf(p.pmf) {
210  assert(pmf);
211  }
212  __stdcall ~mem_fun2_ref_t(void) noexcept(true) {
213  }
214  void operator=(const mem_fun2_ref_t &)=delete;
215 
216  RetType __fastcall operator()(const Arg1 &a,const Arg2 &b) const {
217  return (obj.*pmf)(a,b);
218  }
219  RetType __fastcall operator()(const Arg1 &a,const Arg2 &b) {
220  return (obj.*pmf)(a,b);
221  }
222 
223  private:
224  const fun_type pmf;
225  ObjType obj;
226  };
227 
228  template<typename RetType,typename ObjType,typename Arg1,typename Arg2,typename Arg3>
229  class mem_fun3_ref_t {
230  public:
231  typedef typename ObjType object_type;
232  typedef typename RetType result_type;
233  typedef typename Arg1 first_argument_type;
234  typedef typename Arg2 second_argument_type;
235  typedef typename Arg3 third_argument_type;
236  typedef RetType (__fastcall ObjType::*fun_type)(const Arg1 &,const Arg2 &,const Arg3 &);
237 
238  explicit __stdcall mem_fun3_ref_t(const fun_type p) noexcept(true)
239  : pmf(p) {
240  assert(pmf);
241  }
242  __stdcall mem_fun3_ref_t(const mem_fun3_ref_t &p) noexcept(true)
243  : pmf(p.pmf) {
244  assert(pmf);
245  }
246  __stdcall ~mem_fun3_ref_t(void) noexcept(true) {
247  }
248  void operator=(const mem_fun3_ref_t &)=delete;
249 
250  RetType __fastcall operator()(const Arg1 &a,const Arg2 &b,const Arg3 &c) const {
251  return (obj.*pmf)(a,b,c);
252  }
253  RetType __fastcall operator()(const Arg1 &a,const Arg2 &b,const Arg3 &c) {
254  return (obj.*pmf)(a,b,c);
255  }
256 
257  private:
258  const fun_type pmf;
259  ObjType obj;
260  };
261 
262  template<typename RetType,typename ObjType,typename Arg1,typename Arg2,typename Arg3,typename Arg4>
263  class mem_fun4_ref_t {
264  public:
265  typedef typename ObjType object_type;
266  typedef typename RetType result_type;
267  typedef typename Arg1 first_argument_type;
268  typedef typename Arg2 second_argument_type;
269  typedef typename Arg3 third_argument_type;
270  typedef typename Arg4 fourth_argument_type;
271  typedef RetType (__fastcall ObjType::*fun_type)(const Arg1 &,const Arg2 &,const Arg3 &,const Arg4 &);
272 
273  explicit __stdcall mem_fun4_ref_t(const fun_type p) noexcept(true)
274  : pmf(p) {
275  assert(pmf);
276  }
277  __stdcall mem_fun4_ref_t(const mem_fun4_ref_t &p) noexcept(true)
278  : pmf(p.pmf) {
279  assert(pmf);
280  }
281  __stdcall ~mem_fun4_ref_t(void) noexcept(true) {
282  }
283 
284  RetType __fastcall operator()(const Arg1 &a,const Arg2 &b,const Arg3 &c,const Arg4 &d) const {
285  return (obj.*pmf)(a,b,c,d);
286  }
287  RetType __fastcall operator()(const Arg1 &a,const Arg2 &b,const Arg3 &c,const Arg4 &d) {
288  return (obj.*pmf)(a,b,c,d);
289  }
290 
291  private:
292  const fun_type pmf;
293  ObjType obj;
294  };
295 */
296  template<typename RetType,typename ObjType>
298  public:
299  typedef typename ObjType object_type;
300  typedef typename RetType result_type;
301  typedef RetType (__fastcall ObjType::*fun_type)(void);
302 
303  explicit __stdcall copy_mem_fun_ref_t(const fun_type p) noexcept(true)
304  : pmf(p) {
305  assert(pmf);
306  }
307  __stdcall copy_mem_fun_ref_t(const copy_mem_fun_ref_t &p) noexcept(true)
308  : pmf(p.pmf) {
309  assert(pmf);
310  }
311  __stdcall ~copy_mem_fun_ref_t(void) noexcept(true) {
312  }
313 
314  RetType __fastcall operator()(const ObjType &p) const {
315  return (ObjType(p).*pmf)();
316  }
317  RetType __fastcall operator()(ObjType &p) const {
318  return (ObjType(p).*pmf)();
319  }
320 
321  private:
322  const fun_type pmf;
323  };
324 
325  template<typename RetType,typename ObjType,typename Arg1>
327  public:
328  typedef typename ObjType object_type;
329  typedef typename RetType result_type;
330  typedef typename Arg1 first_argument_type;
331  typedef RetType (__fastcall ObjType::*fun_type)(const Arg1 &);
332 
333  explicit __stdcall copy_mem_fun1_ref_t(const fun_type p) noexcept(true)
334  : pmf(p) {
335  assert(pmf);
336  }
337  __stdcall copy_mem_fun1_ref_t(const copy_mem_fun1_ref_t &p) noexcept(true)
338  : pmf(p.pmf) {
339  assert(pmf);
340  }
341  __stdcall ~copy_mem_fun1_ref_t(void) noexcept(true) {
342  }
343 
344  RetType __fastcall operator()(const ObjType &p,const Arg1 &b) const {
345  return (ObjType(p).*pmf)(b);
346  }
347  RetType __fastcall operator()(ObjType &p,const Arg1 &b) const {
348  return (ObjType(p).*pmf)(b);
349  }
350 
351  private:
352  const fun_type pmf;
353  };
354 
355  template<typename RetType,typename ObjType,typename Arg1,typename Arg2>
357  public:
358  typedef typename ObjType object_type;
359  typedef typename RetType result_type;
360  typedef typename Arg1 first_argument_type;
361  typedef typename Arg2 second_argument_type;
362  typedef RetType (__fastcall ObjType::*fun_type)(const Arg1 &,const Arg2 &);
363 
364  explicit __stdcall copy_mem_fun2_ref_t(const fun_type p) noexcept(true)
365  : pmf(p) {
366  assert(pmf);
367  }
368  __stdcall copy_mem_fun2_ref_t(const copy_mem_fun2_ref_t &p) noexcept(true)
369  : pmf(p.pmf) {
370  assert(pmf);
371  }
372  __stdcall ~copy_mem_fun2_ref_t(void) noexcept(true) {
373  }
374 
375  RetType __fastcall operator()(const ObjType &p,const Arg1 &b,const Arg2 &c) const {
376  return (ObjType(p).*pmf)(b,c);
377  }
378  RetType __fastcall operator()(ObjType &p,const Arg1 &b,const Arg2 &c) const {
379  return (ObjType(p).*pmf)(b,c);
380  }
381 
382  private:
383  const fun_type pmf;
384  };
385 
386  template<typename RetType,typename ObjType,typename Arg1>
388  public:
389  typedef typename ObjType object_type;
390  typedef typename RetType result_type;
391  typedef typename Arg1 first_argument_type;
392  typedef RetType (__fastcall ObjType::*fun_type)(const Arg1) const;
393 
394  explicit __stdcall const_mem_fun1_t(const fun_type p) noexcept(true)
395  : pmf(p) {
396  assert(pmf);
397  }
398  __stdcall const_mem_fun1_t(const const_mem_fun1_t &p) noexcept(true)
399  : pmf(p.pmf) {
400  assert(pmf);
401  }
402  __stdcall ~const_mem_fun1_t(void) noexcept(true) {
403  }
404 
405  RetType __fastcall operator()(const ObjType &p,const Arg1 b) const {
406  return (p.*pmf)(b);
407  }
408  RetType __fastcall operator()(ObjType &p,const Arg1 b) const {
409  return (p.*pmf)(b);
410  }
411 
412  private:
413  const fun_type pmf;
414  };
415 
416  template<typename RetType,typename ObjType,typename Arg1>
417  class mem_fun1_t {
418  public:
419  typedef typename ObjType object_type;
420  typedef typename RetType result_type;
421  typedef typename Arg1 first_argument_type;
422  typedef RetType (__fastcall ObjType::*fun_type)(const Arg1);
423 
424  explicit __stdcall mem_fun1_t(const fun_type p) noexcept(true)
425  : pmf(p) {
426  assert(pmf);
427  }
428  __stdcall mem_fun1_t(const mem_fun1_t &p) noexcept(true)
429  : pmf(p.pmf) {
430  assert(pmf);
431  }
432  __stdcall ~mem_fun1_t(void) noexcept(true) {
433  }
434 
435  RetType __fastcall operator()(const Arg1 a) const {
436  return (obj.*pmf)(a);
437  }
438 
439  RetType __fastcall operator()(const Arg1 a) {
440  return (obj.*pmf)(a);
441  }
442 
443  private:
444  fun_type pmf;
445  ObjType obj;
446  };
447 
448  template<typename RetType,typename ObjType,typename Arg1>
450  public:
451  typedef typename ObjType object_type;
452  typedef typename RetType result_type;
453  typedef typename Arg1 first_argument_type;
454  typedef RetType (__fastcall ObjType::*fun_type)(const Arg1);
455 
456  explicit __stdcall copy_mem_fun1_t(const fun_type p) noexcept(true)
457  : pmf(p) {
458  assert(pmf);
459  }
460  __stdcall copy_mem_fun1_t(const copy_mem_fun1_t &p) noexcept(true)
461  : pmf(p.pmf) {
462  assert(pmf);
463  }
464  __stdcall ~copy_mem_fun1_t(void) noexcept(true) {
465  }
466 
467  RetType __fastcall operator()(ObjType &p,const Arg1 b) const {
468  return (p.*pmf)(b);
469  }
470  RetType __fastcall operator()(ObjType &p,const Arg1 b) {
471  return (p.*pmf)(b);
472  }
473 
474  private:
475  const fun_type pmf;
476  };
477 
478 /*
479 
480  Non-member function functors.
481 
482 */
483 
484  template<typename RetType,typename Arg1T>
486  public:
487  typedef typename RetType object_type;
488  typedef typename RetType result_type;
489  typedef typename Arg1T first_argument_type;
490  typedef RetType (__fastcall *fun_type)(const Arg1T &);
491 
492  explicit __stdcall ptr_fun_ref_t(const fun_type p) noexcept(true)
493  : pmf(p) {
494  assert(pmf);
495  }
496  __stdcall ptr_fun_ref_t(const ptr_fun_ref_t &p) noexcept(true)
497  : pmf(p.pmf) {
498  assert(pmf);
499  }
500  __stdcall ~ptr_fun_ref_t(void) noexcept(true) {
501  }
502 
503  RetType __fastcall operator()(const Arg1T &a) const {
504  return (*pmf)(a);
505  }
506 
507  private:
508  const fun_type pmf;
509  };
510 
511  template<typename RetType,typename Arg1T,typename Arg2T>
513  public:
514  typedef typename RetType object_type;
515  typedef typename RetType result_type;
516  typedef typename Arg1T first_argument_type;
517  typedef typename Arg2T second_argument_type;
518  typedef RetType (__fastcall *fun_type)(const Arg1T &,const Arg2T &);
519 
520  explicit __stdcall ptr_fun2_ref_t(const fun_type p) noexcept(true)
521  : pmf(p) {
522  assert(pmf);
523  }
524  __stdcall ptr_fun2_ref_t(const ptr_fun2_ref_t &p) noexcept(true)
525  : pmf(p.pmf) {
526  assert(pmf);
527  }
528  __stdcall ~ptr_fun2_ref_t(void) noexcept(true) {
529  }
530 
531  RetType __fastcall operator()(const Arg1T &a,const Arg2T &b) const {
532  return (*pmf)(a,b);
533  }
534 
535  private:
536  const fun_type pmf;
537  };
538 
539  template<typename RetType,typename Arg1T,typename Arg2T,typename Arg3T>
541  public:
542  typedef typename RetType object_type;
543  typedef typename RetType result_type;
544  typedef typename Arg1T first_argument_type;
545  typedef typename Arg2T second_argument_type;
546  typedef typename Arg3T third_argument_type;
547  typedef RetType (__fastcall *fun_type)(const Arg1T &,const Arg2T &,const Arg3T &);
548 
549  explicit __stdcall ptr_fun3_ref_t(const fun_type p) noexcept(true)
550  : pmf(p) {
551  assert(pmf);
552  }
553  __stdcall ptr_fun3_ref_t(const ptr_fun3_ref_t &p) noexcept(true)
554  : pmf(p.pmf) {
555  assert(pmf);
556  }
557  __stdcall ~ptr_fun3_ref_t(void) noexcept(true) {
558  }
559 
560  RetType __fastcall operator()(const Arg1T &a,const Arg2T &b,const Arg3T &c) const {
561  return (*pmf)(a,b,c);
562  }
563 
564  private:
565  const fun_type pmf;
566  };
567 
568  template<typename RetType,typename Arg1T,typename Arg2T,typename Arg3T,typename Arg4T>
570  public:
571  typedef typename RetType object_type;
572  typedef typename RetType result_type;
573  typedef typename Arg1T first_argument_type;
574  typedef typename Arg2T second_argument_type;
575  typedef typename Arg3T third_argument_type;
576  typedef typename Arg4T fourth_argument_type;
577  typedef RetType (__fastcall *fun_type)(const Arg1T &,const Arg2T &,const Arg3T &);
578 
579  explicit __stdcall ptr_fun4_ref_t(const fun_type p) noexcept(true)
580  : pmf(p) {
581  assert(pmf);
582  }
583  __stdcall ptr_fun4_ref_t(const ptr_fun4_ref_t &p) noexcept(true)
584  : pmf(p.pmf) {
585  assert(pmf);
586  }
587  __stdcall ~ptr_fun4_ref_t(void) noexcept(true) {
588  }
589 
590  RetType __fastcall operator()(const Arg1T &a,const Arg2T &b,const Arg3T &c,const Arg4T &d) const {
591  return (*pmf)(a,b,c,d);
592  }
593 
594  private:
595  const fun_type pmf;
596  };
597 
598  template<typename RetType,typename Arg1T>
599  class ptr_fun_t {
600  public:
601  typedef typename RetType object_type;
602  typedef typename RetType result_type;
603  typedef typename Arg1T first_argument_type;
604  typedef RetType (__fastcall *fun_type)(const Arg1T);
605 
606  explicit __stdcall ptr_fun_t(const fun_type p) noexcept(true)
607  : pmf(p) {
608  assert(pmf);
609  }
610  __stdcall ptr_fun_t(const ptr_fun_t &p) noexcept(true)
611  : pmf(p.pmf) {
612  assert(pmf);
613  }
614  __stdcall ~ptr_fun_t(void) noexcept(true) {
615  }
616 
617  RetType __fastcall operator()(const Arg1T a) const {
618  return (*pmf)(a);
619  }
620 
621  private:
622  const fun_type pmf;
623  };
624 
625  template<typename RetType,typename Arg1T,typename Arg2T>
626  class ptr_fun2_t {
627  public:
628  typedef typename RetType object_type;
629  typedef typename RetType result_type;
630  typedef typename Arg1T first_argument_type;
631  typedef typename Arg2T second_argument_type;
632  typedef RetType (__fastcall *fun_type)(const Arg1T,const Arg2T);
633 
634  explicit __stdcall ptr_fun2_t(const fun_type p) noexcept(true)
635  : pmf(p) {
636  assert(pmf);
637  }
638  __stdcall ptr_fun2_t(const ptr_fun2_t &p) noexcept(true)
639  : pmf(p.pmf) {
640  assert(pmf);
641  }
642  __stdcall ~ptr_fun2_t(void) noexcept(true) {
643  }
644 
645  RetType __fastcall operator()(const Arg1T a,const Arg2T b) const {
646  return (pmf)(a,b);
647  }
648 
649  private:
650  const fun_type pmf;
651  };
652 
653 /*
654 
655  Binders.
656 
657 */
658 
659  template<typename ArgType>
663 
664  const result_type & __fastcall operator()(const argument_type &r) const noexcept(true) {
665  return r;
666  }
667  result_type & __fastcall operator()(argument_type &r) const noexcept(true) {
668  return r;
669  }
670  };
671 
672  struct no_args {
673  };
674  struct one_arg {
675  };
676  struct two_args {
677  };
678  struct three_args {
679  };
680  struct four_args {
681  };
682 
683  template<typename FnType>
684  class binder0args {
685  public:
686  typedef no_args num_args;
687  typedef typename FnType::object_type object_type;
688  typedef typename FnType::result_type result_type;
689  typedef FnType fun_type;
690 
691  __stdcall binder0args(const FnType &x) noexcept(true)
692  : op(x) {
693  }
694  __stdcall binder0args(const binder0args &x) noexcept(true)
695  : op(x.op) {
696  }
697  __stdcall ~binder0args(void) noexcept(true) {
698  }
699 
700  const FnType & __fastcall Op(void) const noexcept(true) {
701  return op;
702  }
703 
704  result_type __fastcall operator()(void) const {
705  return op();
706  }
707  result_type __fastcall operator()(void) {
708  return op();
709  }
710 
711  private:
712  const FnType op;
713  };
714 
715  template<typename FnType,typename Arg1T,template<class> class Cracker1st=NullCrack>
716  class binder1st {
717  public:
718  typedef one_arg num_args;
719  typedef typename FnType::object_type object_type;
720  typedef typename FnType::result_type result_type;
721  typedef FnType fun_type;
722  typedef Arg1T first_argument_type;
724 
726 
727  __stdcall binder1st(const FnType &x,const first_argument_type &v) noexcept(true)
728  : op(x),arg1(v) {
729  }
730  __stdcall binder1st(const binder1st &x) noexcept(true)
731  : op(x.op),arg1(x.arg1) {
732  }
733  __stdcall ~binder1st(void) noexcept(true) {
734  }
735 
736  const FnType & __fastcall Op(void) const noexcept(true) {
737  return op;
738  }
739 
740  result_type __fastcall operator()(void) const {
741  return op(crkd_first_argument_type()(arg1));
742  }
743  result_type __fastcall operator()(void) {
744  return op(crkd_first_argument_type()(arg1));
745  }
746 
747  private:
748  FnType op;
749  };
750 
751  template<typename FnType,typename Arg1T,typename Arg2T,template<class> class Cracker1st=NullCrack,template<class> class Cracker2nd=NullCrack>
752  class binder2args {
753  public:
755  typedef typename FnType::object_type object_type;
756  typedef typename FnType::result_type result_type;
757  typedef FnType fun_type;
758  typedef Arg1T first_argument_type;
759  typedef Arg2T second_argument_type;
762 
765 
766  __stdcall binder2args(const FnType &x,const first_argument_type &v,const second_argument_type &b) noexcept(true)
767  : op(x),arg1(v),arg2(b) {
768  }
769  __stdcall binder2args(const binder2args &x) noexcept(true)
770  : op(x.op),arg1(x.arg1),arg2(x.arg2) {
771  }
772  __stdcall ~binder2args(void) noexcept(true) {
773  }
774 
775  const FnType & __fastcall Op(void) const noexcept(true) {
776  return op;
777  }
778 
779  result_type __fastcall operator()(void) const {
781  }
782  result_type __fastcall operator()(void) {
784  }
785 
786  private:
787  FnType op;
788  };
789 
790  template<typename FnType,typename Arg1T,typename Arg2T,typename Arg3T,template<class> class Cracker1st=NullCrack,template<class> class Cracker2nd=NullCrack,template<class> class Cracker3rd=NullCrack>
791  class binder3args {
792  public:
794  typedef typename FnType::object_type object_type;
795  typedef typename FnType::result_type result_type;
796  typedef FnType fun_type;
797  typedef Arg1T first_argument_type;
798  typedef Arg2T second_argument_type;
799  typedef Arg3T third_argument_type;
803 
807 
808  __stdcall binder3args(const FnType &x,const first_argument_type &v,const second_argument_type &b,const third_argument_type &c) noexcept(true)
809  : op(x),arg1(v),arg2(b),arg3(c) {
810  }
811  __stdcall binder3args(const binder3args &x) noexcept(true)
812  : op(x.op),arg1(x.arg1),arg2(x.arg2),arg3(x.arg3) {
813  }
814  __stdcall ~binder3args(void) noexcept(true) {
815  }
816 
817  const FnType & __fastcall Op(void) const noexcept(true) {
818  return op;
819  }
820 
821  result_type __fastcall operator()(void) const {
823  }
824  result_type __fastcall operator()(void) {
826  }
827 
828  private:
829  const FnType op;
830  };
831 
832  template<typename FnType,typename Arg1T,typename Arg2T,typename Arg3T,typename Arg4T,template<class> class Cracker1st=NullCrack,template<class> class Cracker2nd=NullCrack,template<class> class Cracker3rd=NullCrack,template<class> class Cracker4th=NullCrack>
833  class binder4args {
834  public:
836  typedef typename FnType::object_type object_type;
837  typedef typename FnType::result_type result_type;
838  typedef FnType fun_type;
839  typedef Arg1T first_argument_type;
840  typedef Arg2T second_argument_type;
841  typedef Arg3T third_argument_type;
842  typedef Arg3T fourth_argument_type;
847 
852 
853  __stdcall binder4args(const FnType &x,const first_argument_type &v,const second_argument_type &b,const third_argument_type &c,const fourth_argument_type &d) noexcept(true)
854  : op(x),arg1(v),arg2(b),arg3(c),arg4(d) {
855  }
856  __stdcall binder4args(const binder4args &x) noexcept(true)
857  : op(x.op),arg1(x.arg1),arg2(x.arg2),arg3(x.arg3),arg4(x.arg4) {
858  }
859  __stdcall ~binder4args(void) noexcept(true) {
860  }
861 
862  const FnType & __fastcall Op(void) const noexcept(true) {
863  return op;
864  }
865 
866  result_type __fastcall operator()(void) const {
868  }
869  result_type __fastcall operator()(void) {
871  }
872 
873  private:
874  const FnType op;
875  };
876 
877 } }
878 
879 #endif