2 // Efficient delegates in C++ that generate only two lines of asm code!
3 // Documentation is found at http://www.codeproject.com/cpp/FastDelegate.asp
5 // - Don Clugston, Mar 2004.
6 // Major contributions were made by Jody Hagins.
8 // 24-Apr-04 1.0 * Submitted to CodeProject.
9 // 28-Apr-04 1.1 * Prevent most unsafe uses of evil static function hack.
10 // * Improved syntax for horrible_cast (thanks Paul Bludov).
11 // * Tested on Metrowerks MWCC and Intel ICL (IA32)
12 // * Compiled, but not run, on Comeau C++ and Intel Itanium ICL.
13 // 27-Jun-04 1.2 * Now works on Borland C++ Builder 5.5
14 // * Now works on /clr "managed C++" code on VC7, VC7.1
15 // * Comeau C++ now compiles without warnings.
16 // * Prevent the virtual inheritance case from being used on
17 // VC6 and earlier, which generate incorrect code.
18 // * Improved warning and error messages. Non-standard hacks
19 // now have compile-time checks to make them safer.
20 // * implicit_cast used instead of static_cast in many cases.
21 // * If calling a const member function, a const class pointer can be used.
22 // * MakeDelegate() global helper function added to simplify pass-by-value.
23 // * Added fastdelegate.clear()
24 // 16-Jul-04 1.2.1* Workaround for gcc bug (const member function pointers in templates)
25 // 30-Oct-04 1.3 * Support for (non-void) return values.
26 // * No more workarounds in client code!
27 // MSVC and Intel now use a clever hack invented by John Dlugosz:
28 // - The FASTDELEGATEDECLARE workaround is no longer necessary.
29 // - No more warning messages for VC6
30 // * Less use of macros. Error messages should be more comprehensible.
31 // * Added include guards
32 // * Added FastDelegate::empty() to test if invocation is safe (Thanks Neville Franks).
33 // * Now tested on VS 2005 Express Beta, PGI C++
34 // 24-Dec-04 1.4 * Added DelegateMemento, to allow collections of disparate delegates.
35 // * <,>,<=,>= comparison operators to allow storage in ordered containers.
36 // * Substantial reduction of code size, especially the 'Closure' class.
37 // * Standardised all the compiler-specific workarounds.
38 // * MFP conversion now works for CodePlay (but not yet supported in the full code).
39 // * Now compiles without warnings on _any_ supported compiler, including BCC 5.5.1
40 // * New syntax: FastDelegate< int (char *, double) >.
41 // 14-Feb-05 1.4.1* Now treats =0 as equivalent to .clear(), ==0 as equivalent to .empty(). (Thanks elfric).
42 // * Now tested on Intel ICL for AMD64, VS2005 Beta for AMD64 and Itanium.
43 // 30-Mar-05 1.5 * Safebool idiom: "if (dg)" is now equivalent to "if (!dg.empty())"
44 // * Fully supported by CodePlay VectorC
45 // * Bugfix for Metrowerks: empty() was buggy because a valid MFP can be 0 on MWCC!
46 // * More optimal assignment,== and != operators for static function pointers.
48 #ifndef FASTDELEGATE_H
49 #define FASTDELEGATE_H
54 # endif // _MSC_VER > 1000
55 #endif // #ifdef _MSC_VER
57 #include <memory.h> // to allow <,> comparisons
59 ////////////////////////////////////////////////////////////////////////////////
60 // Configuration options
62 ////////////////////////////////////////////////////////////////////////////////
64 // Uncomment the following #define for optimally-sized delegates.
65 // In this case, the generated asm code is almost identical to the code you'd get
66 // if the compiler had native support for delegates.
67 // It will not work on systems where sizeof(dataptr) < sizeof(codeptr).
68 // Thus, it will not work for DOS compilers using the medium model.
69 // It will also probably fail on some DSP systems.
70 #define FASTDELEGATE_USESTATICFUNCTIONHACK
72 // Uncomment the next line to allow function declarator syntax.
73 // It is automatically enabled for those compilers where it is known to work.
74 //#define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
76 ////////////////////////////////////////////////////////////////////////////////
77 // Compiler identification for workarounds
79 ////////////////////////////////////////////////////////////////////////////////
81 // Compiler identification. It's not easy to identify Visual C++ because
82 // many vendors fraudulently define Microsoft's identifiers.
83 #if defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__VECTOR_C) && !defined(__ICL) && !defined(__BORLANDC__)
84 #define FASTDLGT_ISMSVC
86 #if (_MSC_VER <1300) // Many workarounds are required for VC6.
88 #pragma warning(disable:4786) // disable this ridiculous warning
93 // Does the compiler uses Microsoft's member function pointer structure?
94 // If so, it needs special treatment.
95 // Metrowerks CodeWarrior, Intel, and CodePlay fraudulently define Microsoft's
96 // identifier, _MSC_VER. We need to filter Metrowerks out.
97 #if defined(_MSC_VER) && !defined(__MWERKS__)
98 #define FASTDLGT_MICROSOFT_MFP
100 #if !defined(__VECTOR_C)
101 // CodePlay doesn't have the __single/multi/virtual_inheritance keywords
102 #define FASTDLGT_HASINHERITANCE_KEYWORDS
106 // Does it allow function declarator syntax? The following compilers are known to work:
107 #if defined(FASTDLGT_ISMSVC) && (_MSC_VER >=1310) // VC 7.1
108 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
111 // Gcc(2.95+), and versions of Digital Mars, Intel and Comeau in common use.
112 #if defined (__DMC__) || defined(__GNUC__) || defined(__ICL) || defined(__COMO__)
113 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
116 // It works on Metrowerks MWCC 3.2.2. From boost.Config it should work on earlier ones too.
117 #if defined (__MWERKS__)
118 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
121 #ifdef __GNUC__ // Workaround GCC bug #8271
122 // At present, GCC doesn't recognize constness of MFPs in templates
123 #define FASTDELEGATE_GCC_BUG_8271
128 ////////////////////////////////////////////////////////////////////////////////
129 // General tricks used in this code
131 // (a) Error messages are generated by typdefing an array of negative size to
132 // generate compile-time errors.
133 // (b) Warning messages on MSVC are generated by declaring unused variables, and
134 // enabling the "variable XXX is never used" warning.
135 // (c) Unions are used in a few compiler-specific cases to perform illegal casts.
136 // (d) For Microsoft and Intel, when adjusting the 'this' pointer, it's cast to
137 // (char *) first to ensure that the correct number of *bytes* are added.
139 ////////////////////////////////////////////////////////////////////////////////
142 ////////////////////////////////////////////////////////////////////////////////
145 namespace fastdelegate {
146 namespace detail { // we'll hide the implementation details in a nested namespace.
149 // I believe this was originally going to be in the C++ standard but
150 // was left out by accident. It's even milder than static_cast.
151 // I use it instead of static_cast<> to emphasize that I'm not doing
153 // Usage is identical to static_cast<>
154 template <class OutputClass, class InputClass>
155 inline OutputClass implicit_cast(InputClass input){
160 // This is truly evil. It completely subverts C++'s type system, allowing you
161 // to cast from any class to any other class. Technically, using a union
162 // to perform the cast is undefined behaviour (even in C). But we can see if
163 // it is OK by checking that the union is the same size as each of its members.
164 // horrible_cast<> should only be used for compiler-specific workarounds.
165 // Usage is identical to reinterpret_cast<>.
167 // This union is declared outside the horrible_cast because BCC 5.5.1
168 // can't inline a function with a nested class, and gives a warning.
169 template <class OutputClass, class InputClass>
170 union horrible_union{
175 template <class OutputClass, class InputClass>
176 inline OutputClass horrible_cast(const InputClass input){
177 horrible_union<OutputClass, InputClass> u;
178 // Cause a compile-time error if in, out and u are not the same size.
179 // If the compile fails here, it means the compiler has peculiar
180 // unions which would prevent the cast from working.
181 typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u)
182 && sizeof(InputClass)==sizeof(OutputClass) ? 1 : -1];
187 ////////////////////////////////////////////////////////////////////////////////
190 ////////////////////////////////////////////////////////////////////////////////
192 // Backwards compatibility: This macro used to be necessary in the virtual inheritance
193 // case for Intel and Microsoft. Now it just forward-declares the class.
194 #define FASTDELEGATEDECLARE(CLASSNAME) class CLASSNAME;
196 // Prevent use of the static function hack with the DOS medium model.
198 #undef FASTDELEGATE_USESTATICFUNCTIONHACK
201 // DefaultVoid - a workaround for 'void' templates in VC6.
203 // (1) VC6 and earlier do not allow 'void' as a default template argument.
204 // (2) They also doesn't allow you to return 'void' from a function.
206 // Workaround for (1): Declare a dummy type 'DefaultVoid' which we use
207 // when we'd like to use 'void'. We convert it into 'void' and back
208 // using the templates DefaultVoidToVoid<> and VoidToDefaultVoid<>.
209 // Workaround for (2): On VC6, the code for calling a void function is
210 // identical to the code for calling a non-void function in which the
211 // return value is never used, provided the return value is returned
212 // in the EAX register, rather than on the stack.
213 // This is true for most fundamental types such as int, enum, void *.
214 // Const void * is the safest option since it doesn't participate
215 // in any automatic conversions. But on a 16-bit compiler it might
216 // cause extra code to be generated, so we disable it for all compilers
217 // except for VC6 (and VC5).
220 typedef const void * DefaultVoid;
222 // On any other compiler, just use a normal void.
223 typedef void DefaultVoid;
226 // Translate from 'DefaultVoid' to 'void'.
227 // Everything else is unchanged
229 struct DefaultVoidToVoid { typedef T type; };
232 struct DefaultVoidToVoid<DefaultVoid> { typedef void type; };
234 // Translate from 'void' into 'DefaultVoid'
235 // Everything else is unchanged
237 struct VoidToDefaultVoid { typedef T type; };
240 struct VoidToDefaultVoid<void> { typedef DefaultVoid type; };
244 ////////////////////////////////////////////////////////////////////////////////
245 // Fast Delegates, part 1:
247 // Conversion of member function pointer to a standard form
249 ////////////////////////////////////////////////////////////////////////////////
251 // GenericClass is a fake class, ONLY used to provide a type.
252 // It is vitally important that it is never defined, so that the compiler doesn't
253 // think it can optimize the invocation. For example, Borland generates simpler
254 // code if it knows the class only uses single inheritance.
256 // Compilers using Microsoft's structure need to be treated as a special case.
257 #ifdef FASTDLGT_MICROSOFT_MFP
259 #ifdef FASTDLGT_HASINHERITANCE_KEYWORDS
260 // For Microsoft and Intel, we want to ensure that it's the most efficient type of MFP
261 // (4 bytes), even when the /vmg option is used. Declaring an empty class
262 // would give 16 byte pointers in this case....
263 class __single_inheritance GenericClass;
265 // ...but for Codeplay, an empty class *always* gives 4 byte pointers.
266 // If compiled with the /clr option ("managed C++"), the JIT compiler thinks
267 // it needs to load GenericClass before it can call any of its functions,
268 // (compiles OK but crashes at runtime!), so we need to declare an
269 // empty class to make it happy.
270 // Codeplay and VC4 can't cope with the unknown_inheritance case either.
271 class GenericClass {};
276 // The size of a single inheritance member function pointer.
277 const int SINGLE_MEMFUNCPTR_SIZE = sizeof(void (GenericClass::*)());
279 // SimplifyMemFunc< >::Convert()
281 // A template function that converts an arbitrary member function pointer into the
282 // simplest possible form of member function pointer, using a supplied 'this' pointer.
283 // According to the standard, this can be done legally with reinterpret_cast<>.
284 // For (non-standard) compilers which use member function pointers which vary in size
285 // depending on the class, we need to use knowledge of the internal structure of a
286 // member function pointer, as used by the compiler. Template specialization is used
287 // to distinguish between the sizes. Because some compilers don't support partial
288 // template specialisation, I use full specialisation of a wrapper struct.
290 // general case -- don't know how to convert it. Force a compile failure
292 struct SimplifyMemFunc {
293 template <class X, class XFuncType, class GenericMemFuncType>
294 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
295 GenericMemFuncType &bound_func) {
296 // Unsupported member function type -- force a compile failure.
297 // (it's illegal to have a array with negative size).
298 typedef char ERROR_Unsupported_member_function_pointer_on_this_compiler[N-100];
303 // For compilers where all member func ptrs are the same size, everything goes here.
304 // For non-standard compilers, only single_inheritance classes go here.
306 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE> {
307 template <class X, class XFuncType, class GenericMemFuncType>
308 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
309 GenericMemFuncType &bound_func) {
311 // Digital Mars doesn't allow you to cast between abitrary PMF's,
312 // even though the standard says you can. The 32-bit compiler lets you
313 // static_cast through an int, but the DOS compiler doesn't.
314 bound_func = horrible_cast<GenericMemFuncType>(function_to_bind);
316 bound_func = reinterpret_cast<GenericMemFuncType>(function_to_bind);
318 return reinterpret_cast<GenericClass *>(pthis);
322 ////////////////////////////////////////////////////////////////////////////////
323 // Fast Delegates, part 1b:
325 // Workarounds for Microsoft and Intel
327 ////////////////////////////////////////////////////////////////////////////////
330 // Compilers with member function pointers which violate the standard (MSVC, Intel, Codeplay),
331 // need to be treated as a special case.
332 #ifdef FASTDLGT_MICROSOFT_MFP
334 // We use unions to perform horrible_casts. I would like to use #pragma pack(push, 1)
335 // at the start of each function for extra safety, but VC6 seems to ICE
336 // intermittently if you do this inside a template.
338 // __multiple_inheritance classes go here
339 // Nasty hack for Microsoft and Intel (IA32 and Itanium)
341 struct SimplifyMemFunc< SINGLE_MEMFUNCPTR_SIZE + sizeof(int) > {
342 template <class X, class XFuncType, class GenericMemFuncType>
343 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
344 GenericMemFuncType &bound_func) {
345 // We need to use a horrible_cast to do this conversion.
346 // In MSVC, a multiple inheritance member pointer is internally defined as:
350 GenericMemFuncType funcaddress; // points to the actual member function
351 int delta; // #BYTES to be added to the 'this' pointer
354 // Check that the horrible_cast will work
355 typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)? 1 : -1];
356 u.func = function_to_bind;
357 bound_func = u.s.funcaddress;
358 return reinterpret_cast<GenericClass *>(reinterpret_cast<char *>(pthis) + u.s.delta);
362 // virtual inheritance is a real nuisance. It's inefficient and complicated.
363 // On MSVC and Intel, there isn't enough information in the pointer itself to
364 // enable conversion to a closure pointer. Earlier versions of this code didn't
365 // work for all cases, and generated a compile-time error instead.
366 // But a very clever hack invented by John M. Dlugosz solves this problem.
367 // My code is somewhat different to his: I have no asm code, and I make no
368 // assumptions about the calling convention that is used.
370 // In VC++ and ICL, a virtual_inheritance member pointer
371 // is internally defined as:
372 struct MicrosoftVirtualMFP {
373 void (GenericClass::*codeptr)(); // points to the actual member function
374 int delta; // #bytes to be added to the 'this' pointer
375 int vtable_index; // or 0 if no virtual inheritance
377 // The CRUCIAL feature of Microsoft/Intel MFPs which we exploit is that the
378 // m_codeptr member is *always* called, regardless of the values of the other
379 // members. (This is *not* true for other compilers, eg GCC, which obtain the
380 // function address from the vtable if a virtual function is being called).
381 // Dlugosz's trick is to make the codeptr point to a probe function which
382 // returns the 'this' pointer that was used.
384 // Define a generic class that uses virtual inheritance.
385 // It has a trival member function that returns the value of the 'this' pointer.
386 struct GenericVirtualClass : virtual public GenericClass
388 typedef GenericVirtualClass * (GenericVirtualClass::*ProbePtrType)();
389 GenericVirtualClass * GetThis() { return this; }
392 // __virtual_inheritance classes go here
394 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 2*sizeof(int) >
397 template <class X, class XFuncType, class GenericMemFuncType>
398 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
399 GenericMemFuncType &bound_func) {
402 GenericClass* (X::*ProbeFunc)();
403 MicrosoftVirtualMFP s;
405 u.func = function_to_bind;
406 bound_func = reinterpret_cast<GenericMemFuncType>(u.s.codeptr);
408 GenericVirtualClass::ProbePtrType virtfunc;
409 MicrosoftVirtualMFP s;
411 // Check that the horrible_cast<>s will work
412 typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)
413 && sizeof(function_to_bind)==sizeof(u.ProbeFunc)
414 && sizeof(u2.virtfunc)==sizeof(u2.s) ? 1 : -1];
415 // Unfortunately, taking the address of a MF prevents it from being inlined, so
416 // this next line can't be completely optimised away by the compiler.
417 u2.virtfunc = &GenericVirtualClass::GetThis;
418 u.s.codeptr = u2.s.codeptr;
419 return (pthis->*u.ProbeFunc)();
425 // Nasty hack for Microsoft Visual C++ 6.0
426 // unknown_inheritance classes go here
427 // There is a compiler bug in MSVC6 which generates incorrect code in this case!!
429 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*sizeof(int) >
431 template <class X, class XFuncType, class GenericMemFuncType>
432 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
433 GenericMemFuncType &bound_func) {
434 // There is an apalling but obscure compiler bug in MSVC6 and earlier:
435 // vtable_index and 'vtordisp' are always set to 0 in the
436 // unknown_inheritance case!
437 // This means that an incorrect function could be called!!!
438 // Compiling with the /vmg option leads to potentially incorrect code.
439 // This is probably the reason that the IDE has a user interface for specifying
440 // the /vmg option, but it is disabled - you can only specify /vmg on
441 // the command line. In VC1.5 and earlier, the compiler would ICE if it ever
442 // encountered this situation.
443 // It is OK to use the /vmg option if /vmm or /vms is specified.
445 // Fortunately, the wrong function is only called in very obscure cases.
446 // It only occurs when a derived class overrides a virtual function declared
447 // in a virtual base class, and the member function
448 // points to the *Derived* version of that function. The problem can be
449 // completely averted in 100% of cases by using the *Base class* for the
450 // member fpointer. Ie, if you use the base class as an interface, you'll
451 // stay out of trouble.
452 // Occasionally, you might want to point directly to a derived class function
453 // that isn't an override of a base class. In this case, both vtable_index
454 // and 'vtordisp' are zero, but a virtual_inheritance pointer will be generated.
455 // We can generate correct code in this case. To prevent an incorrect call from
456 // ever being made, on MSVC6 we generate a warning, and call a function to
457 // make the program crash instantly.
458 typedef char ERROR_VC6CompilerBug[-100];
466 // Nasty hack for Microsoft and Intel (IA32 and Itanium)
467 // unknown_inheritance classes go here
468 // This is probably the ugliest bit of code I've ever written. Look at the casts!
469 // There is a compiler bug in MSVC6 which prevents it from using this code.
471 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*sizeof(int) >
473 template <class X, class XFuncType, class GenericMemFuncType>
474 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
475 GenericMemFuncType &bound_func) {
476 // The member function pointer is 16 bytes long. We can't use a normal cast, but
477 // we can use a union to do the conversion.
480 // In VC++ and ICL, an unknown_inheritance member pointer
481 // is internally defined as:
483 GenericMemFuncType m_funcaddress; // points to the actual member function
484 int delta; // #bytes to be added to the 'this' pointer
485 int vtordisp; // #bytes to add to 'this' to find the vtable
486 int vtable_index; // or 0 if no virtual inheritance
489 // Check that the horrible_cast will work
490 typedef int ERROR_CantUsehorrible_cast[sizeof(XFuncType)==sizeof(u.s)? 1 : -1];
491 u.func = function_to_bind;
492 bound_func = u.s.funcaddress;
493 int virtual_delta = 0;
494 if (u.s.vtable_index) { // Virtual inheritance is used
495 // First, get to the vtable.
496 // It is 'vtordisp' bytes from the start of the class.
497 const int * vtable = *reinterpret_cast<const int *const*>(
498 reinterpret_cast<const char *>(pthis) + u.s.vtordisp );
500 // 'vtable_index' tells us where in the table we should be looking.
501 virtual_delta = u.s.vtordisp + *reinterpret_cast<const int *>(
502 reinterpret_cast<const char *>(vtable) + u.s.vtable_index);
504 // The int at 'virtual_delta' gives us the amount to add to 'this'.
505 // Finally we can add the three components together. Phew!
506 return reinterpret_cast<GenericClass *>(
507 reinterpret_cast<char *>(pthis) + u.s.delta + virtual_delta);
510 #endif // MSVC 7 and greater
512 #endif // MS/Intel hacks
514 } // namespace detail
516 ////////////////////////////////////////////////////////////////////////////////
517 // Fast Delegates, part 2:
519 // Define the delegate storage, and cope with static functions
521 ////////////////////////////////////////////////////////////////////////////////
523 // DelegateMemento -- an opaque structure which can hold an arbitary delegate.
524 // It knows nothing about the calling convention or number of arguments used by
525 // the function pointed to.
526 // It supplies comparison operators so that it can be stored in STL collections.
527 // It cannot be set to anything other than null, nor invoked directly:
528 // it must be converted to a specific delegate.
531 // There are two possible implementations: the Safe method and the Evil method.
532 // DelegateMemento - Safe version
534 // This implementation is standard-compliant, but a bit tricky.
535 // A static function pointer is stored inside the class.
536 // Here are the valid values:
537 // +-- Static pointer --+--pThis --+-- pMemFunc-+-- Meaning------+
538 // | 0 | 0 | 0 | Empty |
539 // | !=0 |(dontcare)| Invoker | Static function|
540 // | 0 | !=0 | !=0* | Method call |
541 // +--------------------+----------+------------+----------------+
542 // * For Metrowerks, this can be 0. (first virtual function in a
543 // single_inheritance class).
544 // When stored stored inside a specific delegate, the 'dontcare' entries are replaced
545 // with a reference to the delegate itself. This complicates the = and == operators
546 // for the delegate class.
548 // DelegateMemento - Evil version
550 // For compilers where data pointers are at least as big as code pointers, it is
551 // possible to store the function pointer in the this pointer, using another
552 // horrible_cast. In this case the DelegateMemento implementation is simple:
553 // +--pThis --+-- pMemFunc-+-- Meaning---------------------+
555 // | !=0 | !=0* | Static function or method call|
556 // +----------+------------+-------------------------------+
557 // * For Metrowerks, this can be 0. (first virtual function in a
558 // single_inheritance class).
559 // Note that the Sun C++ and MSVC documentation explicitly state that they
560 // support static_cast between void * and function pointers.
562 class DelegateMemento {
564 // the data is protected, not private, because many
565 // compilers have problems with template friends.
566 typedef void (detail::GenericClass::*GenericMemFuncType)(); // arbitrary MFP.
567 detail::GenericClass *m_pthis;
568 GenericMemFuncType m_pFunction;
570 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
571 typedef void (*GenericFuncPtr)(); // arbitrary code pointer
572 GenericFuncPtr m_pStaticFunction;
576 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
577 DelegateMemento() : m_pthis(0), m_pFunction(0), m_pStaticFunction(0) {};
579 m_pthis=0; m_pFunction=0; m_pStaticFunction=0;
582 DelegateMemento() : m_pthis(0), m_pFunction(0) {};
583 void clear() { m_pthis=0; m_pFunction=0; }
586 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
587 inline bool IsEqual (const DelegateMemento &x) const{
588 // We have to cope with the static function pointers as a special case
589 if (m_pFunction!=x.m_pFunction) return false;
590 // the static function ptrs must either both be equal, or both be 0.
591 if (m_pStaticFunction!=x.m_pStaticFunction) return false;
592 if (m_pStaticFunction!=0) return m_pthis==x.m_pthis;
596 inline bool IsEqual (const DelegateMemento &x) const{
597 return m_pthis==x.m_pthis && m_pFunction==x.m_pFunction;
600 // Provide a strict weak ordering for DelegateMementos.
601 inline bool IsLess(const DelegateMemento &right) const {
602 // deal with static function pointers first
603 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
604 if (m_pStaticFunction !=0 || right.m_pStaticFunction!=0)
605 return m_pStaticFunction < right.m_pStaticFunction;
607 if (m_pthis !=right.m_pthis) return m_pthis < right.m_pthis;
608 // There are no ordering operators for member function pointers,
609 // but we can fake one by comparing each byte. The resulting ordering is
610 // arbitrary (and compiler-dependent), but it permits storage in ordered STL containers.
611 return memcmp(&m_pFunction, &right.m_pFunction, sizeof(m_pFunction)) < 0;
614 // BUGFIX (Mar 2005):
615 // We can't just compare m_pFunction because on Metrowerks,
616 // m_pFunction can be zero even if the delegate is not empty!
617 inline bool operator ! () const // Is it bound to anything?
618 { return m_pthis==0 && m_pFunction==0; }
619 inline bool empty() const // Is it bound to anything?
620 { return m_pthis==0 && m_pFunction==0; }
622 DelegateMemento & operator = (const DelegateMemento &right) {
623 SetMementoFrom(right);
626 inline bool operator <(const DelegateMemento &right) {
627 return IsLess(right);
629 inline bool operator >(const DelegateMemento &right) {
630 return right.IsLess(*this);
632 DelegateMemento (const DelegateMemento &right) :
633 m_pthis(right.m_pthis), m_pFunction(right.m_pFunction)
634 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
635 , m_pStaticFunction (right.m_pStaticFunction)
639 void SetMementoFrom(const DelegateMemento &right) {
640 m_pFunction = right.m_pFunction;
641 m_pthis = right.m_pthis;
642 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
643 m_pStaticFunction = right.m_pStaticFunction;
651 // A private wrapper class that adds function signatures to DelegateMemento.
652 // It's the class that does most of the actual work.
653 // The signatures are specified by:
654 // GenericMemFunc: must be a type of GenericClass member function pointer.
655 // StaticFuncPtr: must be a type of function pointer with the same signature
656 // as GenericMemFunc.
657 // UnvoidStaticFuncPtr: is the same as StaticFuncPtr, except on VC6
658 // where it never returns void (returns DefaultVoid instead).
660 // An outer class, FastDelegateN<>, handles the invoking and creates the
661 // necessary typedefs.
662 // This class does everything else.
666 template < class GenericMemFunc, class StaticFuncPtr, class UnvoidStaticFuncPtr>
667 class ClosurePtr : public DelegateMemento {
669 // These functions are for setting the delegate to a member function.
671 // Here's the clever bit: we convert an arbitrary member function into a
672 // standard form. XMemFunc should be a member function of class X, but I can't
673 // enforce that here. It needs to be enforced by the wrapper class.
674 template < class X, class XMemFunc >
675 inline void bindmemfunc(X *pthis, XMemFunc function_to_bind ) {
676 m_pthis = SimplifyMemFunc< sizeof(function_to_bind) >
677 ::Convert(pthis, function_to_bind, m_pFunction);
678 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
679 m_pStaticFunction = 0;
682 // For const member functions, we only need a const class pointer.
683 // Since we know that the member function is const, it's safe to
684 // remove the const qualifier from the 'this' pointer with a const_cast.
685 // VC6 has problems if we just overload 'bindmemfunc', so we give it a different name.
686 template < class X, class XMemFunc>
687 inline void bindconstmemfunc(const X *pthis, XMemFunc function_to_bind) {
688 m_pthis= SimplifyMemFunc< sizeof(function_to_bind) >
689 ::Convert(const_cast<X*>(pthis), function_to_bind, m_pFunction);
690 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
691 m_pStaticFunction = 0;
694 #ifdef FASTDELEGATE_GCC_BUG_8271 // At present, GCC doesn't recognize constness of MFPs in templates
695 template < class X, class XMemFunc>
696 inline void bindmemfunc(const X *pthis, XMemFunc function_to_bind) {
697 bindconstmemfunc(pthis, function_to_bind);
698 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
699 m_pStaticFunction = 0;
703 // These functions are required for invoking the stored function
704 inline GenericClass *GetClosureThis() const { return m_pthis; }
705 inline GenericMemFunc GetClosureMemPtr() const { return reinterpret_cast<GenericMemFunc>(m_pFunction); }
707 // There are a few ways of dealing with static function pointers.
708 // There's a standard-compliant, but tricky method.
709 // There's also a straightforward hack, that won't work on DOS compilers using the
710 // medium memory model. It's so evil that I can't recommend it, but I've
711 // implemented it anyway because it produces very nice asm code.
713 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
715 // ClosurePtr<> - Safe version
717 // This implementation is standard-compliant, but a bit tricky.
718 // I store the function pointer inside the class, and the delegate then
719 // points to itself. Whenever the delegate is copied, these self-references
720 // must be transformed, and this complicates the = and == operators.
722 // The next two functions are for operator ==, =, and the copy constructor.
723 // We may need to convert the m_pthis pointers, so that
724 // they remain as self-references.
725 template< class DerivedClass >
726 inline void CopyFrom (DerivedClass *pParent, const DelegateMemento &x) {
728 if (m_pStaticFunction!=0) {
729 // transform self references...
730 m_pthis=reinterpret_cast<GenericClass *>(pParent);
733 // For static functions, the 'static_function_invoker' class in the parent
734 // will be called. The parent then needs to call GetStaticFunction() to find out
735 // the actual function to invoke.
736 template < class DerivedClass, class ParentInvokerSig >
737 inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker,
738 StaticFuncPtr function_to_bind ) {
739 if (function_to_bind==0) { // cope with assignment to 0
742 bindmemfunc(pParent, static_function_invoker);
744 m_pStaticFunction=reinterpret_cast<GenericFuncPtr>(function_to_bind);
746 inline UnvoidStaticFuncPtr GetStaticFunction() const {
747 return reinterpret_cast<UnvoidStaticFuncPtr>(m_pStaticFunction);
751 // ClosurePtr<> - Evil version
753 // For compilers where data pointers are at least as big as code pointers, it is
754 // possible to store the function pointer in the this pointer, using another
755 // horrible_cast. Invocation isn't any faster, but it saves 4 bytes, and
756 // speeds up comparison and assignment. If C++ provided direct language support
757 // for delegates, they would produce asm code that was almost identical to this.
758 // Note that the Sun C++ and MSVC documentation explicitly state that they
759 // support static_cast between void * and function pointers.
761 template< class DerivedClass >
762 inline void CopyFrom (DerivedClass *pParent, const DelegateMemento &right) {
763 SetMementoFrom(right);
765 // For static functions, the 'static_function_invoker' class in the parent
766 // will be called. The parent then needs to call GetStaticFunction() to find out
767 // the actual function to invoke.
768 // ******** EVIL, EVIL CODE! *******
769 template < class DerivedClass, class ParentInvokerSig>
770 inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker,
771 StaticFuncPtr function_to_bind) {
772 if (function_to_bind==0) { // cope with assignment to 0
775 // We'll be ignoring the 'this' pointer, but we need to make sure we pass
776 // a valid value to bindmemfunc().
777 bindmemfunc(pParent, static_function_invoker);
780 // WARNING! Evil hack. We store the function in the 'this' pointer!
781 // Ensure that there's a compilation failure if function pointers
782 // and data pointers have different sizes.
783 // If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
784 typedef int ERROR_CantUseEvilMethod[sizeof(GenericClass *)==sizeof(function_to_bind) ? 1 : -1];
785 m_pthis = horrible_cast<GenericClass *>(function_to_bind);
786 // MSVC, SunC++ and DMC accept the following (non-standard) code:
787 // m_pthis = static_cast<GenericClass *>(static_cast<void *>(function_to_bind));
788 // BCC32, Comeau and DMC accept this method. MSVC7.1 needs __int64 instead of long
789 // m_pthis = reinterpret_cast<GenericClass *>(reinterpret_cast<long>(function_to_bind));
791 // ******** EVIL, EVIL CODE! *******
792 // This function will be called with an invalid 'this' pointer!!
793 // We're just returning the 'this' pointer, converted into
794 // a function pointer!
795 inline UnvoidStaticFuncPtr GetStaticFunction() const {
796 // Ensure that there's a compilation failure if function pointers
797 // and data pointers have different sizes.
798 // If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
799 typedef int ERROR_CantUseEvilMethod[sizeof(UnvoidStaticFuncPtr)==sizeof(this) ? 1 : -1];
800 return horrible_cast<UnvoidStaticFuncPtr>(this);
802 #endif // !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
804 // Does the closure contain this static function?
805 inline bool IsEqualToStaticFuncPtr(StaticFuncPtr funcptr){
806 if (funcptr==0) return empty();
807 // For the Evil method, if it doesn't actually contain a static function, this will return an arbitrary
808 // value that is not equal to any valid function pointer.
809 else return funcptr==reinterpret_cast<StaticFuncPtr>(GetStaticFunction());
814 } // namespace detail
816 ////////////////////////////////////////////////////////////////////////////////
817 // Fast Delegates, part 3:
819 // Wrapper classes to ensure type safety
821 ////////////////////////////////////////////////////////////////////////////////
824 // Once we have the member function conversion templates, it's easy to make the
825 // wrapper classes. So that they will work with as many compilers as possible,
826 // the classes are of the form
827 // FastDelegate3<int, char *, double>
828 // They can cope with any combination of parameters. The max number of parameters
829 // allowed is 8, but it is trivial to increase this limit.
830 // Note that we need to treat const member functions seperately.
831 // All this class does is to enforce type safety, and invoke the delegate with
832 // the correct list of parameters.
834 // Because of the weird rule about the class of derived member function pointers,
835 // you sometimes need to apply a downcast to the 'this' pointer.
836 // This is the reason for the use of "implicit_cast<X*>(pthis)" in the code below.
837 // If CDerivedClass is derived from CBaseClass, but doesn't override SimpleVirtualFunction,
838 // without this trick you'd need to write:
839 // MyDelegate(static_cast<CBaseClass *>(&d), &CDerivedClass::SimpleVirtualFunction);
840 // but with the trick you can write
841 // MyDelegate(&d, &CDerivedClass::SimpleVirtualFunction);
843 // RetType is the type the compiler uses in compiling the template. For VC6,
844 // it cannot be void. DesiredRetType is the real type which is returned from
845 // all of the functions. It can be void.
847 // Implicit conversion to "bool" is achieved using the safe_bool idiom,
848 // using member data pointers (MDP). This allows "if (dg)..." syntax
849 // Because some compilers (eg codeplay) don't have a unique value for a zero
850 // MDP, an extra padding member is added to the SafeBool struct.
851 // Some compilers (eg VC6) won't implicitly convert from 0 to an MDP, so
852 // in that case the static function constructor is not made explicit; this
853 // allows "if (dg==0) ..." to compile.
856 template<class RetType=detail::DefaultVoid>
857 class FastDelegate0 {
859 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
860 typedef DesiredRetType (*StaticFunctionPtr)();
861 typedef RetType (*UnvoidStaticFunctionPtr)();
862 typedef RetType (detail::GenericClass::*GenericMemFn)();
863 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
864 ClosureType m_Closure;
866 // Typedefs to aid generic programming
867 typedef FastDelegate0 type;
869 // Construction and comparison functions
870 FastDelegate0() { clear(); }
871 FastDelegate0(const FastDelegate0 &x) {
872 m_Closure.CopyFrom(this, x.m_Closure); }
873 void operator = (const FastDelegate0 &x) {
874 m_Closure.CopyFrom(this, x.m_Closure); }
875 bool operator ==(const FastDelegate0 &x) const {
876 return m_Closure.IsEqual(x.m_Closure); }
877 bool operator !=(const FastDelegate0 &x) const {
878 return !m_Closure.IsEqual(x.m_Closure); }
879 bool operator <(const FastDelegate0 &x) const {
880 return m_Closure.IsLess(x.m_Closure); }
881 bool operator >(const FastDelegate0 &x) const {
882 return x.m_Closure.IsLess(m_Closure); }
883 // Binding to non-const member functions
884 template < class X, class Y >
885 FastDelegate0(Y *pthis, DesiredRetType (X::* function_to_bind)() ) {
886 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
887 template < class X, class Y >
888 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)()) {
889 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
890 // Binding to const member functions.
891 template < class X, class Y >
892 FastDelegate0(const Y *pthis, DesiredRetType (X::* function_to_bind)() const) {
893 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
894 template < class X, class Y >
895 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)() const) {
896 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
897 // Static functions. We convert them into a member function call.
898 // This constructor also provides implicit conversion
899 FastDelegate0(DesiredRetType (*function_to_bind)() ) {
900 bind(function_to_bind); }
901 // for efficiency, prevent creation of a temporary
902 void operator = (DesiredRetType (*function_to_bind)() ) {
903 bind(function_to_bind); }
904 inline void bind(DesiredRetType (*function_to_bind)()) {
905 m_Closure.bindstaticfunc(this, &FastDelegate0::InvokeStaticFunction,
907 // Invoke the delegate
908 RetType operator() () const {
909 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(); }
910 // Implicit conversion to "bool" using the safe_bool idiom
912 typedef struct SafeBoolStruct {
913 int a_data_pointer_to_this_is_0_on_buggy_compilers;
914 StaticFunctionPtr m_nonzero;
916 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
918 operator unspecified_bool_type() const {
919 return empty()? 0: &SafeBoolStruct::m_nonzero;
921 // necessary to allow ==0 to work despite the safe_bool idiom
922 inline bool operator==(StaticFunctionPtr funcptr) {
923 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
924 inline bool operator!=(StaticFunctionPtr funcptr) {
925 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
926 inline bool operator ! () const { // Is it bound to anything?
928 inline bool empty() const {
930 void clear() { m_Closure.clear();}
931 // Conversion to and from the DelegateMemento storage class
932 const DelegateMemento & GetMemento() { return m_Closure; }
933 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
935 private: // Invoker for static functions
936 RetType InvokeStaticFunction() const {
937 return (*(m_Closure.GetStaticFunction()))(); }
941 template<class Param1, class RetType=detail::DefaultVoid>
942 class FastDelegate1 {
944 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
945 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1);
946 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1);
947 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1);
948 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
949 ClosureType m_Closure;
951 // Typedefs to aid generic programming
952 typedef FastDelegate1 type;
954 // Construction and comparison functions
955 FastDelegate1() { clear(); }
956 FastDelegate1(const FastDelegate1 &x) {
957 m_Closure.CopyFrom(this, x.m_Closure); }
958 void operator = (const FastDelegate1 &x) {
959 m_Closure.CopyFrom(this, x.m_Closure); }
960 bool operator ==(const FastDelegate1 &x) const {
961 return m_Closure.IsEqual(x.m_Closure); }
962 bool operator !=(const FastDelegate1 &x) const {
963 return !m_Closure.IsEqual(x.m_Closure); }
964 bool operator <(const FastDelegate1 &x) const {
965 return m_Closure.IsLess(x.m_Closure); }
966 bool operator >(const FastDelegate1 &x) const {
967 return x.m_Closure.IsLess(m_Closure); }
968 // Binding to non-const member functions
969 template < class X, class Y >
970 FastDelegate1(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) ) {
971 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
972 template < class X, class Y >
973 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1)) {
974 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
975 // Binding to const member functions.
976 template < class X, class Y >
977 FastDelegate1(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) const) {
978 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
979 template < class X, class Y >
980 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) const) {
981 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
982 // Static functions. We convert them into a member function call.
983 // This constructor also provides implicit conversion
984 FastDelegate1(DesiredRetType (*function_to_bind)(Param1 p1) ) {
985 bind(function_to_bind); }
986 // for efficiency, prevent creation of a temporary
987 void operator = (DesiredRetType (*function_to_bind)(Param1 p1) ) {
988 bind(function_to_bind); }
989 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1)) {
990 m_Closure.bindstaticfunc(this, &FastDelegate1::InvokeStaticFunction,
992 // Invoke the delegate
993 RetType operator() (Param1 p1) const {
994 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1); }
995 // Implicit conversion to "bool" using the safe_bool idiom
997 typedef struct SafeBoolStruct {
998 int a_data_pointer_to_this_is_0_on_buggy_compilers;
999 StaticFunctionPtr m_nonzero;
1001 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1003 operator unspecified_bool_type() const {
1004 return empty()? 0: &SafeBoolStruct::m_nonzero;
1006 // necessary to allow ==0 to work despite the safe_bool idiom
1007 inline bool operator==(StaticFunctionPtr funcptr) {
1008 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1009 inline bool operator!=(StaticFunctionPtr funcptr) {
1010 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1011 inline bool operator ! () const { // Is it bound to anything?
1012 return !m_Closure; }
1013 inline bool empty() const {
1014 return !m_Closure; }
1015 void clear() { m_Closure.clear();}
1016 // Conversion to and from the DelegateMemento storage class
1017 const DelegateMemento & GetMemento() { return m_Closure; }
1018 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1020 private: // Invoker for static functions
1021 RetType InvokeStaticFunction(Param1 p1) const {
1022 return (*(m_Closure.GetStaticFunction()))(p1); }
1026 template<class Param1, class Param2, class RetType=detail::DefaultVoid>
1027 class FastDelegate2 {
1029 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1030 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2);
1031 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2);
1032 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2);
1033 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
1034 ClosureType m_Closure;
1036 // Typedefs to aid generic programming
1037 typedef FastDelegate2 type;
1039 // Construction and comparison functions
1040 FastDelegate2() { clear(); }
1041 FastDelegate2(const FastDelegate2 &x) {
1042 m_Closure.CopyFrom(this, x.m_Closure); }
1043 void operator = (const FastDelegate2 &x) {
1044 m_Closure.CopyFrom(this, x.m_Closure); }
1045 bool operator ==(const FastDelegate2 &x) const {
1046 return m_Closure.IsEqual(x.m_Closure); }
1047 bool operator !=(const FastDelegate2 &x) const {
1048 return !m_Closure.IsEqual(x.m_Closure); }
1049 bool operator <(const FastDelegate2 &x) const {
1050 return m_Closure.IsLess(x.m_Closure); }
1051 bool operator >(const FastDelegate2 &x) const {
1052 return x.m_Closure.IsLess(m_Closure); }
1053 // Binding to non-const member functions
1054 template < class X, class Y >
1055 FastDelegate2(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) ) {
1056 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1057 template < class X, class Y >
1058 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2)) {
1059 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1060 // Binding to const member functions.
1061 template < class X, class Y >
1062 FastDelegate2(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) const) {
1063 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1064 template < class X, class Y >
1065 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) const) {
1066 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1067 // Static functions. We convert them into a member function call.
1068 // This constructor also provides implicit conversion
1069 FastDelegate2(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2) ) {
1070 bind(function_to_bind); }
1071 // for efficiency, prevent creation of a temporary
1072 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2) ) {
1073 bind(function_to_bind); }
1074 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2)) {
1075 m_Closure.bindstaticfunc(this, &FastDelegate2::InvokeStaticFunction,
1076 function_to_bind); }
1077 // Invoke the delegate
1078 RetType operator() (Param1 p1, Param2 p2) const {
1079 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2); }
1080 // Implicit conversion to "bool" using the safe_bool idiom
1082 typedef struct SafeBoolStruct {
1083 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1084 StaticFunctionPtr m_nonzero;
1086 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1088 operator unspecified_bool_type() const {
1089 return empty()? 0: &SafeBoolStruct::m_nonzero;
1091 // necessary to allow ==0 to work despite the safe_bool idiom
1092 inline bool operator==(StaticFunctionPtr funcptr) {
1093 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1094 inline bool operator!=(StaticFunctionPtr funcptr) {
1095 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1096 inline bool operator ! () const { // Is it bound to anything?
1097 return !m_Closure; }
1098 inline bool empty() const {
1099 return !m_Closure; }
1100 void clear() { m_Closure.clear();}
1101 // Conversion to and from the DelegateMemento storage class
1102 const DelegateMemento & GetMemento() { return m_Closure; }
1103 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1105 private: // Invoker for static functions
1106 RetType InvokeStaticFunction(Param1 p1, Param2 p2) const {
1107 return (*(m_Closure.GetStaticFunction()))(p1, p2); }
1111 template<class Param1, class Param2, class Param3, class RetType=detail::DefaultVoid>
1112 class FastDelegate3 {
1114 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1115 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
1116 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
1117 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3);
1118 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
1119 ClosureType m_Closure;
1121 // Typedefs to aid generic programming
1122 typedef FastDelegate3 type;
1124 // Construction and comparison functions
1125 FastDelegate3() { clear(); }
1126 FastDelegate3(const FastDelegate3 &x) {
1127 m_Closure.CopyFrom(this, x.m_Closure); }
1128 void operator = (const FastDelegate3 &x) {
1129 m_Closure.CopyFrom(this, x.m_Closure); }
1130 bool operator ==(const FastDelegate3 &x) const {
1131 return m_Closure.IsEqual(x.m_Closure); }
1132 bool operator !=(const FastDelegate3 &x) const {
1133 return !m_Closure.IsEqual(x.m_Closure); }
1134 bool operator <(const FastDelegate3 &x) const {
1135 return m_Closure.IsLess(x.m_Closure); }
1136 bool operator >(const FastDelegate3 &x) const {
1137 return x.m_Closure.IsLess(m_Closure); }
1138 // Binding to non-const member functions
1139 template < class X, class Y >
1140 FastDelegate3(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) {
1141 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1142 template < class X, class Y >
1143 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
1144 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1145 // Binding to const member functions.
1146 template < class X, class Y >
1147 FastDelegate3(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const) {
1148 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1149 template < class X, class Y >
1150 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const) {
1151 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1152 // Static functions. We convert them into a member function call.
1153 // This constructor also provides implicit conversion
1154 FastDelegate3(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) {
1155 bind(function_to_bind); }
1156 // for efficiency, prevent creation of a temporary
1157 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) {
1158 bind(function_to_bind); }
1159 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
1160 m_Closure.bindstaticfunc(this, &FastDelegate3::InvokeStaticFunction,
1161 function_to_bind); }
1162 // Invoke the delegate
1163 RetType operator() (Param1 p1, Param2 p2, Param3 p3) const {
1164 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3); }
1165 // Implicit conversion to "bool" using the safe_bool idiom
1167 typedef struct SafeBoolStruct {
1168 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1169 StaticFunctionPtr m_nonzero;
1171 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1173 operator unspecified_bool_type() const {
1174 return empty()? 0: &SafeBoolStruct::m_nonzero;
1176 // necessary to allow ==0 to work despite the safe_bool idiom
1177 inline bool operator==(StaticFunctionPtr funcptr) {
1178 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1179 inline bool operator!=(StaticFunctionPtr funcptr) {
1180 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1181 inline bool operator ! () const { // Is it bound to anything?
1182 return !m_Closure; }
1183 inline bool empty() const {
1184 return !m_Closure; }
1185 void clear() { m_Closure.clear();}
1186 // Conversion to and from the DelegateMemento storage class
1187 const DelegateMemento & GetMemento() { return m_Closure; }
1188 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1190 private: // Invoker for static functions
1191 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3) const {
1192 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3); }
1196 template<class Param1, class Param2, class Param3, class Param4, class RetType=detail::DefaultVoid>
1197 class FastDelegate4 {
1199 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1200 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
1201 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
1202 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
1203 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
1204 ClosureType m_Closure;
1206 // Typedefs to aid generic programming
1207 typedef FastDelegate4 type;
1209 // Construction and comparison functions
1210 FastDelegate4() { clear(); }
1211 FastDelegate4(const FastDelegate4 &x) {
1212 m_Closure.CopyFrom(this, x.m_Closure); }
1213 void operator = (const FastDelegate4 &x) {
1214 m_Closure.CopyFrom(this, x.m_Closure); }
1215 bool operator ==(const FastDelegate4 &x) const {
1216 return m_Closure.IsEqual(x.m_Closure); }
1217 bool operator !=(const FastDelegate4 &x) const {
1218 return !m_Closure.IsEqual(x.m_Closure); }
1219 bool operator <(const FastDelegate4 &x) const {
1220 return m_Closure.IsLess(x.m_Closure); }
1221 bool operator >(const FastDelegate4 &x) const {
1222 return x.m_Closure.IsLess(m_Closure); }
1223 // Binding to non-const member functions
1224 template < class X, class Y >
1225 FastDelegate4(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) {
1226 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1227 template < class X, class Y >
1228 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
1229 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1230 // Binding to const member functions.
1231 template < class X, class Y >
1232 FastDelegate4(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) {
1233 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1234 template < class X, class Y >
1235 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) {
1236 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1237 // Static functions. We convert them into a member function call.
1238 // This constructor also provides implicit conversion
1239 FastDelegate4(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) {
1240 bind(function_to_bind); }
1241 // for efficiency, prevent creation of a temporary
1242 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) {
1243 bind(function_to_bind); }
1244 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
1245 m_Closure.bindstaticfunc(this, &FastDelegate4::InvokeStaticFunction,
1246 function_to_bind); }
1247 // Invoke the delegate
1248 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4) const {
1249 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4); }
1250 // Implicit conversion to "bool" using the safe_bool idiom
1252 typedef struct SafeBoolStruct {
1253 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1254 StaticFunctionPtr m_nonzero;
1256 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1258 operator unspecified_bool_type() const {
1259 return empty()? 0: &SafeBoolStruct::m_nonzero;
1261 // necessary to allow ==0 to work despite the safe_bool idiom
1262 inline bool operator==(StaticFunctionPtr funcptr) {
1263 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1264 inline bool operator!=(StaticFunctionPtr funcptr) {
1265 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1266 inline bool operator ! () const { // Is it bound to anything?
1267 return !m_Closure; }
1268 inline bool empty() const {
1269 return !m_Closure; }
1270 void clear() { m_Closure.clear();}
1271 // Conversion to and from the DelegateMemento storage class
1272 const DelegateMemento & GetMemento() { return m_Closure; }
1273 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1275 private: // Invoker for static functions
1276 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const {
1277 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4); }
1281 template<class Param1, class Param2, class Param3, class Param4, class Param5, class RetType=detail::DefaultVoid>
1282 class FastDelegate5 {
1284 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1285 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
1286 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
1287 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
1288 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
1289 ClosureType m_Closure;
1291 // Typedefs to aid generic programming
1292 typedef FastDelegate5 type;
1294 // Construction and comparison functions
1295 FastDelegate5() { clear(); }
1296 FastDelegate5(const FastDelegate5 &x) {
1297 m_Closure.CopyFrom(this, x.m_Closure); }
1298 void operator = (const FastDelegate5 &x) {
1299 m_Closure.CopyFrom(this, x.m_Closure); }
1300 bool operator ==(const FastDelegate5 &x) const {
1301 return m_Closure.IsEqual(x.m_Closure); }
1302 bool operator !=(const FastDelegate5 &x) const {
1303 return !m_Closure.IsEqual(x.m_Closure); }
1304 bool operator <(const FastDelegate5 &x) const {
1305 return m_Closure.IsLess(x.m_Closure); }
1306 bool operator >(const FastDelegate5 &x) const {
1307 return x.m_Closure.IsLess(m_Closure); }
1308 // Binding to non-const member functions
1309 template < class X, class Y >
1310 FastDelegate5(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) {
1311 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1312 template < class X, class Y >
1313 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
1314 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1315 // Binding to const member functions.
1316 template < class X, class Y >
1317 FastDelegate5(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) {
1318 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1319 template < class X, class Y >
1320 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) {
1321 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1322 // Static functions. We convert them into a member function call.
1323 // This constructor also provides implicit conversion
1324 FastDelegate5(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) {
1325 bind(function_to_bind); }
1326 // for efficiency, prevent creation of a temporary
1327 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) {
1328 bind(function_to_bind); }
1329 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
1330 m_Closure.bindstaticfunc(this, &FastDelegate5::InvokeStaticFunction,
1331 function_to_bind); }
1332 // Invoke the delegate
1333 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const {
1334 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5); }
1335 // Implicit conversion to "bool" using the safe_bool idiom
1337 typedef struct SafeBoolStruct {
1338 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1339 StaticFunctionPtr m_nonzero;
1341 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1343 operator unspecified_bool_type() const {
1344 return empty()? 0: &SafeBoolStruct::m_nonzero;
1346 // necessary to allow ==0 to work despite the safe_bool idiom
1347 inline bool operator==(StaticFunctionPtr funcptr) {
1348 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1349 inline bool operator!=(StaticFunctionPtr funcptr) {
1350 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1351 inline bool operator ! () const { // Is it bound to anything?
1352 return !m_Closure; }
1353 inline bool empty() const {
1354 return !m_Closure; }
1355 void clear() { m_Closure.clear();}
1356 // Conversion to and from the DelegateMemento storage class
1357 const DelegateMemento & GetMemento() { return m_Closure; }
1358 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1360 private: // Invoker for static functions
1361 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const {
1362 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5); }
1366 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType=detail::DefaultVoid>
1367 class FastDelegate6 {
1369 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1370 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
1371 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
1372 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
1373 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
1374 ClosureType m_Closure;
1376 // Typedefs to aid generic programming
1377 typedef FastDelegate6 type;
1379 // Construction and comparison functions
1380 FastDelegate6() { clear(); }
1381 FastDelegate6(const FastDelegate6 &x) {
1382 m_Closure.CopyFrom(this, x.m_Closure); }
1383 void operator = (const FastDelegate6 &x) {
1384 m_Closure.CopyFrom(this, x.m_Closure); }
1385 bool operator ==(const FastDelegate6 &x) const {
1386 return m_Closure.IsEqual(x.m_Closure); }
1387 bool operator !=(const FastDelegate6 &x) const {
1388 return !m_Closure.IsEqual(x.m_Closure); }
1389 bool operator <(const FastDelegate6 &x) const {
1390 return m_Closure.IsLess(x.m_Closure); }
1391 bool operator >(const FastDelegate6 &x) const {
1392 return x.m_Closure.IsLess(m_Closure); }
1393 // Binding to non-const member functions
1394 template < class X, class Y >
1395 FastDelegate6(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) {
1396 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1397 template < class X, class Y >
1398 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
1399 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1400 // Binding to const member functions.
1401 template < class X, class Y >
1402 FastDelegate6(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) {
1403 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1404 template < class X, class Y >
1405 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) {
1406 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1407 // Static functions. We convert them into a member function call.
1408 // This constructor also provides implicit conversion
1409 FastDelegate6(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) {
1410 bind(function_to_bind); }
1411 // for efficiency, prevent creation of a temporary
1412 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) {
1413 bind(function_to_bind); }
1414 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
1415 m_Closure.bindstaticfunc(this, &FastDelegate6::InvokeStaticFunction,
1416 function_to_bind); }
1417 // Invoke the delegate
1418 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const {
1419 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6); }
1420 // Implicit conversion to "bool" using the safe_bool idiom
1422 typedef struct SafeBoolStruct {
1423 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1424 StaticFunctionPtr m_nonzero;
1426 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1428 operator unspecified_bool_type() const {
1429 return empty()? 0: &SafeBoolStruct::m_nonzero;
1431 // necessary to allow ==0 to work despite the safe_bool idiom
1432 inline bool operator==(StaticFunctionPtr funcptr) {
1433 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1434 inline bool operator!=(StaticFunctionPtr funcptr) {
1435 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1436 inline bool operator ! () const { // Is it bound to anything?
1437 return !m_Closure; }
1438 inline bool empty() const {
1439 return !m_Closure; }
1440 void clear() { m_Closure.clear();}
1441 // Conversion to and from the DelegateMemento storage class
1442 const DelegateMemento & GetMemento() { return m_Closure; }
1443 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1445 private: // Invoker for static functions
1446 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const {
1447 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6); }
1451 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType=detail::DefaultVoid>
1452 class FastDelegate7 {
1454 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1455 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
1456 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
1457 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
1458 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
1459 ClosureType m_Closure;
1461 // Typedefs to aid generic programming
1462 typedef FastDelegate7 type;
1464 // Construction and comparison functions
1465 FastDelegate7() { clear(); }
1466 FastDelegate7(const FastDelegate7 &x) {
1467 m_Closure.CopyFrom(this, x.m_Closure); }
1468 void operator = (const FastDelegate7 &x) {
1469 m_Closure.CopyFrom(this, x.m_Closure); }
1470 bool operator ==(const FastDelegate7 &x) const {
1471 return m_Closure.IsEqual(x.m_Closure); }
1472 bool operator !=(const FastDelegate7 &x) const {
1473 return !m_Closure.IsEqual(x.m_Closure); }
1474 bool operator <(const FastDelegate7 &x) const {
1475 return m_Closure.IsLess(x.m_Closure); }
1476 bool operator >(const FastDelegate7 &x) const {
1477 return x.m_Closure.IsLess(m_Closure); }
1478 // Binding to non-const member functions
1479 template < class X, class Y >
1480 FastDelegate7(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) {
1481 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1482 template < class X, class Y >
1483 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
1484 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1485 // Binding to const member functions.
1486 template < class X, class Y >
1487 FastDelegate7(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) {
1488 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1489 template < class X, class Y >
1490 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) {
1491 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1492 // Static functions. We convert them into a member function call.
1493 // This constructor also provides implicit conversion
1494 FastDelegate7(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) {
1495 bind(function_to_bind); }
1496 // for efficiency, prevent creation of a temporary
1497 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) {
1498 bind(function_to_bind); }
1499 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
1500 m_Closure.bindstaticfunc(this, &FastDelegate7::InvokeStaticFunction,
1501 function_to_bind); }
1502 // Invoke the delegate
1503 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const {
1504 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7); }
1505 // Implicit conversion to "bool" using the safe_bool idiom
1507 typedef struct SafeBoolStruct {
1508 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1509 StaticFunctionPtr m_nonzero;
1511 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1513 operator unspecified_bool_type() const {
1514 return empty()? 0: &SafeBoolStruct::m_nonzero;
1516 // necessary to allow ==0 to work despite the safe_bool idiom
1517 inline bool operator==(StaticFunctionPtr funcptr) {
1518 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1519 inline bool operator!=(StaticFunctionPtr funcptr) {
1520 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1521 inline bool operator ! () const { // Is it bound to anything?
1522 return !m_Closure; }
1523 inline bool empty() const {
1524 return !m_Closure; }
1525 void clear() { m_Closure.clear();}
1526 // Conversion to and from the DelegateMemento storage class
1527 const DelegateMemento & GetMemento() { return m_Closure; }
1528 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1530 private: // Invoker for static functions
1531 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const {
1532 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7); }
1536 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType=detail::DefaultVoid>
1537 class FastDelegate8 {
1539 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1540 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
1541 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
1542 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
1543 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
1544 ClosureType m_Closure;
1546 // Typedefs to aid generic programming
1547 typedef FastDelegate8 type;
1549 // Construction and comparison functions
1550 FastDelegate8() { clear(); }
1551 FastDelegate8(const FastDelegate8 &x) {
1552 m_Closure.CopyFrom(this, x.m_Closure); }
1553 void operator = (const FastDelegate8 &x) {
1554 m_Closure.CopyFrom(this, x.m_Closure); }
1555 bool operator ==(const FastDelegate8 &x) const {
1556 return m_Closure.IsEqual(x.m_Closure); }
1557 bool operator !=(const FastDelegate8 &x) const {
1558 return !m_Closure.IsEqual(x.m_Closure); }
1559 bool operator <(const FastDelegate8 &x) const {
1560 return m_Closure.IsLess(x.m_Closure); }
1561 bool operator >(const FastDelegate8 &x) const {
1562 return x.m_Closure.IsLess(m_Closure); }
1563 // Binding to non-const member functions
1564 template < class X, class Y >
1565 FastDelegate8(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) {
1566 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1567 template < class X, class Y >
1568 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
1569 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1570 // Binding to const member functions.
1571 template < class X, class Y >
1572 FastDelegate8(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const) {
1573 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1574 template < class X, class Y >
1575 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const) {
1576 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1577 // Static functions. We convert them into a member function call.
1578 // This constructor also provides implicit conversion
1579 FastDelegate8(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) {
1580 bind(function_to_bind); }
1581 // for efficiency, prevent creation of a temporary
1582 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) {
1583 bind(function_to_bind); }
1584 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
1585 m_Closure.bindstaticfunc(this, &FastDelegate8::InvokeStaticFunction,
1586 function_to_bind); }
1587 // Invoke the delegate
1588 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const {
1589 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8); }
1590 // Implicit conversion to "bool" using the safe_bool idiom
1592 typedef struct SafeBoolStruct {
1593 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1594 StaticFunctionPtr m_nonzero;
1596 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1598 operator unspecified_bool_type() const {
1599 return empty()? 0: &SafeBoolStruct::m_nonzero;
1601 // necessary to allow ==0 to work despite the safe_bool idiom
1602 inline bool operator==(StaticFunctionPtr funcptr) {
1603 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1604 inline bool operator!=(StaticFunctionPtr funcptr) {
1605 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1606 inline bool operator ! () const { // Is it bound to anything?
1607 return !m_Closure; }
1608 inline bool empty() const {
1609 return !m_Closure; }
1610 void clear() { m_Closure.clear();}
1611 // Conversion to and from the DelegateMemento storage class
1612 const DelegateMemento & GetMemento() { return m_Closure; }
1613 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1615 private: // Invoker for static functions
1616 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const {
1617 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8); }
1621 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class RetType=detail::DefaultVoid>
1622 class FastDelegate9 {
1624 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1625 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9);
1626 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9);
1627 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9);
1628 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
1629 ClosureType m_Closure;
1631 // Typedefs to aid generic programming
1632 typedef FastDelegate9 type;
1634 // Construction and comparison functions
1635 FastDelegate9() { clear(); }
1636 FastDelegate9(const FastDelegate9 &x) {
1637 m_Closure.CopyFrom(this, x.m_Closure); }
1638 void operator = (const FastDelegate9 &x) {
1639 m_Closure.CopyFrom(this, x.m_Closure); }
1640 bool operator ==(const FastDelegate9 &x) const {
1641 return m_Closure.IsEqual(x.m_Closure); }
1642 bool operator !=(const FastDelegate9 &x) const {
1643 return !m_Closure.IsEqual(x.m_Closure); }
1644 bool operator <(const FastDelegate9 &x) const {
1645 return m_Closure.IsLess(x.m_Closure); }
1646 bool operator >(const FastDelegate9 &x) const {
1647 return x.m_Closure.IsLess(m_Closure); }
1648 // Binding to non-const member functions
1649 template < class X, class Y >
1650 FastDelegate9(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) ) {
1651 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1652 template < class X, class Y >
1653 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9)) {
1654 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1655 // Binding to const member functions.
1656 template < class X, class Y >
1657 FastDelegate9(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) const) {
1658 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1659 template < class X, class Y >
1660 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) const) {
1661 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1662 // Static functions. We convert them into a member function call.
1663 // This constructor also provides implicit conversion
1664 FastDelegate9(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) ) {
1665 bind(function_to_bind); }
1666 // for efficiency, prevent creation of a temporary
1667 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) ) {
1668 bind(function_to_bind); }
1669 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9)) {
1670 m_Closure.bindstaticfunc(this, &FastDelegate9::InvokeStaticFunction,
1671 function_to_bind); }
1672 // Invoke the delegate
1673 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) const {
1674 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9); }
1675 // Implicit conversion to "bool" using the safe_bool idiom
1677 typedef struct SafeBoolStruct {
1678 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1679 StaticFunctionPtr m_nonzero;
1681 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1683 operator unspecified_bool_type() const {
1684 return empty()? 0: &SafeBoolStruct::m_nonzero;
1686 // necessary to allow ==0 to work despite the safe_bool idiom
1687 inline bool operator==(StaticFunctionPtr funcptr) {
1688 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1689 inline bool operator!=(StaticFunctionPtr funcptr) {
1690 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1691 inline bool operator ! () const { // Is it bound to anything?
1692 return !m_Closure; }
1693 inline bool empty() const {
1694 return !m_Closure; }
1695 void clear() { m_Closure.clear();}
1696 // Conversion to and from the DelegateMemento storage class
1697 const DelegateMemento & GetMemento() { return m_Closure; }
1698 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1700 private: // Invoker for static functions
1701 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) const {
1702 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9); }
1706 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class RetType=detail::DefaultVoid>
1707 class FastDelegate10 {
1709 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1710 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10);
1711 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10);
1712 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10);
1713 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
1714 ClosureType m_Closure;
1716 // Typedefs to aid generic programming
1717 typedef FastDelegate10 type;
1719 // Construction and comparison functions
1720 FastDelegate10() { clear(); }
1721 FastDelegate10(const FastDelegate10 &x) {
1722 m_Closure.CopyFrom(this, x.m_Closure); }
1723 void operator = (const FastDelegate10 &x) {
1724 m_Closure.CopyFrom(this, x.m_Closure); }
1725 bool operator ==(const FastDelegate10 &x) const {
1726 return m_Closure.IsEqual(x.m_Closure); }
1727 bool operator !=(const FastDelegate10 &x) const {
1728 return !m_Closure.IsEqual(x.m_Closure); }
1729 bool operator <(const FastDelegate10 &x) const {
1730 return m_Closure.IsLess(x.m_Closure); }
1731 bool operator >(const FastDelegate10 &x) const {
1732 return x.m_Closure.IsLess(m_Closure); }
1733 // Binding to non-const member functions
1734 template < class X, class Y >
1735 FastDelegate10(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10) ) {
1736 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1737 template < class X, class Y >
1738 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10)) {
1739 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1740 // Binding to const member functions.
1741 template < class X, class Y >
1742 FastDelegate10(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10) const) {
1743 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1744 template < class X, class Y >
1745 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10) const) {
1746 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1747 // Static functions. We convert them into a member function call.
1748 // This constructor also provides implicit conversion
1749 FastDelegate10(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10) ) {
1750 bind(function_to_bind); }
1751 // for efficiency, prevent creation of a temporary
1752 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10) ) {
1753 bind(function_to_bind); }
1754 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10)) {
1755 m_Closure.bindstaticfunc(this, &FastDelegate10::InvokeStaticFunction,
1756 function_to_bind); }
1757 // Invoke the delegate
1758 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10) const {
1759 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); }
1760 // Implicit conversion to "bool" using the safe_bool idiom
1762 typedef struct SafeBoolStruct {
1763 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1764 StaticFunctionPtr m_nonzero;
1766 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1768 operator unspecified_bool_type() const {
1769 return empty()? 0: &SafeBoolStruct::m_nonzero;
1771 // necessary to allow ==0 to work despite the safe_bool idiom
1772 inline bool operator==(StaticFunctionPtr funcptr) {
1773 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1774 inline bool operator!=(StaticFunctionPtr funcptr) {
1775 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1776 inline bool operator ! () const { // Is it bound to anything?
1777 return !m_Closure; }
1778 inline bool empty() const {
1779 return !m_Closure; }
1780 void clear() { m_Closure.clear();}
1781 // Conversion to and from the DelegateMemento storage class
1782 const DelegateMemento & GetMemento() { return m_Closure; }
1783 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1785 private: // Invoker for static functions
1786 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10) const {
1787 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); }
1791 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class RetType=detail::DefaultVoid>
1792 class FastDelegate11 {
1794 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1795 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11);
1796 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11);
1797 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11);
1798 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
1799 ClosureType m_Closure;
1801 // Typedefs to aid generic programming
1802 typedef FastDelegate11 type;
1804 // Construction and comparison functions
1805 FastDelegate11() { clear(); }
1806 FastDelegate11(const FastDelegate11 &x) {
1807 m_Closure.CopyFrom(this, x.m_Closure); }
1808 void operator = (const FastDelegate11 &x) {
1809 m_Closure.CopyFrom(this, x.m_Closure); }
1810 bool operator ==(const FastDelegate11 &x) const {
1811 return m_Closure.IsEqual(x.m_Closure); }
1812 bool operator !=(const FastDelegate11 &x) const {
1813 return !m_Closure.IsEqual(x.m_Closure); }
1814 bool operator <(const FastDelegate11 &x) const {
1815 return m_Closure.IsLess(x.m_Closure); }
1816 bool operator >(const FastDelegate11 &x) const {
1817 return x.m_Closure.IsLess(m_Closure); }
1818 // Binding to non-const member functions
1819 template < class X, class Y >
1820 FastDelegate11(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11) ) {
1821 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1822 template < class X, class Y >
1823 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11)) {
1824 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1825 // Binding to const member functions.
1826 template < class X, class Y >
1827 FastDelegate11(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11) const) {
1828 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1829 template < class X, class Y >
1830 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11) const) {
1831 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1832 // Static functions. We convert them into a member function call.
1833 // This constructor also provides implicit conversion
1834 FastDelegate11(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11) ) {
1835 bind(function_to_bind); }
1836 // for efficiency, prevent creation of a temporary
1837 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11) ) {
1838 bind(function_to_bind); }
1839 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11)) {
1840 m_Closure.bindstaticfunc(this, &FastDelegate11::InvokeStaticFunction,
1841 function_to_bind); }
1842 // Invoke the delegate
1843 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11) const {
1844 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); }
1845 // Implicit conversion to "bool" using the safe_bool idiom
1847 typedef struct SafeBoolStruct {
1848 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1849 StaticFunctionPtr m_nonzero;
1851 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1853 operator unspecified_bool_type() const {
1854 return empty()? 0: &SafeBoolStruct::m_nonzero;
1856 // necessary to allow ==0 to work despite the safe_bool idiom
1857 inline bool operator==(StaticFunctionPtr funcptr) {
1858 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1859 inline bool operator!=(StaticFunctionPtr funcptr) {
1860 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1861 inline bool operator ! () const { // Is it bound to anything?
1862 return !m_Closure; }
1863 inline bool empty() const {
1864 return !m_Closure; }
1865 void clear() { m_Closure.clear();}
1866 // Conversion to and from the DelegateMemento storage class
1867 const DelegateMemento & GetMemento() { return m_Closure; }
1868 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1870 private: // Invoker for static functions
1871 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11) const {
1872 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); }
1876 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class RetType=detail::DefaultVoid>
1877 class FastDelegate12 {
1879 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1880 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12);
1881 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12);
1882 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12);
1883 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
1884 ClosureType m_Closure;
1886 // Typedefs to aid generic programming
1887 typedef FastDelegate12 type;
1889 // Construction and comparison functions
1890 FastDelegate12() { clear(); }
1891 FastDelegate12(const FastDelegate12 &x) {
1892 m_Closure.CopyFrom(this, x.m_Closure); }
1893 void operator = (const FastDelegate12 &x) {
1894 m_Closure.CopyFrom(this, x.m_Closure); }
1895 bool operator ==(const FastDelegate12 &x) const {
1896 return m_Closure.IsEqual(x.m_Closure); }
1897 bool operator !=(const FastDelegate12 &x) const {
1898 return !m_Closure.IsEqual(x.m_Closure); }
1899 bool operator <(const FastDelegate12 &x) const {
1900 return m_Closure.IsLess(x.m_Closure); }
1901 bool operator >(const FastDelegate12 &x) const {
1902 return x.m_Closure.IsLess(m_Closure); }
1903 // Binding to non-const member functions
1904 template < class X, class Y >
1905 FastDelegate12(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12) ) {
1906 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1907 template < class X, class Y >
1908 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12)) {
1909 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1910 // Binding to const member functions.
1911 template < class X, class Y >
1912 FastDelegate12(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12) const) {
1913 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1914 template < class X, class Y >
1915 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12) const) {
1916 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1917 // Static functions. We convert them into a member function call.
1918 // This constructor also provides implicit conversion
1919 FastDelegate12(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12) ) {
1920 bind(function_to_bind); }
1921 // for efficiency, prevent creation of a temporary
1922 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12) ) {
1923 bind(function_to_bind); }
1924 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12)) {
1925 m_Closure.bindstaticfunc(this, &FastDelegate12::InvokeStaticFunction,
1926 function_to_bind); }
1927 // Invoke the delegate
1928 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12) const {
1929 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); }
1930 // Implicit conversion to "bool" using the safe_bool idiom
1932 typedef struct SafeBoolStruct {
1933 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1934 StaticFunctionPtr m_nonzero;
1936 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1938 operator unspecified_bool_type() const {
1939 return empty()? 0: &SafeBoolStruct::m_nonzero;
1941 // necessary to allow ==0 to work despite the safe_bool idiom
1942 inline bool operator==(StaticFunctionPtr funcptr) {
1943 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1944 inline bool operator!=(StaticFunctionPtr funcptr) {
1945 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1946 inline bool operator ! () const { // Is it bound to anything?
1947 return !m_Closure; }
1948 inline bool empty() const {
1949 return !m_Closure; }
1950 void clear() { m_Closure.clear();}
1951 // Conversion to and from the DelegateMemento storage class
1952 const DelegateMemento & GetMemento() { return m_Closure; }
1953 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1955 private: // Invoker for static functions
1956 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12) const {
1957 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); }
1961 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class RetType=detail::DefaultVoid>
1962 class FastDelegate13 {
1964 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1965 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13);
1966 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13);
1967 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13);
1968 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
1969 ClosureType m_Closure;
1971 // Typedefs to aid generic programming
1972 typedef FastDelegate13 type;
1974 // Construction and comparison functions
1975 FastDelegate13() { clear(); }
1976 FastDelegate13(const FastDelegate13 &x) {
1977 m_Closure.CopyFrom(this, x.m_Closure); }
1978 void operator = (const FastDelegate13 &x) {
1979 m_Closure.CopyFrom(this, x.m_Closure); }
1980 bool operator ==(const FastDelegate13 &x) const {
1981 return m_Closure.IsEqual(x.m_Closure); }
1982 bool operator !=(const FastDelegate13 &x) const {
1983 return !m_Closure.IsEqual(x.m_Closure); }
1984 bool operator <(const FastDelegate13 &x) const {
1985 return m_Closure.IsLess(x.m_Closure); }
1986 bool operator >(const FastDelegate13 &x) const {
1987 return x.m_Closure.IsLess(m_Closure); }
1988 // Binding to non-const member functions
1989 template < class X, class Y >
1990 FastDelegate13(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13) ) {
1991 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1992 template < class X, class Y >
1993 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13)) {
1994 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1995 // Binding to const member functions.
1996 template < class X, class Y >
1997 FastDelegate13(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13) const) {
1998 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1999 template < class X, class Y >
2000 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13) const) {
2001 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
2002 // Static functions. We convert them into a member function call.
2003 // This constructor also provides implicit conversion
2004 FastDelegate13(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13) ) {
2005 bind(function_to_bind); }
2006 // for efficiency, prevent creation of a temporary
2007 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13) ) {
2008 bind(function_to_bind); }
2009 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13)) {
2010 m_Closure.bindstaticfunc(this, &FastDelegate13::InvokeStaticFunction,
2011 function_to_bind); }
2012 // Invoke the delegate
2013 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13) const {
2014 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); }
2015 // Implicit conversion to "bool" using the safe_bool idiom
2017 typedef struct SafeBoolStruct {
2018 int a_data_pointer_to_this_is_0_on_buggy_compilers;
2019 StaticFunctionPtr m_nonzero;
2021 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
2023 operator unspecified_bool_type() const {
2024 return empty()? 0: &SafeBoolStruct::m_nonzero;
2026 // necessary to allow ==0 to work despite the safe_bool idiom
2027 inline bool operator==(StaticFunctionPtr funcptr) {
2028 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2029 inline bool operator!=(StaticFunctionPtr funcptr) {
2030 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2031 inline bool operator ! () const { // Is it bound to anything?
2032 return !m_Closure; }
2033 inline bool empty() const {
2034 return !m_Closure; }
2035 void clear() { m_Closure.clear();}
2036 // Conversion to and from the DelegateMemento storage class
2037 const DelegateMemento & GetMemento() { return m_Closure; }
2038 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
2040 private: // Invoker for static functions
2041 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13) const {
2042 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); }
2046 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class RetType=detail::DefaultVoid>
2047 class FastDelegate14 {
2049 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
2050 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14);
2051 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14);
2052 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14);
2053 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
2054 ClosureType m_Closure;
2056 // Typedefs to aid generic programming
2057 typedef FastDelegate14 type;
2059 // Construction and comparison functions
2060 FastDelegate14() { clear(); }
2061 FastDelegate14(const FastDelegate14 &x) {
2062 m_Closure.CopyFrom(this, x.m_Closure); }
2063 void operator = (const FastDelegate14 &x) {
2064 m_Closure.CopyFrom(this, x.m_Closure); }
2065 bool operator ==(const FastDelegate14 &x) const {
2066 return m_Closure.IsEqual(x.m_Closure); }
2067 bool operator !=(const FastDelegate14 &x) const {
2068 return !m_Closure.IsEqual(x.m_Closure); }
2069 bool operator <(const FastDelegate14 &x) const {
2070 return m_Closure.IsLess(x.m_Closure); }
2071 bool operator >(const FastDelegate14 &x) const {
2072 return x.m_Closure.IsLess(m_Closure); }
2073 // Binding to non-const member functions
2074 template < class X, class Y >
2075 FastDelegate14(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14) ) {
2076 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2077 template < class X, class Y >
2078 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14)) {
2079 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2080 // Binding to const member functions.
2081 template < class X, class Y >
2082 FastDelegate14(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14) const) {
2083 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
2084 template < class X, class Y >
2085 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14) const) {
2086 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
2087 // Static functions. We convert them into a member function call.
2088 // This constructor also provides implicit conversion
2089 FastDelegate14(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14) ) {
2090 bind(function_to_bind); }
2091 // for efficiency, prevent creation of a temporary
2092 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14) ) {
2093 bind(function_to_bind); }
2094 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14)) {
2095 m_Closure.bindstaticfunc(this, &FastDelegate14::InvokeStaticFunction,
2096 function_to_bind); }
2097 // Invoke the delegate
2098 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14) const {
2099 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); }
2100 // Implicit conversion to "bool" using the safe_bool idiom
2102 typedef struct SafeBoolStruct {
2103 int a_data_pointer_to_this_is_0_on_buggy_compilers;
2104 StaticFunctionPtr m_nonzero;
2106 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
2108 operator unspecified_bool_type() const {
2109 return empty()? 0: &SafeBoolStruct::m_nonzero;
2111 // necessary to allow ==0 to work despite the safe_bool idiom
2112 inline bool operator==(StaticFunctionPtr funcptr) {
2113 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2114 inline bool operator!=(StaticFunctionPtr funcptr) {
2115 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2116 inline bool operator ! () const { // Is it bound to anything?
2117 return !m_Closure; }
2118 inline bool empty() const {
2119 return !m_Closure; }
2120 void clear() { m_Closure.clear();}
2121 // Conversion to and from the DelegateMemento storage class
2122 const DelegateMemento & GetMemento() { return m_Closure; }
2123 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
2125 private: // Invoker for static functions
2126 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14) const {
2127 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); }
2131 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class RetType=detail::DefaultVoid>
2132 class FastDelegate15 {
2134 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
2135 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15);
2136 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15);
2137 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15);
2138 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
2139 ClosureType m_Closure;
2141 // Typedefs to aid generic programming
2142 typedef FastDelegate15 type;
2144 // Construction and comparison functions
2145 FastDelegate15() { clear(); }
2146 FastDelegate15(const FastDelegate15 &x) {
2147 m_Closure.CopyFrom(this, x.m_Closure); }
2148 void operator = (const FastDelegate15 &x) {
2149 m_Closure.CopyFrom(this, x.m_Closure); }
2150 bool operator ==(const FastDelegate15 &x) const {
2151 return m_Closure.IsEqual(x.m_Closure); }
2152 bool operator !=(const FastDelegate15 &x) const {
2153 return !m_Closure.IsEqual(x.m_Closure); }
2154 bool operator <(const FastDelegate15 &x) const {
2155 return m_Closure.IsLess(x.m_Closure); }
2156 bool operator >(const FastDelegate15 &x) const {
2157 return x.m_Closure.IsLess(m_Closure); }
2158 // Binding to non-const member functions
2159 template < class X, class Y >
2160 FastDelegate15(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15) ) {
2161 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2162 template < class X, class Y >
2163 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15)) {
2164 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2165 // Binding to const member functions.
2166 template < class X, class Y >
2167 FastDelegate15(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15) const) {
2168 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
2169 template < class X, class Y >
2170 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15) const) {
2171 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
2172 // Static functions. We convert them into a member function call.
2173 // This constructor also provides implicit conversion
2174 FastDelegate15(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15) ) {
2175 bind(function_to_bind); }
2176 // for efficiency, prevent creation of a temporary
2177 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15) ) {
2178 bind(function_to_bind); }
2179 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15)) {
2180 m_Closure.bindstaticfunc(this, &FastDelegate15::InvokeStaticFunction,
2181 function_to_bind); }
2182 // Invoke the delegate
2183 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15) const {
2184 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); }
2185 // Implicit conversion to "bool" using the safe_bool idiom
2187 typedef struct SafeBoolStruct {
2188 int a_data_pointer_to_this_is_0_on_buggy_compilers;
2189 StaticFunctionPtr m_nonzero;
2191 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
2193 operator unspecified_bool_type() const {
2194 return empty()? 0: &SafeBoolStruct::m_nonzero;
2196 // necessary to allow ==0 to work despite the safe_bool idiom
2197 inline bool operator==(StaticFunctionPtr funcptr) {
2198 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2199 inline bool operator!=(StaticFunctionPtr funcptr) {
2200 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2201 inline bool operator ! () const { // Is it bound to anything?
2202 return !m_Closure; }
2203 inline bool empty() const {
2204 return !m_Closure; }
2205 void clear() { m_Closure.clear();}
2206 // Conversion to and from the DelegateMemento storage class
2207 const DelegateMemento & GetMemento() { return m_Closure; }
2208 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
2210 private: // Invoker for static functions
2211 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15) const {
2212 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); }
2216 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class RetType=detail::DefaultVoid>
2217 class FastDelegate16 {
2219 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
2220 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16);
2221 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16);
2222 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16);
2223 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
2224 ClosureType m_Closure;
2226 // Typedefs to aid generic programming
2227 typedef FastDelegate16 type;
2229 // Construction and comparison functions
2230 FastDelegate16() { clear(); }
2231 FastDelegate16(const FastDelegate16 &x) {
2232 m_Closure.CopyFrom(this, x.m_Closure); }
2233 void operator = (const FastDelegate16 &x) {
2234 m_Closure.CopyFrom(this, x.m_Closure); }
2235 bool operator ==(const FastDelegate16 &x) const {
2236 return m_Closure.IsEqual(x.m_Closure); }
2237 bool operator !=(const FastDelegate16 &x) const {
2238 return !m_Closure.IsEqual(x.m_Closure); }
2239 bool operator <(const FastDelegate16 &x) const {
2240 return m_Closure.IsLess(x.m_Closure); }
2241 bool operator >(const FastDelegate16 &x) const {
2242 return x.m_Closure.IsLess(m_Closure); }
2243 // Binding to non-const member functions
2244 template < class X, class Y >
2245 FastDelegate16(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16) ) {
2246 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2247 template < class X, class Y >
2248 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16)) {
2249 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2250 // Binding to const member functions.
2251 template < class X, class Y >
2252 FastDelegate16(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16) const) {
2253 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
2254 template < class X, class Y >
2255 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16) const) {
2256 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
2257 // Static functions. We convert them into a member function call.
2258 // This constructor also provides implicit conversion
2259 FastDelegate16(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16) ) {
2260 bind(function_to_bind); }
2261 // for efficiency, prevent creation of a temporary
2262 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16) ) {
2263 bind(function_to_bind); }
2264 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16)) {
2265 m_Closure.bindstaticfunc(this, &FastDelegate16::InvokeStaticFunction,
2266 function_to_bind); }
2267 // Invoke the delegate
2268 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16) const {
2269 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16); }
2270 // Implicit conversion to "bool" using the safe_bool idiom
2272 typedef struct SafeBoolStruct {
2273 int a_data_pointer_to_this_is_0_on_buggy_compilers;
2274 StaticFunctionPtr m_nonzero;
2276 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
2278 operator unspecified_bool_type() const {
2279 return empty()? 0: &SafeBoolStruct::m_nonzero;
2281 // necessary to allow ==0 to work despite the safe_bool idiom
2282 inline bool operator==(StaticFunctionPtr funcptr) {
2283 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2284 inline bool operator!=(StaticFunctionPtr funcptr) {
2285 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2286 inline bool operator ! () const { // Is it bound to anything?
2287 return !m_Closure; }
2288 inline bool empty() const {
2289 return !m_Closure; }
2290 void clear() { m_Closure.clear();}
2291 // Conversion to and from the DelegateMemento storage class
2292 const DelegateMemento & GetMemento() { return m_Closure; }
2293 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
2295 private: // Invoker for static functions
2296 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16) const {
2297 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16); }
2301 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class RetType=detail::DefaultVoid>
2302 class FastDelegate17 {
2304 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
2305 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17);
2306 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17);
2307 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17);
2308 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
2309 ClosureType m_Closure;
2311 // Typedefs to aid generic programming
2312 typedef FastDelegate17 type;
2314 // Construction and comparison functions
2315 FastDelegate17() { clear(); }
2316 FastDelegate17(const FastDelegate17 &x) {
2317 m_Closure.CopyFrom(this, x.m_Closure); }
2318 void operator = (const FastDelegate17 &x) {
2319 m_Closure.CopyFrom(this, x.m_Closure); }
2320 bool operator ==(const FastDelegate17 &x) const {
2321 return m_Closure.IsEqual(x.m_Closure); }
2322 bool operator !=(const FastDelegate17 &x) const {
2323 return !m_Closure.IsEqual(x.m_Closure); }
2324 bool operator <(const FastDelegate17 &x) const {
2325 return m_Closure.IsLess(x.m_Closure); }
2326 bool operator >(const FastDelegate17 &x) const {
2327 return x.m_Closure.IsLess(m_Closure); }
2328 // Binding to non-const member functions
2329 template < class X, class Y >
2330 FastDelegate17(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17) ) {
2331 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2332 template < class X, class Y >
2333 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17)) {
2334 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2335 // Binding to const member functions.
2336 template < class X, class Y >
2337 FastDelegate17(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17) const) {
2338 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
2339 template < class X, class Y >
2340 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17) const) {
2341 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
2342 // Static functions. We convert them into a member function call.
2343 // This constructor also provides implicit conversion
2344 FastDelegate17(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17) ) {
2345 bind(function_to_bind); }
2346 // for efficiency, prevent creation of a temporary
2347 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17) ) {
2348 bind(function_to_bind); }
2349 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17)) {
2350 m_Closure.bindstaticfunc(this, &FastDelegate17::InvokeStaticFunction,
2351 function_to_bind); }
2352 // Invoke the delegate
2353 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17) const {
2354 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17); }
2355 // Implicit conversion to "bool" using the safe_bool idiom
2357 typedef struct SafeBoolStruct {
2358 int a_data_pointer_to_this_is_0_on_buggy_compilers;
2359 StaticFunctionPtr m_nonzero;
2361 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
2363 operator unspecified_bool_type() const {
2364 return empty()? 0: &SafeBoolStruct::m_nonzero;
2366 // necessary to allow ==0 to work despite the safe_bool idiom
2367 inline bool operator==(StaticFunctionPtr funcptr) {
2368 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2369 inline bool operator!=(StaticFunctionPtr funcptr) {
2370 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2371 inline bool operator ! () const { // Is it bound to anything?
2372 return !m_Closure; }
2373 inline bool empty() const {
2374 return !m_Closure; }
2375 void clear() { m_Closure.clear();}
2376 // Conversion to and from the DelegateMemento storage class
2377 const DelegateMemento & GetMemento() { return m_Closure; }
2378 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
2380 private: // Invoker for static functions
2381 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17) const {
2382 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17); }
2386 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class RetType=detail::DefaultVoid>
2387 class FastDelegate18 {
2389 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
2390 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18);
2391 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18);
2392 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18);
2393 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
2394 ClosureType m_Closure;
2396 // Typedefs to aid generic programming
2397 typedef FastDelegate18 type;
2399 // Construction and comparison functions
2400 FastDelegate18() { clear(); }
2401 FastDelegate18(const FastDelegate18 &x) {
2402 m_Closure.CopyFrom(this, x.m_Closure); }
2403 void operator = (const FastDelegate18 &x) {
2404 m_Closure.CopyFrom(this, x.m_Closure); }
2405 bool operator ==(const FastDelegate18 &x) const {
2406 return m_Closure.IsEqual(x.m_Closure); }
2407 bool operator !=(const FastDelegate18 &x) const {
2408 return !m_Closure.IsEqual(x.m_Closure); }
2409 bool operator <(const FastDelegate18 &x) const {
2410 return m_Closure.IsLess(x.m_Closure); }
2411 bool operator >(const FastDelegate18 &x) const {
2412 return x.m_Closure.IsLess(m_Closure); }
2413 // Binding to non-const member functions
2414 template < class X, class Y >
2415 FastDelegate18(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18) ) {
2416 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2417 template < class X, class Y >
2418 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18)) {
2419 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2420 // Binding to const member functions.
2421 template < class X, class Y >
2422 FastDelegate18(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18) const) {
2423 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
2424 template < class X, class Y >
2425 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18) const) {
2426 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
2427 // Static functions. We convert them into a member function call.
2428 // This constructor also provides implicit conversion
2429 FastDelegate18(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18) ) {
2430 bind(function_to_bind); }
2431 // for efficiency, prevent creation of a temporary
2432 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18) ) {
2433 bind(function_to_bind); }
2434 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18)) {
2435 m_Closure.bindstaticfunc(this, &FastDelegate18::InvokeStaticFunction,
2436 function_to_bind); }
2437 // Invoke the delegate
2438 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18) const {
2439 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18); }
2440 // Implicit conversion to "bool" using the safe_bool idiom
2442 typedef struct SafeBoolStruct {
2443 int a_data_pointer_to_this_is_0_on_buggy_compilers;
2444 StaticFunctionPtr m_nonzero;
2446 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
2448 operator unspecified_bool_type() const {
2449 return empty()? 0: &SafeBoolStruct::m_nonzero;
2451 // necessary to allow ==0 to work despite the safe_bool idiom
2452 inline bool operator==(StaticFunctionPtr funcptr) {
2453 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2454 inline bool operator!=(StaticFunctionPtr funcptr) {
2455 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2456 inline bool operator ! () const { // Is it bound to anything?
2457 return !m_Closure; }
2458 inline bool empty() const {
2459 return !m_Closure; }
2460 void clear() { m_Closure.clear();}
2461 // Conversion to and from the DelegateMemento storage class
2462 const DelegateMemento & GetMemento() { return m_Closure; }
2463 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
2465 private: // Invoker for static functions
2466 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18) const {
2467 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18); }
2471 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19, class RetType=detail::DefaultVoid>
2472 class FastDelegate19 {
2474 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
2475 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19);
2476 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19);
2477 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19);
2478 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
2479 ClosureType m_Closure;
2481 // Typedefs to aid generic programming
2482 typedef FastDelegate19 type;
2484 // Construction and comparison functions
2485 FastDelegate19() { clear(); }
2486 FastDelegate19(const FastDelegate19 &x) {
2487 m_Closure.CopyFrom(this, x.m_Closure); }
2488 void operator = (const FastDelegate19 &x) {
2489 m_Closure.CopyFrom(this, x.m_Closure); }
2490 bool operator ==(const FastDelegate19 &x) const {
2491 return m_Closure.IsEqual(x.m_Closure); }
2492 bool operator !=(const FastDelegate19 &x) const {
2493 return !m_Closure.IsEqual(x.m_Closure); }
2494 bool operator <(const FastDelegate19 &x) const {
2495 return m_Closure.IsLess(x.m_Closure); }
2496 bool operator >(const FastDelegate19 &x) const {
2497 return x.m_Closure.IsLess(m_Closure); }
2498 // Binding to non-const member functions
2499 template < class X, class Y >
2500 FastDelegate19(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19) ) {
2501 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2502 template < class X, class Y >
2503 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19)) {
2504 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2505 // Binding to const member functions.
2506 template < class X, class Y >
2507 FastDelegate19(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19) const) {
2508 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
2509 template < class X, class Y >
2510 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19) const) {
2511 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
2512 // Static functions. We convert them into a member function call.
2513 // This constructor also provides implicit conversion
2514 FastDelegate19(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19) ) {
2515 bind(function_to_bind); }
2516 // for efficiency, prevent creation of a temporary
2517 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19) ) {
2518 bind(function_to_bind); }
2519 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19)) {
2520 m_Closure.bindstaticfunc(this, &FastDelegate19::InvokeStaticFunction,
2521 function_to_bind); }
2522 // Invoke the delegate
2523 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19) const {
2524 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19); }
2525 // Implicit conversion to "bool" using the safe_bool idiom
2527 typedef struct SafeBoolStruct {
2528 int a_data_pointer_to_this_is_0_on_buggy_compilers;
2529 StaticFunctionPtr m_nonzero;
2531 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
2533 operator unspecified_bool_type() const {
2534 return empty()? 0: &SafeBoolStruct::m_nonzero;
2536 // necessary to allow ==0 to work despite the safe_bool idiom
2537 inline bool operator==(StaticFunctionPtr funcptr) {
2538 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2539 inline bool operator!=(StaticFunctionPtr funcptr) {
2540 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2541 inline bool operator ! () const { // Is it bound to anything?
2542 return !m_Closure; }
2543 inline bool empty() const {
2544 return !m_Closure; }
2545 void clear() { m_Closure.clear();}
2546 // Conversion to and from the DelegateMemento storage class
2547 const DelegateMemento & GetMemento() { return m_Closure; }
2548 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
2550 private: // Invoker for static functions
2551 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19) const {
2552 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19); }
2556 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19, class Param20, class RetType=detail::DefaultVoid>
2557 class FastDelegate20 {
2559 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
2560 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20);
2561 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20);
2562 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20);
2563 typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
2564 ClosureType m_Closure;
2566 // Typedefs to aid generic programming
2567 typedef FastDelegate20 type;
2569 // Construction and comparison functions
2570 FastDelegate20() { clear(); }
2571 FastDelegate20(const FastDelegate20 &x) {
2572 m_Closure.CopyFrom(this, x.m_Closure); }
2573 void operator = (const FastDelegate20 &x) {
2574 m_Closure.CopyFrom(this, x.m_Closure); }
2575 bool operator ==(const FastDelegate20 &x) const {
2576 return m_Closure.IsEqual(x.m_Closure); }
2577 bool operator !=(const FastDelegate20 &x) const {
2578 return !m_Closure.IsEqual(x.m_Closure); }
2579 bool operator <(const FastDelegate20 &x) const {
2580 return m_Closure.IsLess(x.m_Closure); }
2581 bool operator >(const FastDelegate20 &x) const {
2582 return x.m_Closure.IsLess(m_Closure); }
2583 // Binding to non-const member functions
2584 template < class X, class Y >
2585 FastDelegate20(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20) ) {
2586 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2587 template < class X, class Y >
2588 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20)) {
2589 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
2590 // Binding to const member functions.
2591 template < class X, class Y >
2592 FastDelegate20(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20) const) {
2593 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
2594 template < class X, class Y >
2595 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20) const) {
2596 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
2597 // Static functions. We convert them into a member function call.
2598 // This constructor also provides implicit conversion
2599 FastDelegate20(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20) ) {
2600 bind(function_to_bind); }
2601 // for efficiency, prevent creation of a temporary
2602 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20) ) {
2603 bind(function_to_bind); }
2604 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20)) {
2605 m_Closure.bindstaticfunc(this, &FastDelegate20::InvokeStaticFunction,
2606 function_to_bind); }
2607 // Invoke the delegate
2608 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20) const {
2609 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20); }
2610 // Implicit conversion to "bool" using the safe_bool idiom
2612 typedef struct SafeBoolStruct {
2613 int a_data_pointer_to_this_is_0_on_buggy_compilers;
2614 StaticFunctionPtr m_nonzero;
2616 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
2618 operator unspecified_bool_type() const {
2619 return empty()? 0: &SafeBoolStruct::m_nonzero;
2621 // necessary to allow ==0 to work despite the safe_bool idiom
2622 inline bool operator==(StaticFunctionPtr funcptr) {
2623 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2624 inline bool operator!=(StaticFunctionPtr funcptr) {
2625 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
2626 inline bool operator ! () const { // Is it bound to anything?
2627 return !m_Closure; }
2628 inline bool empty() const {
2629 return !m_Closure; }
2630 void clear() { m_Closure.clear();}
2631 // Conversion to and from the DelegateMemento storage class
2632 const DelegateMemento & GetMemento() { return m_Closure; }
2633 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
2635 private: // Invoker for static functions
2636 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20) const {
2637 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20); }
2641 ////////////////////////////////////////////////////////////////////////////////
2642 // Fast Delegates, part 4:
2644 // FastDelegate<> class (Original author: Jody Hagins)
2645 // Allows boost::function style syntax like:
2646 // FastDelegate< double (int, long) >
2648 // FastDelegate2< int, long, double >
2650 ////////////////////////////////////////////////////////////////////////////////
2652 #ifdef FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
2654 // Declare FastDelegate as a class template. It will be specialized
2655 // later for all number of arguments.
2656 template <typename Signature>
2660 // Specialization to allow use of
2661 // FastDelegate< R ( ) >
2663 // FastDelegate0 < R >
2664 template<typename R>
2665 class FastDelegate< R ( ) >
2666 // Inherit from FastDelegate0 so that it can be treated just like a FastDelegate0
2667 : public FastDelegate0 < R >
2670 // Make using the base type a bit easier via typedef.
2671 typedef FastDelegate0 < R > BaseType;
2673 // Allow users access to the specific type of this delegate.
2674 typedef FastDelegate SelfType;
2676 // Mimic the base class constructors.
2677 FastDelegate() : BaseType() { }
2679 template < class X, class Y >
2680 FastDelegate(Y * pthis,
2681 R (X::* function_to_bind)( ))
2682 : BaseType(pthis, function_to_bind) { }
2684 template < class X, class Y >
2685 FastDelegate(const Y *pthis,
2686 R (X::* function_to_bind)( ) const)
2687 : BaseType(pthis, function_to_bind)
2690 FastDelegate(R (*function_to_bind)( ))
2691 : BaseType(function_to_bind) { }
2692 void operator = (const BaseType &x) {
2693 *static_cast<BaseType*>(this) = x; }
2697 // Specialization to allow use of
2698 // FastDelegate< R ( Param1 ) >
2700 // FastDelegate1 < Param1, R >
2701 template<typename R, class Param1>
2702 class FastDelegate< R ( Param1 ) >
2703 // Inherit from FastDelegate1 so that it can be treated just like a FastDelegate1
2704 : public FastDelegate1 < Param1, R >
2707 // Make using the base type a bit easier via typedef.
2708 typedef FastDelegate1 < Param1, R > BaseType;
2710 // Allow users access to the specific type of this delegate.
2711 typedef FastDelegate SelfType;
2713 // Mimic the base class constructors.
2714 FastDelegate() : BaseType() { }
2716 template < class X, class Y >
2717 FastDelegate(Y * pthis,
2718 R (X::* function_to_bind)( Param1 p1 ))
2719 : BaseType(pthis, function_to_bind) { }
2721 template < class X, class Y >
2722 FastDelegate(const Y *pthis,
2723 R (X::* function_to_bind)( Param1 p1 ) const)
2724 : BaseType(pthis, function_to_bind)
2727 FastDelegate(R (*function_to_bind)( Param1 p1 ))
2728 : BaseType(function_to_bind) { }
2729 void operator = (const BaseType &x) {
2730 *static_cast<BaseType*>(this) = x; }
2734 // Specialization to allow use of
2735 // FastDelegate< R ( Param1, Param2 ) >
2737 // FastDelegate2 < Param1, Param2, R >
2738 template<typename R, class Param1, class Param2>
2739 class FastDelegate< R ( Param1, Param2 ) >
2740 // Inherit from FastDelegate2 so that it can be treated just like a FastDelegate2
2741 : public FastDelegate2 < Param1, Param2, R >
2744 // Make using the base type a bit easier via typedef.
2745 typedef FastDelegate2 < Param1, Param2, R > BaseType;
2747 // Allow users access to the specific type of this delegate.
2748 typedef FastDelegate SelfType;
2750 // Mimic the base class constructors.
2751 FastDelegate() : BaseType() { }
2753 template < class X, class Y >
2754 FastDelegate(Y * pthis,
2755 R (X::* function_to_bind)( Param1 p1, Param2 p2 ))
2756 : BaseType(pthis, function_to_bind) { }
2758 template < class X, class Y >
2759 FastDelegate(const Y *pthis,
2760 R (X::* function_to_bind)( Param1 p1, Param2 p2 ) const)
2761 : BaseType(pthis, function_to_bind)
2764 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2 ))
2765 : BaseType(function_to_bind) { }
2766 void operator = (const BaseType &x) {
2767 *static_cast<BaseType*>(this) = x; }
2771 // Specialization to allow use of
2772 // FastDelegate< R ( Param1, Param2, Param3 ) >
2774 // FastDelegate3 < Param1, Param2, Param3, R >
2775 template<typename R, class Param1, class Param2, class Param3>
2776 class FastDelegate< R ( Param1, Param2, Param3 ) >
2777 // Inherit from FastDelegate3 so that it can be treated just like a FastDelegate3
2778 : public FastDelegate3 < Param1, Param2, Param3, R >
2781 // Make using the base type a bit easier via typedef.
2782 typedef FastDelegate3 < Param1, Param2, Param3, R > BaseType;
2784 // Allow users access to the specific type of this delegate.
2785 typedef FastDelegate SelfType;
2787 // Mimic the base class constructors.
2788 FastDelegate() : BaseType() { }
2790 template < class X, class Y >
2791 FastDelegate(Y * pthis,
2792 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ))
2793 : BaseType(pthis, function_to_bind) { }
2795 template < class X, class Y >
2796 FastDelegate(const Y *pthis,
2797 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ) const)
2798 : BaseType(pthis, function_to_bind)
2801 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ))
2802 : BaseType(function_to_bind) { }
2803 void operator = (const BaseType &x) {
2804 *static_cast<BaseType*>(this) = x; }
2808 // Specialization to allow use of
2809 // FastDelegate< R ( Param1, Param2, Param3, Param4 ) >
2811 // FastDelegate4 < Param1, Param2, Param3, Param4, R >
2812 template<typename R, class Param1, class Param2, class Param3, class Param4>
2813 class FastDelegate< R ( Param1, Param2, Param3, Param4 ) >
2814 // Inherit from FastDelegate4 so that it can be treated just like a FastDelegate4
2815 : public FastDelegate4 < Param1, Param2, Param3, Param4, R >
2818 // Make using the base type a bit easier via typedef.
2819 typedef FastDelegate4 < Param1, Param2, Param3, Param4, R > BaseType;
2821 // Allow users access to the specific type of this delegate.
2822 typedef FastDelegate SelfType;
2824 // Mimic the base class constructors.
2825 FastDelegate() : BaseType() { }
2827 template < class X, class Y >
2828 FastDelegate(Y * pthis,
2829 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ))
2830 : BaseType(pthis, function_to_bind) { }
2832 template < class X, class Y >
2833 FastDelegate(const Y *pthis,
2834 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const)
2835 : BaseType(pthis, function_to_bind)
2838 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ))
2839 : BaseType(function_to_bind) { }
2840 void operator = (const BaseType &x) {
2841 *static_cast<BaseType*>(this) = x; }
2845 // Specialization to allow use of
2846 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) >
2848 // FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R >
2849 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5>
2850 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) >
2851 // Inherit from FastDelegate5 so that it can be treated just like a FastDelegate5
2852 : public FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R >
2855 // Make using the base type a bit easier via typedef.
2856 typedef FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R > BaseType;
2858 // Allow users access to the specific type of this delegate.
2859 typedef FastDelegate SelfType;
2861 // Mimic the base class constructors.
2862 FastDelegate() : BaseType() { }
2864 template < class X, class Y >
2865 FastDelegate(Y * pthis,
2866 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ))
2867 : BaseType(pthis, function_to_bind) { }
2869 template < class X, class Y >
2870 FastDelegate(const Y *pthis,
2871 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const)
2872 : BaseType(pthis, function_to_bind)
2875 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ))
2876 : BaseType(function_to_bind) { }
2877 void operator = (const BaseType &x) {
2878 *static_cast<BaseType*>(this) = x; }
2882 // Specialization to allow use of
2883 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) >
2885 // FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R >
2886 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6>
2887 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) >
2888 // Inherit from FastDelegate6 so that it can be treated just like a FastDelegate6
2889 : public FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R >
2892 // Make using the base type a bit easier via typedef.
2893 typedef FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R > BaseType;
2895 // Allow users access to the specific type of this delegate.
2896 typedef FastDelegate SelfType;
2898 // Mimic the base class constructors.
2899 FastDelegate() : BaseType() { }
2901 template < class X, class Y >
2902 FastDelegate(Y * pthis,
2903 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ))
2904 : BaseType(pthis, function_to_bind) { }
2906 template < class X, class Y >
2907 FastDelegate(const Y *pthis,
2908 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const)
2909 : BaseType(pthis, function_to_bind)
2912 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ))
2913 : BaseType(function_to_bind) { }
2914 void operator = (const BaseType &x) {
2915 *static_cast<BaseType*>(this) = x; }
2919 // Specialization to allow use of
2920 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) >
2922 // FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R >
2923 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7>
2924 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) >
2925 // Inherit from FastDelegate7 so that it can be treated just like a FastDelegate7
2926 : public FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R >
2929 // Make using the base type a bit easier via typedef.
2930 typedef FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R > BaseType;
2932 // Allow users access to the specific type of this delegate.
2933 typedef FastDelegate SelfType;
2935 // Mimic the base class constructors.
2936 FastDelegate() : BaseType() { }
2938 template < class X, class Y >
2939 FastDelegate(Y * pthis,
2940 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ))
2941 : BaseType(pthis, function_to_bind) { }
2943 template < class X, class Y >
2944 FastDelegate(const Y *pthis,
2945 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const)
2946 : BaseType(pthis, function_to_bind)
2949 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ))
2950 : BaseType(function_to_bind) { }
2951 void operator = (const BaseType &x) {
2952 *static_cast<BaseType*>(this) = x; }
2956 // Specialization to allow use of
2957 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) >
2959 // FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R >
2960 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8>
2961 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) >
2962 // Inherit from FastDelegate8 so that it can be treated just like a FastDelegate8
2963 : public FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R >
2966 // Make using the base type a bit easier via typedef.
2967 typedef FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R > BaseType;
2969 // Allow users access to the specific type of this delegate.
2970 typedef FastDelegate SelfType;
2972 // Mimic the base class constructors.
2973 FastDelegate() : BaseType() { }
2975 template < class X, class Y >
2976 FastDelegate(Y * pthis,
2977 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ))
2978 : BaseType(pthis, function_to_bind) { }
2980 template < class X, class Y >
2981 FastDelegate(const Y *pthis,
2982 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const)
2983 : BaseType(pthis, function_to_bind)
2986 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ))
2987 : BaseType(function_to_bind) { }
2988 void operator = (const BaseType &x) {
2989 *static_cast<BaseType*>(this) = x; }
2993 // Specialization to allow use of
2994 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9 ) >
2996 // FastDelegate9 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, R >
2997 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9>
2998 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9 ) >
2999 // Inherit from FastDelegate9 so that it can be treated just like a FastDelegate9
3000 : public FastDelegate9 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, R >
3003 // Make using the base type a bit easier via typedef.
3004 typedef FastDelegate9 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, R > BaseType;
3006 // Allow users access to the specific type of this delegate.
3007 typedef FastDelegate SelfType;
3009 // Mimic the base class constructors.
3010 FastDelegate() : BaseType() { }
3012 template < class X, class Y >
3013 FastDelegate(Y * pthis,
3014 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9 ))
3015 : BaseType(pthis, function_to_bind) { }
3017 template < class X, class Y >
3018 FastDelegate(const Y *pthis,
3019 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9 ) const)
3020 : BaseType(pthis, function_to_bind)
3023 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9 ))
3024 : BaseType(function_to_bind) { }
3025 void operator = (const BaseType &x) {
3026 *static_cast<BaseType*>(this) = x; }
3030 // Specialization to allow use of
3031 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10 ) >
3033 // FastDelegate10 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, R >
3034 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10>
3035 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10 ) >
3036 // Inherit from FastDelegate10 so that it can be treated just like a FastDelegate10
3037 : public FastDelegate10 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, R >
3040 // Make using the base type a bit easier via typedef.
3041 typedef FastDelegate10 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, R > BaseType;
3043 // Allow users access to the specific type of this delegate.
3044 typedef FastDelegate SelfType;
3046 // Mimic the base class constructors.
3047 FastDelegate() : BaseType() { }
3049 template < class X, class Y >
3050 FastDelegate(Y * pthis,
3051 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10 ))
3052 : BaseType(pthis, function_to_bind) { }
3054 template < class X, class Y >
3055 FastDelegate(const Y *pthis,
3056 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10 ) const)
3057 : BaseType(pthis, function_to_bind)
3060 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10 ))
3061 : BaseType(function_to_bind) { }
3062 void operator = (const BaseType &x) {
3063 *static_cast<BaseType*>(this) = x; }
3067 // Specialization to allow use of
3068 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11 ) >
3070 // FastDelegate11 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, R >
3071 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11>
3072 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11 ) >
3073 // Inherit from FastDelegate11 so that it can be treated just like a FastDelegate11
3074 : public FastDelegate11 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, R >
3077 // Make using the base type a bit easier via typedef.
3078 typedef FastDelegate11 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, R > BaseType;
3080 // Allow users access to the specific type of this delegate.
3081 typedef FastDelegate SelfType;
3083 // Mimic the base class constructors.
3084 FastDelegate() : BaseType() { }
3086 template < class X, class Y >
3087 FastDelegate(Y * pthis,
3088 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11 ))
3089 : BaseType(pthis, function_to_bind) { }
3091 template < class X, class Y >
3092 FastDelegate(const Y *pthis,
3093 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11 ) const)
3094 : BaseType(pthis, function_to_bind)
3097 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11 ))
3098 : BaseType(function_to_bind) { }
3099 void operator = (const BaseType &x) {
3100 *static_cast<BaseType*>(this) = x; }
3104 // Specialization to allow use of
3105 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12 ) >
3107 // FastDelegate12 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, R >
3108 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12>
3109 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12 ) >
3110 // Inherit from FastDelegate12 so that it can be treated just like a FastDelegate12
3111 : public FastDelegate12 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, R >
3114 // Make using the base type a bit easier via typedef.
3115 typedef FastDelegate12 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, R > BaseType;
3117 // Allow users access to the specific type of this delegate.
3118 typedef FastDelegate SelfType;
3120 // Mimic the base class constructors.
3121 FastDelegate() : BaseType() { }
3123 template < class X, class Y >
3124 FastDelegate(Y * pthis,
3125 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12 ))
3126 : BaseType(pthis, function_to_bind) { }
3128 template < class X, class Y >
3129 FastDelegate(const Y *pthis,
3130 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12 ) const)
3131 : BaseType(pthis, function_to_bind)
3134 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12 ))
3135 : BaseType(function_to_bind) { }
3136 void operator = (const BaseType &x) {
3137 *static_cast<BaseType*>(this) = x; }
3141 // Specialization to allow use of
3142 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13 ) >
3144 // FastDelegate13 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, R >
3145 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13>
3146 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13 ) >
3147 // Inherit from FastDelegate13 so that it can be treated just like a FastDelegate13
3148 : public FastDelegate13 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, R >
3151 // Make using the base type a bit easier via typedef.
3152 typedef FastDelegate13 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, R > BaseType;
3154 // Allow users access to the specific type of this delegate.
3155 typedef FastDelegate SelfType;
3157 // Mimic the base class constructors.
3158 FastDelegate() : BaseType() { }
3160 template < class X, class Y >
3161 FastDelegate(Y * pthis,
3162 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13 ))
3163 : BaseType(pthis, function_to_bind) { }
3165 template < class X, class Y >
3166 FastDelegate(const Y *pthis,
3167 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13 ) const)
3168 : BaseType(pthis, function_to_bind)
3171 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13 ))
3172 : BaseType(function_to_bind) { }
3173 void operator = (const BaseType &x) {
3174 *static_cast<BaseType*>(this) = x; }
3178 // Specialization to allow use of
3179 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14 ) >
3181 // FastDelegate14 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, R >
3182 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14>
3183 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14 ) >
3184 // Inherit from FastDelegate14 so that it can be treated just like a FastDelegate14
3185 : public FastDelegate14 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, R >
3188 // Make using the base type a bit easier via typedef.
3189 typedef FastDelegate14 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, R > BaseType;
3191 // Allow users access to the specific type of this delegate.
3192 typedef FastDelegate SelfType;
3194 // Mimic the base class constructors.
3195 FastDelegate() : BaseType() { }
3197 template < class X, class Y >
3198 FastDelegate(Y * pthis,
3199 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14 ))
3200 : BaseType(pthis, function_to_bind) { }
3202 template < class X, class Y >
3203 FastDelegate(const Y *pthis,
3204 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14 ) const)
3205 : BaseType(pthis, function_to_bind)
3208 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14 ))
3209 : BaseType(function_to_bind) { }
3210 void operator = (const BaseType &x) {
3211 *static_cast<BaseType*>(this) = x; }
3215 // Specialization to allow use of
3216 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15 ) >
3218 // FastDelegate15 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, R >
3219 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15>
3220 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15 ) >
3221 // Inherit from FastDelegate15 so that it can be treated just like a FastDelegate15
3222 : public FastDelegate15 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, R >
3225 // Make using the base type a bit easier via typedef.
3226 typedef FastDelegate15 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, R > BaseType;
3228 // Allow users access to the specific type of this delegate.
3229 typedef FastDelegate SelfType;
3231 // Mimic the base class constructors.
3232 FastDelegate() : BaseType() { }
3234 template < class X, class Y >
3235 FastDelegate(Y * pthis,
3236 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15 ))
3237 : BaseType(pthis, function_to_bind) { }
3239 template < class X, class Y >
3240 FastDelegate(const Y *pthis,
3241 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15 ) const)
3242 : BaseType(pthis, function_to_bind)
3245 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15 ))
3246 : BaseType(function_to_bind) { }
3247 void operator = (const BaseType &x) {
3248 *static_cast<BaseType*>(this) = x; }
3252 // Specialization to allow use of
3253 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16 ) >
3255 // FastDelegate16 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, R >
3256 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16>
3257 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16 ) >
3258 // Inherit from FastDelegate16 so that it can be treated just like a FastDelegate16
3259 : public FastDelegate16 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, R >
3262 // Make using the base type a bit easier via typedef.
3263 typedef FastDelegate16 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, R > BaseType;
3265 // Allow users access to the specific type of this delegate.
3266 typedef FastDelegate SelfType;
3268 // Mimic the base class constructors.
3269 FastDelegate() : BaseType() { }
3271 template < class X, class Y >
3272 FastDelegate(Y * pthis,
3273 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16 ))
3274 : BaseType(pthis, function_to_bind) { }
3276 template < class X, class Y >
3277 FastDelegate(const Y *pthis,
3278 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16 ) const)
3279 : BaseType(pthis, function_to_bind)
3282 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16 ))
3283 : BaseType(function_to_bind) { }
3284 void operator = (const BaseType &x) {
3285 *static_cast<BaseType*>(this) = x; }
3289 // Specialization to allow use of
3290 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17 ) >
3292 // FastDelegate17 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, R >
3293 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17>
3294 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17 ) >
3295 // Inherit from FastDelegate17 so that it can be treated just like a FastDelegate17
3296 : public FastDelegate17 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, R >
3299 // Make using the base type a bit easier via typedef.
3300 typedef FastDelegate17 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, R > BaseType;
3302 // Allow users access to the specific type of this delegate.
3303 typedef FastDelegate SelfType;
3305 // Mimic the base class constructors.
3306 FastDelegate() : BaseType() { }
3308 template < class X, class Y >
3309 FastDelegate(Y * pthis,
3310 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17 ))
3311 : BaseType(pthis, function_to_bind) { }
3313 template < class X, class Y >
3314 FastDelegate(const Y *pthis,
3315 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17 ) const)
3316 : BaseType(pthis, function_to_bind)
3319 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17 ))
3320 : BaseType(function_to_bind) { }
3321 void operator = (const BaseType &x) {
3322 *static_cast<BaseType*>(this) = x; }
3326 // Specialization to allow use of
3327 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18 ) >
3329 // FastDelegate18 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, R >
3330 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18>
3331 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18 ) >
3332 // Inherit from FastDelegate18 so that it can be treated just like a FastDelegate18
3333 : public FastDelegate18 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, R >
3336 // Make using the base type a bit easier via typedef.
3337 typedef FastDelegate18 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, R > BaseType;
3339 // Allow users access to the specific type of this delegate.
3340 typedef FastDelegate SelfType;
3342 // Mimic the base class constructors.
3343 FastDelegate() : BaseType() { }
3345 template < class X, class Y >
3346 FastDelegate(Y * pthis,
3347 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18 ))
3348 : BaseType(pthis, function_to_bind) { }
3350 template < class X, class Y >
3351 FastDelegate(const Y *pthis,
3352 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18 ) const)
3353 : BaseType(pthis, function_to_bind)
3356 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18 ))
3357 : BaseType(function_to_bind) { }
3358 void operator = (const BaseType &x) {
3359 *static_cast<BaseType*>(this) = x; }
3363 // Specialization to allow use of
3364 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19 ) >
3366 // FastDelegate19 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, R >
3367 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19>
3368 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19 ) >
3369 // Inherit from FastDelegate19 so that it can be treated just like a FastDelegate19
3370 : public FastDelegate19 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, R >
3373 // Make using the base type a bit easier via typedef.
3374 typedef FastDelegate19 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, R > BaseType;
3376 // Allow users access to the specific type of this delegate.
3377 typedef FastDelegate SelfType;
3379 // Mimic the base class constructors.
3380 FastDelegate() : BaseType() { }
3382 template < class X, class Y >
3383 FastDelegate(Y * pthis,
3384 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19 ))
3385 : BaseType(pthis, function_to_bind) { }
3387 template < class X, class Y >
3388 FastDelegate(const Y *pthis,
3389 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19 ) const)
3390 : BaseType(pthis, function_to_bind)
3393 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19 ))
3394 : BaseType(function_to_bind) { }
3395 void operator = (const BaseType &x) {
3396 *static_cast<BaseType*>(this) = x; }
3400 // Specialization to allow use of
3401 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20 ) >
3403 // FastDelegate20 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, R >
3404 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19, class Param20>
3405 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20 ) >
3406 // Inherit from FastDelegate20 so that it can be treated just like a FastDelegate20
3407 : public FastDelegate20 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, R >
3410 // Make using the base type a bit easier via typedef.
3411 typedef FastDelegate20 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, R > BaseType;
3413 // Allow users access to the specific type of this delegate.
3414 typedef FastDelegate SelfType;
3416 // Mimic the base class constructors.
3417 FastDelegate() : BaseType() { }
3419 template < class X, class Y >
3420 FastDelegate(Y * pthis,
3421 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20 ))
3422 : BaseType(pthis, function_to_bind) { }
3424 template < class X, class Y >
3425 FastDelegate(const Y *pthis,
3426 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20 ) const)
3427 : BaseType(pthis, function_to_bind)
3430 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20 ))
3431 : BaseType(function_to_bind) { }
3432 void operator = (const BaseType &x) {
3433 *static_cast<BaseType*>(this) = x; }
3437 #endif //FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
3439 ////////////////////////////////////////////////////////////////////////////////
3440 // Fast Delegates, part 5:
3442 // MakeDelegate() helper function
3444 // MakeDelegate(&x, &X::func) returns a fastdelegate of the type
3445 // necessary for calling x.func() with the correct number of arguments.
3446 // This makes it possible to eliminate many typedefs from user code.
3448 ////////////////////////////////////////////////////////////////////////////////
3450 // Also declare overloads of a MakeDelegate() global function to
3451 // reduce the need for typedefs.
3452 // We need seperate overloads for const and non-const member functions.
3453 // Also, because of the weird rule about the class of derived member function pointers,
3454 // implicit downcasts may need to be applied later to the 'this' pointer.
3455 // That's why two classes (X and Y) appear in the definitions. Y must be implicitly
3458 // Workaround for VC6. VC6 needs void return types converted into DefaultVoid.
3459 // GCC 3.2 and later won't compile this unless it's preceded by 'typename',
3460 // but VC6 doesn't allow 'typename' in this context.
3461 // So, I have to use a macro.
3464 #define FASTDLGT_RETTYPE detail::VoidToDefaultVoid<RetType>::type
3466 #define FASTDLGT_RETTYPE RetType
3470 template <class X, class Y, class RetType>
3471 FastDelegate0<FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)()) {
3472 return FastDelegate0<FASTDLGT_RETTYPE>(x, func);
3475 template <class X, class Y, class RetType>
3476 FastDelegate0<FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)() const) {
3477 return FastDelegate0<FASTDLGT_RETTYPE>(x, func);
3480 template <class RetType>
3481 FastDelegate0<FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)()) {
3482 return FastDelegate0<FASTDLGT_RETTYPE>(func);
3486 template <class X, class Y, class Param1, class RetType>
3487 FastDelegate1<Param1, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1)) {
3488 return FastDelegate1<Param1, FASTDLGT_RETTYPE>(x, func);
3491 template <class X, class Y, class Param1, class RetType>
3492 FastDelegate1<Param1, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1) const) {
3493 return FastDelegate1<Param1, FASTDLGT_RETTYPE>(x, func);
3496 template <class Param1, class RetType>
3497 FastDelegate1<Param1, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1)) {
3498 return FastDelegate1<Param1, FASTDLGT_RETTYPE>(func);
3502 template <class X, class Y, class Param1, class Param2, class RetType>
3503 FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2)) {
3504 return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(x, func);
3507 template <class X, class Y, class Param1, class Param2, class RetType>
3508 FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2) const) {
3509 return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(x, func);
3512 template <class Param1, class Param2, class RetType>
3513 FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2)) {
3514 return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(func);
3518 template <class X, class Y, class Param1, class Param2, class Param3, class RetType>
3519 FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3)) {
3520 return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(x, func);
3523 template <class X, class Y, class Param1, class Param2, class Param3, class RetType>
3524 FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3) const) {
3525 return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(x, func);
3528 template <class Param1, class Param2, class Param3, class RetType>
3529 FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3)) {
3530 return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(func);
3534 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class RetType>
3535 FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
3536 return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(x, func);
3539 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class RetType>
3540 FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) {
3541 return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(x, func);
3544 template <class Param1, class Param2, class Param3, class Param4, class RetType>
3545 FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
3546 return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(func);
3550 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class RetType>
3551 FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
3552 return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(x, func);
3555 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class RetType>
3556 FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) {
3557 return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(x, func);
3560 template <class Param1, class Param2, class Param3, class Param4, class Param5, class RetType>
3561 FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
3562 return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(func);
3566 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType>
3567 FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
3568 return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(x, func);
3571 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType>
3572 FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) {
3573 return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(x, func);
3576 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType>
3577 FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
3578 return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(func);
3582 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType>
3583 FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
3584 return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(x, func);
3587 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType>
3588 FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) {
3589 return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(x, func);
3592 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType>
3593 FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
3594 return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(func);
3598 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType>
3599 FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
3600 return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(x, func);
3603 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType>
3604 FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const) {
3605 return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(x, func);
3608 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType>
3609 FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
3610 return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(func);
3614 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class RetType>
3615 FastDelegate9<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9)) {
3616 return FastDelegate9<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, FASTDLGT_RETTYPE>(x, func);
3619 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class RetType>
3620 FastDelegate9<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) const) {
3621 return FastDelegate9<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, FASTDLGT_RETTYPE>(x, func);
3624 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class RetType>
3625 FastDelegate9<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9)) {
3626 return FastDelegate9<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, FASTDLGT_RETTYPE>(func);
3630 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class RetType>
3631 FastDelegate10<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10)) {
3632 return FastDelegate10<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, FASTDLGT_RETTYPE>(x, func);
3635 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class RetType>
3636 FastDelegate10<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10) const) {
3637 return FastDelegate10<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, FASTDLGT_RETTYPE>(x, func);
3640 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class RetType>
3641 FastDelegate10<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10)) {
3642 return FastDelegate10<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, FASTDLGT_RETTYPE>(func);
3646 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class RetType>
3647 FastDelegate11<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11)) {
3648 return FastDelegate11<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, FASTDLGT_RETTYPE>(x, func);
3651 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class RetType>
3652 FastDelegate11<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11) const) {
3653 return FastDelegate11<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, FASTDLGT_RETTYPE>(x, func);
3656 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class RetType>
3657 FastDelegate11<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11)) {
3658 return FastDelegate11<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, FASTDLGT_RETTYPE>(func);
3662 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class RetType>
3663 FastDelegate12<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12)) {
3664 return FastDelegate12<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, FASTDLGT_RETTYPE>(x, func);
3667 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class RetType>
3668 FastDelegate12<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12) const) {
3669 return FastDelegate12<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, FASTDLGT_RETTYPE>(x, func);
3672 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class RetType>
3673 FastDelegate12<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12)) {
3674 return FastDelegate12<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, FASTDLGT_RETTYPE>(func);
3678 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class RetType>
3679 FastDelegate13<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13)) {
3680 return FastDelegate13<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, FASTDLGT_RETTYPE>(x, func);
3683 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class RetType>
3684 FastDelegate13<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13) const) {
3685 return FastDelegate13<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, FASTDLGT_RETTYPE>(x, func);
3688 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class RetType>
3689 FastDelegate13<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13)) {
3690 return FastDelegate13<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, FASTDLGT_RETTYPE>(func);
3694 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class RetType>
3695 FastDelegate14<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14)) {
3696 return FastDelegate14<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, FASTDLGT_RETTYPE>(x, func);
3699 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class RetType>
3700 FastDelegate14<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14) const) {
3701 return FastDelegate14<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, FASTDLGT_RETTYPE>(x, func);
3704 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class RetType>
3705 FastDelegate14<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14)) {
3706 return FastDelegate14<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, FASTDLGT_RETTYPE>(func);
3710 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class RetType>
3711 FastDelegate15<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15)) {
3712 return FastDelegate15<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, FASTDLGT_RETTYPE>(x, func);
3715 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class RetType>
3716 FastDelegate15<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15) const) {
3717 return FastDelegate15<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, FASTDLGT_RETTYPE>(x, func);
3720 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class RetType>
3721 FastDelegate15<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15)) {
3722 return FastDelegate15<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, FASTDLGT_RETTYPE>(func);
3726 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class RetType>
3727 FastDelegate16<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16)) {
3728 return FastDelegate16<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, FASTDLGT_RETTYPE>(x, func);
3731 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class RetType>
3732 FastDelegate16<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16) const) {
3733 return FastDelegate16<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, FASTDLGT_RETTYPE>(x, func);
3736 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class RetType>
3737 FastDelegate16<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16)) {
3738 return FastDelegate16<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, FASTDLGT_RETTYPE>(func);
3742 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class RetType>
3743 FastDelegate17<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17)) {
3744 return FastDelegate17<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, FASTDLGT_RETTYPE>(x, func);
3747 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class RetType>
3748 FastDelegate17<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17) const) {
3749 return FastDelegate17<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, FASTDLGT_RETTYPE>(x, func);
3752 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class RetType>
3753 FastDelegate17<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17)) {
3754 return FastDelegate17<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, FASTDLGT_RETTYPE>(func);
3758 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class RetType>
3759 FastDelegate18<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18)) {
3760 return FastDelegate18<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, FASTDLGT_RETTYPE>(x, func);
3763 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class RetType>
3764 FastDelegate18<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18) const) {
3765 return FastDelegate18<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, FASTDLGT_RETTYPE>(x, func);
3768 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class RetType>
3769 FastDelegate18<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18)) {
3770 return FastDelegate18<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, FASTDLGT_RETTYPE>(func);
3774 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19, class RetType>
3775 FastDelegate19<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19)) {
3776 return FastDelegate19<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, FASTDLGT_RETTYPE>(x, func);
3779 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19, class RetType>
3780 FastDelegate19<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19) const) {
3781 return FastDelegate19<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, FASTDLGT_RETTYPE>(x, func);
3784 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19, class RetType>
3785 FastDelegate19<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19)) {
3786 return FastDelegate19<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, FASTDLGT_RETTYPE>(func);
3790 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19, class Param20, class RetType>
3791 FastDelegate20<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20)) {
3792 return FastDelegate20<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, FASTDLGT_RETTYPE>(x, func);
3795 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19, class Param20, class RetType>
3796 FastDelegate20<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20) const) {
3797 return FastDelegate20<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, FASTDLGT_RETTYPE>(x, func);
3800 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19, class Param20, class RetType>
3801 FastDelegate20<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16, Param17 p17, Param18 p18, Param19 p19, Param20 p20)) {
3802 return FastDelegate20<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, FASTDLGT_RETTYPE>(func);
3806 // clean up after ourselves...
3807 #undef FASTDLGT_RETTYPE
3809 } // namespace fastdelegate
3811 #endif // !defined(FASTDELEGATE_H)