sourcehook/generate/FastDelegate.h
author Pavol Marko <pavolmarko@gmail.com>
Fri Oct 14 17:45:36 2005 +0000 (2005-10-14)
changeset 133 ffe46578a1ae
parent 123 53e819ac032a
child 134 a9e04855f582
permissions -rw-r--r--
sh_stack now works if assert is disabled (stupid me), simple reentrancy test, META_IFACEPTR takes a type argument
     1 //						FastDelegate.h
     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
     4 //
     5 //						- Don Clugston, Mar 2004.
     6 //		Major contributions were made by Jody Hagins.
     7 // History:
     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 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_ compiler, including BCC 5.5.1
    40 //				  * New syntax: FastDelegate< int (char *, double) >.
    41 
    42 #ifndef FASTDELEGATE_H
    43 #define FASTDELEGATE_H
    44 
    45 #ifdef _MSC_VER
    46 # if _MSC_VER > 1000
    47 #  pragma once
    48 # endif // _MSC_VER > 1000
    49 #endif // #ifdef _MSC_VER
    50 
    51 #include <memory.h> // to allow <,> comparisons
    52 
    53 ////////////////////////////////////////////////////////////////////////////////
    54 //						Configuration options
    55 //
    56 ////////////////////////////////////////////////////////////////////////////////
    57 
    58 // Uncomment the following #define for optimally-sized delegates.
    59 // In this case, the generated asm code is almost identical to the code you'd get
    60 // if the compiler had native support for delegates.
    61 // It will not work on systems where sizeof(dataptr) < sizeof(codeptr).
    62 // Thus, it will not work for DOS compilers using the medium model.
    63 // It will also probably fail on some DSP systems.
    64 #define FASTDELEGATE_USESTATICFUNCTIONHACK
    65 
    66 // Uncomment the next line to allow function declarator syntax.
    67 // It is automatically enabled for those compilers where it is known to work.
    68 //#define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
    69 
    70 ////////////////////////////////////////////////////////////////////////////////
    71 //						Compiler identification for workarounds
    72 //
    73 ////////////////////////////////////////////////////////////////////////////////
    74 
    75 // Compiler identification. It's not easy to identify Visual C++ because
    76 // many vendors fraudulently define Microsoft's identifiers.
    77 #if defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__VECTOR_C) && !defined(__ICL) && !defined(__BORLANDC__)
    78 #define FASTDLGT_ISMSVC
    79 
    80 #if (_MSC_VER <1300) // Many workarounds are required for VC6.
    81 #define FASTDLGT_VC6
    82 #pragma warning(disable:4786) // disable this ridiculous warning
    83 #endif
    84 
    85 #endif
    86 
    87 // Does the compiler uses Microsoft's member function pointer structure?
    88 // If so, it needs special treatment.
    89 // Metrowerks CodeWarrior, Intel, and CodePlay fraudulently define Microsoft's
    90 // identifier, _MSC_VER. We need to filter Metrowerks out.
    91 #if defined(_MSC_VER) && !defined(__MWERKS__)
    92 #define FASTDLGT_MICROSOFT_MFP
    93 
    94 #if !defined(__VECTOR_C)
    95 // CodePlay doesn't have the __single/multi/virtual_inheritance keywords
    96 #define FASTDLGT_HASINHERITANCE_KEYWORDS
    97 #endif
    98 #endif
    99 
   100 // Does it allow function declarator syntax? The following compilers are known to work:
   101 #if defined(FASTDLGT_ISMSVC) && (_MSC_VER >=1310) // VC 7.1
   102 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
   103 #endif
   104 
   105 // Gcc(2.95+), and versions of Digital Mars, Intel and Comeau in common use.
   106 #if defined (__DMC__) || defined(__GNUC__) || defined(__ICL) || defined(__COMO__)
   107 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
   108 #endif
   109 
   110 // It works on Metrowerks MWCC 3.2.2. From boost.Config it should work on earlier ones too.
   111 #if defined (__MWERKS__)
   112 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
   113 #endif
   114 
   115 #ifdef __GNUC__ // Workaround GCC bug #8271
   116 	// At present, GCC doesn't recognize constness of MFPs in templates
   117 #define FASTDELEGATE_GCC_BUG_8271
   118 #endif
   119 
   120 
   121 
   122 ////////////////////////////////////////////////////////////////////////////////
   123 //						General tricks used in this code
   124 //
   125 // (a) Error messages are generated by typdefing an array of negative size to
   126 //     generate compile-time errors.
   127 // (b) Warning messages on MSVC are generated by declaring unused variables, and
   128 //	    enabling the "variable XXX is never used" warning.
   129 // (c) Unions are used in a few compiler-specific cases to perform illegal casts.
   130 // (d) For Microsoft and Intel, when adjusting the 'this' pointer, it's cast to
   131 //     (char *) first to ensure that the correct number of *bytes* are added.
   132 //
   133 ////////////////////////////////////////////////////////////////////////////////
   134 //						Helper templates
   135 //
   136 ////////////////////////////////////////////////////////////////////////////////
   137 
   138 
   139 namespace fastdelegate {
   140 namespace detail {	// we'll hide the implementation details in a nested namespace.
   141 
   142 //		implicit_cast< >
   143 // I believe this was originally going to be in the C++ standard but
   144 // was left out by accident. It's even milder than static_cast.
   145 // I use it instead of static_cast<> to emphasize that I'm not doing
   146 // anything nasty.
   147 // Usage is identical to static_cast<>
   148 template <class OutputClass, class InputClass>
   149 inline OutputClass implicit_cast(InputClass input){
   150 	return input;
   151 }
   152 
   153 //		horrible_cast< >
   154 // This is truly evil. It completely subverts C++'s type system, allowing you
   155 // to cast from any class to any other class. Technically, using a union
   156 // to perform the cast is undefined behaviour (even in C). But we can see if
   157 // it is OK by checking that the union is the same size as each of its members.
   158 // horrible_cast<> should only be used for compiler-specific workarounds.
   159 // Usage is identical to reinterpret_cast<>.
   160 
   161 // This union is declared outside the horrible_cast because BCC 5.5.1
   162 // can't inline a function with a nested class, and gives a warning.
   163 template <class OutputClass, class InputClass>
   164 union horrible_union{
   165 	OutputClass out;
   166 	InputClass in;
   167 };
   168 
   169 template <class OutputClass, class InputClass>
   170 inline OutputClass horrible_cast(const InputClass input){
   171 	horrible_union<OutputClass, InputClass> u;
   172 	// Cause a compile-time error if in, out and u are not the same size.
   173 	// If the compile fails here, it means the compiler has peculiar
   174 	// unions which would prevent the cast from working.
   175 	typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u)
   176 		&& sizeof(InputClass)==sizeof(OutputClass) ? 1 : -1];
   177 	u.in = input;
   178 	return u.out;
   179 }
   180 
   181 ////////////////////////////////////////////////////////////////////////////////
   182 //						Workarounds
   183 //
   184 ////////////////////////////////////////////////////////////////////////////////
   185 
   186 // Backwards compatibility: This macro used to be necessary in the virtual inheritance
   187 // case for Intel and Microsoft. Now it just forward-declares the class.
   188 #define FASTDELEGATEDECLARE(CLASSNAME)	class CLASSNAME;
   189 
   190 // Prevent use of the static function hack with the DOS medium model.
   191 #ifdef __MEDIUM__
   192 #undef FASTDELEGATE_USESTATICFUNCTIONHACK
   193 #endif
   194 
   195 //			DefaultVoid - a workaround for 'void' templates in VC6.
   196 //
   197 //  (1) VC6 and earlier do not allow 'void' as a default template argument.
   198 //  (2) They also doesn't allow you to return 'void' from a function.
   199 //
   200 // Workaround for (1): Declare a dummy type 'DefaultVoid' which we use
   201 //   when we'd like to use 'void'. We convert it into 'void' and back
   202 //   using the templates DefaultVoidToVoid<> and VoidToDefaultVoid<>.
   203 // Workaround for (2): On VC6, the code for calling a void function is
   204 //   identical to the code for calling a non-void function in which the
   205 //   return value is never used, provided the return value is returned
   206 //   in the EAX register, rather than on the stack.
   207 //   This is true for most fundamental types such as int, enum, void *.
   208 //   Const void * is the safest option since it doesn't participate
   209 //   in any automatic conversions. But on a 16-bit compiler it might
   210 //   cause extra code to be generated, so we disable it for all compilers
   211 //   except for VC6 (and VC5).
   212 #ifdef FASTDLGT_VC6
   213 // VC6 workaround
   214 typedef const void * DefaultVoid;
   215 #else
   216 // On any other compiler, just use a normal void.
   217 typedef void DefaultVoid;
   218 #endif
   219 
   220 // Translate from 'DefaultVoid' to 'void'.
   221 // Everything else is unchanged
   222 template <class T>
   223 struct DefaultVoidToVoid { typedef T type; };
   224 
   225 template <>
   226 struct DefaultVoidToVoid<DefaultVoid> {	typedef void type; };
   227 
   228 // Translate from 'void' into 'DefaultVoid'
   229 // Everything else is unchanged
   230 template <class T>
   231 struct VoidToDefaultVoid { typedef T type; };
   232 
   233 template <>
   234 struct VoidToDefaultVoid<void> { typedef DefaultVoid type; };
   235 
   236 
   237 
   238 ////////////////////////////////////////////////////////////////////////////////
   239 //						Fast Delegates, part 1:
   240 //
   241 //		Conversion of member function pointer to a standard form
   242 //
   243 ////////////////////////////////////////////////////////////////////////////////
   244 
   245 // GenericClass is a fake class, ONLY used to provide a type.
   246 // It is vitally important that it is never defined, so that the compiler doesn't
   247 // think it can optimize the invocation. For example, Borland generates simpler
   248 // code if it knows the class only uses single inheritance.
   249 
   250 // Compilers using Microsoft's structure need to be treated as a special case.
   251 #ifdef  FASTDLGT_MICROSOFT_MFP
   252 
   253 #ifdef FASTDLGT_HASINHERITANCE_KEYWORDS
   254 	// For Microsoft and Intel, we want to ensure that it's the most efficient type of MFP
   255 	// (4 bytes), even when the /vmg option is used. Declaring an empty class
   256 	// would give 16 byte pointers in this case....
   257 	class __single_inheritance GenericClass;
   258 #endif
   259 	// ...but for Codeplay, an empty class *always* gives 4 byte pointers.
   260 	// If compiled with the /clr option ("managed C++"), the JIT compiler thinks
   261 	// it needs to load GenericClass before it can call any of its functions,
   262 	// (compiles OK but crashes at runtime!), so we need to declare an
   263 	// empty class to make it happy.
   264 	// Codeplay and VC4 can't cope with the unknown_inheritance case either.
   265 	class GenericClass {};
   266 #else
   267 	class GenericClass;
   268 #endif
   269 
   270 // The size of a single inheritance member function pointer.
   271 const int SINGLE_MEMFUNCPTR_SIZE = sizeof(void (GenericClass::*)());
   272 
   273 //						SimplifyMemFunc< >::Convert()
   274 //
   275 //	A template function that converts an arbitrary member function pointer into the
   276 //	simplest possible form of member function pointer, using a supplied 'this' pointer.
   277 //  According to the standard, this can be done legally with reinterpret_cast<>.
   278 //	For (non-standard) compilers which use member function pointers which vary in size
   279 //  depending on the class, we need to use	knowledge of the internal structure of a
   280 //  member function pointer, as used by the compiler. Template specialization is used
   281 //  to distinguish between the sizes. Because some compilers don't support partial
   282 //	template specialisation, I use full specialisation of a wrapper struct.
   283 
   284 // general case -- don't know how to convert it. Force a compile failure
   285 template <int N>
   286 struct SimplifyMemFunc {
   287 	template <class X, class XFuncType, class GenericMemFuncType>
   288 	inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
   289 		GenericMemFuncType &bound_func) {
   290 		// Unsupported member function type -- force a compile failure.
   291 	    // (it's illegal to have a array with negative size).
   292 		typedef char ERROR_Unsupported_member_function_pointer_on_this_compiler[N-100];
   293 		return 0;
   294 	}
   295 };
   296 
   297 // For compilers where all member func ptrs are the same size, everything goes here.
   298 // For non-standard compilers, only single_inheritance classes go here.
   299 template <>
   300 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE>  {
   301 	template <class X, class XFuncType, class GenericMemFuncType>
   302 	inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
   303 			GenericMemFuncType &bound_func) {
   304 #if defined __DMC__
   305 		// Digital Mars doesn't allow you to cast between abitrary PMF's,
   306 		// even though the standard says you can. The 32-bit compiler lets you
   307 		// static_cast through an int, but the DOS compiler doesn't.
   308 		bound_func = horrible_cast<GenericMemFuncType>(function_to_bind);
   309 #else
   310         bound_func = reinterpret_cast<GenericMemFuncType>(function_to_bind);
   311 #endif
   312         return reinterpret_cast<GenericClass *>(pthis);
   313 	}
   314 };
   315 
   316 ////////////////////////////////////////////////////////////////////////////////
   317 //						Fast Delegates, part 1b:
   318 //
   319 //					Workarounds for Microsoft and Intel
   320 //
   321 ////////////////////////////////////////////////////////////////////////////////
   322 
   323 
   324 // Compilers with member function pointers which violate the standard (MSVC, Intel, Codeplay),
   325 // need to be treated as a special case.
   326 #ifdef FASTDLGT_MICROSOFT_MFP
   327 
   328 // We use unions to perform horrible_casts. I would like to use #pragma pack(push, 1)
   329 // at the start of each function for extra safety, but VC6 seems to ICE
   330 // intermittently if you do this inside a template.
   331 
   332 // __multiple_inheritance classes go here
   333 // Nasty hack for Microsoft and Intel (IA32 and Itanium)
   334 template<>
   335 struct SimplifyMemFunc< SINGLE_MEMFUNCPTR_SIZE + sizeof(int) >  {
   336 	template <class X, class XFuncType, class GenericMemFuncType>
   337 	inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
   338 		GenericMemFuncType &bound_func) {
   339 		// We need to use a horrible_cast to do this conversion.
   340 		// In MSVC, a multiple inheritance member pointer is internally defined as:
   341         union {
   342 			XFuncType func;
   343 			struct {
   344 				GenericMemFuncType funcaddress; // points to the actual member function
   345 				int delta;	     // #BYTES to be added to the 'this' pointer
   346 			}s;
   347         } u;
   348 		// Check that the horrible_cast will work
   349 		typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)? 1 : -1];
   350         u.func = function_to_bind;
   351 		bound_func = u.s.funcaddress;
   352 		return reinterpret_cast<GenericClass *>(reinterpret_cast<char *>(pthis) + u.s.delta);
   353 	}
   354 };
   355 
   356 // virtual inheritance is a real nuisance. It's inefficient and complicated.
   357 // On MSVC and Intel, there isn't enough information in the pointer itself to
   358 // enable conversion to a closure pointer. Earlier versions of this code didn't
   359 // work for all cases, and generated a compile-time error instead.
   360 // But a very clever hack invented by John M. Dlugosz solves this problem.
   361 // My code is somewhat different to his: I have no asm code, and I make no
   362 // assumptions about the calling convention that is used.
   363 
   364 // In VC++ and ICL, a virtual_inheritance member pointer
   365 // is internally defined as:
   366 struct MicrosoftVirtualMFP {
   367 	void (GenericClass::*codeptr)(); // points to the actual member function
   368 	int delta;		// #bytes to be added to the 'this' pointer
   369 	int vtable_index; // or 0 if no virtual inheritance
   370 };
   371 // The CRUCIAL feature of Microsoft/Intel MFPs which we exploit is that the
   372 // m_codeptr member is *always* called, regardless of the values of the other
   373 // members. (This is *not* true for other compilers, eg GCC, which obtain the
   374 // function address from the vtable if a virtual function is being called).
   375 // Dlugosz's trick is to make the codeptr point to a probe function which
   376 // returns the 'this' pointer that was used.
   377 
   378 // Define a generic class that uses virtual inheritance.
   379 // It has a trival member function that returns the value of the 'this' pointer.
   380 struct GenericVirtualClass : virtual public GenericClass
   381 {
   382 	typedef GenericVirtualClass * (GenericVirtualClass::*ProbePtrType)();
   383 	GenericVirtualClass * GetThis() { return this; }
   384 };
   385 
   386 // __virtual_inheritance classes go here
   387 template <>
   388 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 2*sizeof(int) >
   389 {
   390 
   391 	template <class X, class XFuncType, class GenericMemFuncType>
   392 	inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
   393 		GenericMemFuncType &bound_func) {
   394 		union {
   395 			XFuncType func;
   396 			GenericClass* (X::*ProbeFunc)();
   397 			MicrosoftVirtualMFP s;
   398 		} u;
   399 		u.func = function_to_bind;
   400 		bound_func = reinterpret_cast<GenericMemFuncType>(u.s.codeptr);
   401 		union {
   402 			GenericVirtualClass::ProbePtrType virtfunc;
   403 			MicrosoftVirtualMFP s;
   404 		} u2;
   405 		// Check that the horrible_cast<>s will work
   406 		typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)
   407 			&& sizeof(function_to_bind)==sizeof(u.ProbeFunc)
   408 			&& sizeof(u2.virtfunc)==sizeof(u2.s) ? 1 : -1];
   409    // Unfortunately, taking the address of a MF prevents it from being inlined, so
   410    // this next line can't be completely optimised away by the compiler.
   411 		u2.virtfunc = &GenericVirtualClass::GetThis;
   412 		u.s.codeptr = u2.s.codeptr;
   413 		return (pthis->*u.ProbeFunc)();
   414 	}
   415 };
   416 
   417 #if (_MSC_VER <1300)
   418 
   419 // Nasty hack for Microsoft Visual C++ 6.0
   420 // unknown_inheritance classes go here
   421 // There is a compiler bug in MSVC6 which generates incorrect code in this case!!
   422 template <>
   423 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*sizeof(int) >
   424 {
   425 	template <class X, class XFuncType, class GenericMemFuncType>
   426 	inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
   427 		GenericMemFuncType &bound_func) {
   428 		// There is an apalling but obscure compiler bug in MSVC6 and earlier:
   429 		// vtable_index and 'vtordisp' are always set to 0 in the
   430 		// unknown_inheritance case!
   431 		// This means that an incorrect function could be called!!!
   432 		// Compiling with the /vmg option leads to potentially incorrect code.
   433 		// This is probably the reason that the IDE has a user interface for specifying
   434 		// the /vmg option, but it is disabled -  you can only specify /vmg on
   435 		// the command line. In VC1.5 and earlier, the compiler would ICE if it ever
   436 		// encountered this situation.
   437 		// It is OK to use the /vmg option if /vmm or /vms is specified.
   438 
   439 		// Fortunately, the wrong function is only called in very obscure cases.
   440 		// It only occurs when a derived class overrides a virtual function declared
   441 		// in a virtual base class, and the member function
   442 		// points to the *Derived* version of that function. The problem can be
   443 		// completely averted in 100% of cases by using the *Base class* for the
   444 		// member fpointer. Ie, if you use the base class as an interface, you'll
   445 		// stay out of trouble.
   446 		// Occasionally, you might want to point directly to a derived class function
   447 		// that isn't an override of a base class. In this case, both vtable_index
   448 		// and 'vtordisp' are zero, but a virtual_inheritance pointer will be generated.
   449 		// We can generate correct code in this case. To prevent an incorrect call from
   450 		// ever being made, on MSVC6 we generate a warning, and call a function to
   451 		// make the program crash instantly.
   452 		typedef char ERROR_VC6CompilerBug[-100];
   453 		return 0;
   454 	}
   455 };
   456 
   457 
   458 #else
   459 
   460 // Nasty hack for Microsoft and Intel (IA32 and Itanium)
   461 // unknown_inheritance classes go here
   462 // This is probably the ugliest bit of code I've ever written. Look at the casts!
   463 // There is a compiler bug in MSVC6 which prevents it from using this code.
   464 template <>
   465 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*sizeof(int) >
   466 {
   467 	template <class X, class XFuncType, class GenericMemFuncType>
   468 	inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
   469 			GenericMemFuncType &bound_func) {
   470 		// The member function pointer is 16 bytes long. We can't use a normal cast, but
   471 		// we can use a union to do the conversion.
   472 		union {
   473 			XFuncType func;
   474 			// In VC++ and ICL, an unknown_inheritance member pointer
   475 			// is internally defined as:
   476 			struct {
   477 				GenericMemFuncType m_funcaddress; // points to the actual member function
   478 				int delta;		// #bytes to be added to the 'this' pointer
   479 				int vtordisp;		// #bytes to add to 'this' to find the vtable
   480 				int vtable_index; // or 0 if no virtual inheritance
   481 			} s;
   482 		} u;
   483 		// Check that the horrible_cast will work
   484 		typedef int ERROR_CantUsehorrible_cast[sizeof(XFuncType)==sizeof(u.s)? 1 : -1];
   485 		u.func = function_to_bind;
   486 		bound_func = u.s.funcaddress;
   487 		int virtual_delta = 0;
   488 		if (u.s.vtable_index) { // Virtual inheritance is used
   489 			// First, get to the vtable.
   490 			// It is 'vtordisp' bytes from the start of the class.
   491 			const int * vtable = *reinterpret_cast<const int *const*>(
   492 				reinterpret_cast<const char *>(pthis) + u.s.vtordisp );
   493 
   494 			// 'vtable_index' tells us where in the table we should be looking.
   495 			virtual_delta = u.s.vtordisp + *reinterpret_cast<const int *>(
   496 				reinterpret_cast<const char *>(vtable) + u.s.vtable_index);
   497 		}
   498 		// The int at 'virtual_delta' gives us the amount to add to 'this'.
   499         // Finally we can add the three components together. Phew!
   500         return reinterpret_cast<GenericClass *>(
   501 			reinterpret_cast<char *>(pthis) + u.s.delta + virtual_delta);
   502 	};
   503 };
   504 #endif // MSVC 7 and greater
   505 
   506 #endif // MS/Intel hacks
   507 
   508 }  // namespace detail
   509 
   510 ////////////////////////////////////////////////////////////////////////////////
   511 //						Fast Delegates, part 2:
   512 //
   513 //	Define the delegate storage, and cope with static functions
   514 //
   515 ////////////////////////////////////////////////////////////////////////////////
   516 
   517 // DelegateMemento -- an opaque structure which can hold an arbitary delegate.
   518 // It knows nothing about the calling convention or number of arguments used by
   519 // the function pointed to.
   520 // It supplies comparison operators so that it can be stored in STL collections.
   521 // It cannot be set to anything other than null, nor invoked directly:
   522 //   it must be converted to a specific delegate.
   523 
   524 // Implementation:
   525 // There are two possible implementations: the Safe method and the Evil method.
   526 //				DelegateMemento - Safe version
   527 //
   528 // This implementation is standard-compliant, but a bit tricky.
   529 // A static function pointer is stored inside the class.
   530 // Here are the valid values:
   531 // +-- Static pointer --+--pThis --+-- pMemFunc-+-- Meaning------+
   532 // |   0				|  0       |   0        | Empty          |
   533 // |   !=0              |(dontcare)|  Invoker   | Static function|
   534 // |   0                |  !=0     |  !=0       | Method call    |
   535 // +--------------------+----------+------------+----------------+
   536 // When stored stored inside a specific delegate, the 'dontcare' entries are replaced
   537 // with a reference to the delegate itself. This complicates the = and == operators
   538 // for the delegate class.
   539 
   540 //				DelegateMemento - Evil version
   541 //
   542 // For compilers where data pointers are at least as big as code pointers, it is
   543 // possible to store the function pointer in the this pointer, using another
   544 // horrible_cast. In this case the DelegateMemento implementation is simple:
   545 // +--pThis --+-- pMemFunc-+-- Meaning---------------------+
   546 // |    0     |  0         | Empty                         |
   547 // |  !=0     |  !=0       | Static function or method call|
   548 // +----------+------------+-------------------------------+
   549 // Note that the Sun C++ and MSVC documentation explicitly state that they
   550 // support static_cast between void * and function pointers.
   551 
   552 class DelegateMemento {
   553 protected:
   554 	// the data is protected, not private, because many
   555 	// compilers have problems with template friends.
   556 	typedef void (detail::GenericClass::*GenericMemFuncType)(); // arbitrary MFP.
   557 	detail::GenericClass *m_pthis;
   558 	GenericMemFuncType m_pFunction;
   559 
   560 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
   561 	typedef void (*GenericFuncPtr)(); // arbitrary code pointer
   562 	GenericFuncPtr m_pStaticFunction;
   563 #endif
   564 
   565 public:
   566 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
   567 	DelegateMemento() : m_pthis(0), m_pFunction(0), m_pStaticFunction(0) {};
   568 	void clear() {
   569 		m_pthis=0; m_pFunction=0; m_pStaticFunction=0;
   570 	}
   571 #else
   572 	DelegateMemento() : m_pthis(0), m_pFunction(0) {};
   573 	void clear() {
   574 		m_pthis=0; m_pFunction=0;
   575 	}
   576 #endif
   577 public:
   578 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
   579 	inline bool IsEqual (const DelegateMemento &x) const{
   580 	    // We have to cope with the static function pointers as a special case
   581 		if (m_pFunction!=x.m_pFunction) return false;
   582 		// the static function ptrs must either both be equal, or both be 0.
   583 		if (m_pStaticFunction!=x.m_pStaticFunction) return false;
   584 		if (m_pStaticFunction!=0) return m_pthis==x.m_pthis;
   585 		else return true;
   586 	}
   587 #else // Evil Method
   588 	inline bool IsEqual (const DelegateMemento &x) const{
   589 		return m_pthis==x.m_pthis && m_pFunction==x.m_pFunction;
   590 	}
   591 #endif
   592 	// Provide a strict weak ordering for DelegateMementos.
   593 	inline bool IsLess(const DelegateMemento &right) const {
   594 		// deal with static function pointers first
   595 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
   596 		if (m_pStaticFunction !=0 || right.m_pStaticFunction!=0)
   597 				return m_pStaticFunction < right.m_pStaticFunction;
   598 #endif
   599 		if (m_pthis !=right.m_pthis) return m_pthis < right.m_pthis;
   600 	// There are no ordering operators for member function pointers,
   601 	// but we can fake one by comparing each byte. The resulting ordering is
   602 	// arbitrary (and compiler-dependent), but it permits storage in ordered STL containers.
   603 		return memcmp(&m_pFunction, &right.m_pFunction, sizeof(m_pFunction)) < 0;
   604 
   605 	}
   606 	inline bool operator ! () const		// Is it bound to anything?
   607 	{ return m_pFunction==0; }
   608 public:
   609 	DelegateMemento & operator = (const DelegateMemento &right)  {
   610 		SetMementoFrom(right);
   611 		return *this;
   612 	}
   613 	inline bool operator <(const DelegateMemento &right) {
   614 		return IsLess(right);
   615 	}
   616 	inline bool operator >(const DelegateMemento &right) {
   617 		return right.IsLess(*this);
   618 	}
   619 	DelegateMemento (const DelegateMemento &right)  :
   620 		m_pthis(right.m_pthis), m_pFunction(right.m_pFunction)
   621 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
   622 		, m_pStaticFunction (right.m_pStaticFunction)
   623 #endif
   624 		{}
   625 protected:
   626 	void SetMementoFrom(const DelegateMemento &right)  {
   627 		m_pFunction = right.m_pFunction;
   628 		m_pthis = right.m_pthis;
   629 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
   630 		m_pStaticFunction = right.m_pStaticFunction;
   631 #endif
   632 	}
   633 };
   634 
   635 
   636 //						ClosurePtr<>
   637 //
   638 // A private wrapper class that adds function signatures to DelegateMemento.
   639 // It's the class that does most of the actual work.
   640 // The signatures are specified by:
   641 // GenericMemFunc: must be a type of GenericClass member function pointer.
   642 // StaticFuncPtr:  must be a type of function pointer with the same signature
   643 //                 as GenericMemFunc.
   644 // UnvoidStaticFuncPtr: is the same as StaticFuncPtr, except on VC6
   645 //                 where it never returns void (returns DefaultVoid instead).
   646 
   647 // An outer class, FastDelegateN<>, handles the invoking and creates the
   648 // necessary typedefs.
   649 // This class does everything else.
   650 
   651 namespace detail {
   652 
   653 template < class GenericMemFunc, class StaticFuncPtr, class UnvoidStaticFuncPtr>
   654 class ClosurePtr : public DelegateMemento {
   655 public:
   656 	// These functions are for setting the delegate to a member function.
   657 
   658 	// Here's the clever bit: we convert an arbitrary member function into a
   659 	// standard form. XMemFunc should be a member function of class X, but I can't
   660 	// enforce that here. It needs to be enforced by the wrapper class.
   661 	template < class X, class XMemFunc >
   662 	inline void bindmemfunc(X *pthis, XMemFunc function_to_bind ) {
   663 		m_pthis = SimplifyMemFunc< sizeof(function_to_bind) >
   664 			::Convert(pthis, function_to_bind, m_pFunction);
   665 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
   666 		m_pStaticFunction = 0;
   667 #endif
   668 	}
   669 	// For const member functions, we only need a const class pointer.
   670 	// Since we know that the member function is const, it's safe to
   671 	// remove the const qualifier from the 'this' pointer with a const_cast.
   672 	// VC6 has problems if we just overload 'bindmemfunc', so we give it a different name.
   673 	template < class X, class XMemFunc>
   674 	inline void bindconstmemfunc(const X *pthis, XMemFunc function_to_bind) {
   675 		m_pthis= SimplifyMemFunc< sizeof(function_to_bind) >
   676 			::Convert(const_cast<X*>(pthis), function_to_bind, m_pFunction);
   677 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
   678 		m_pStaticFunction = 0;
   679 #endif
   680 	}
   681 #ifdef FASTDELEGATE_GCC_BUG_8271	// At present, GCC doesn't recognize constness of MFPs in templates
   682 	template < class X, class XMemFunc>
   683 	inline void bindmemfunc(const X *pthis, XMemFunc function_to_bind) {
   684 		bindconstmemfunc(pthis, function_to_bind);
   685 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
   686 		m_pStaticFunction = 0;
   687 #endif
   688 	}
   689 #endif
   690 	// These functions are required for invoking the stored function
   691 	inline GenericClass *GetClosureThis() const { return m_pthis; }
   692 	inline GenericMemFunc GetClosureMemPtr() const { return reinterpret_cast<GenericMemFunc>(m_pFunction); }
   693 
   694 // There are a few ways of dealing with static function pointers.
   695 // There's a standard-compliant, but tricky method.
   696 // There's also a straightforward hack, that won't work on DOS compilers using the
   697 // medium memory model. It's so evil that I can't recommend it, but I've
   698 // implemented it anyway because it produces very nice asm code.
   699 
   700 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
   701 
   702 //				ClosurePtr<> - Safe version
   703 //
   704 // This implementation is standard-compliant, but a bit tricky.
   705 // I store the function pointer inside the class, and the delegate then
   706 // points to itself. Whenever the delegate is copied, these self-references
   707 // must be transformed, and this complicates the = and == operators.
   708 public:
   709 	// The next two functions are for operator ==, =, and the copy constructor.
   710 	// We may need to convert the m_pthis pointers, so that
   711 	// they remain as self-references.
   712 	template< class DerivedClass >
   713 	inline void CopyFrom (DerivedClass *pParent, const DelegateMemento &x) {
   714 		SetMementoFrom(x);
   715 		if (m_pStaticFunction!=0) {
   716 			// transform self references...
   717 			m_pthis=reinterpret_cast<GenericClass *>(pParent);
   718 		}
   719 	}
   720 	// For static functions, the 'static_function_invoker' class in the parent
   721 	// will be called. The parent then needs to call GetStaticFunction() to find out
   722 	// the actual function to invoke.
   723 	template < class DerivedClass, class ParentInvokerSig >
   724 	inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker,
   725 				StaticFuncPtr function_to_bind ) {
   726 		bindmemfunc(pParent, static_function_invoker);
   727 		m_pStaticFunction=reinterpret_cast<GenericFuncPtr>(function_to_bind);
   728 	}
   729 	inline UnvoidStaticFuncPtr GetStaticFunction() const {
   730 		return reinterpret_cast<UnvoidStaticFuncPtr>(m_pStaticFunction);
   731 	}
   732 #else
   733 
   734 //				ClosurePtr<> - Evil version
   735 //
   736 // For compilers where data pointers are at least as big as code pointers, it is
   737 // possible to store the function pointer in the this pointer, using another
   738 // horrible_cast. Invocation isn't any faster, but it saves 4 bytes, and
   739 // speeds up comparison and assignment. If C++ provided direct language support
   740 // for delegates, they would produce asm code that was almost identical to this.
   741 // Note that the Sun C++ and MSVC documentation explicitly state that they
   742 // support static_cast between void * and function pointers.
   743 
   744 	template< class DerivedClass >
   745 	inline void CopyFrom (DerivedClass *pParent, const DelegateMemento &right) {
   746 		SetMementoFrom(right);
   747 	}
   748 	// For static functions, the 'static_function_invoker' class in the parent
   749 	// will be called. The parent then needs to call GetStaticFunction() to find out
   750 	// the actual function to invoke.
   751 	// ******** EVIL, EVIL CODE! *******
   752 	template < 	class DerivedClass, class ParentInvokerSig>
   753 	inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker,
   754 				StaticFuncPtr function_to_bind) {
   755 		// We'll be ignoring the 'this' pointer, but we need to make sure we pass
   756 		// a valid value to bindmemfunc().
   757 		bindmemfunc(pParent, static_function_invoker);
   758 
   759 		// WARNING! Evil hack. We store the function in the 'this' pointer!
   760 		// Ensure that there's a compilation failure if function pointers
   761 		// and data pointers have different sizes.
   762 		// If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
   763 		typedef int ERROR_CantUseEvilMethod[sizeof(GenericClass *)==sizeof(function_to_bind) ? 1 : -1];
   764 		m_pthis = horrible_cast<GenericClass *>(function_to_bind);
   765 		// MSVC, SunC++ and DMC accept the following (non-standard) code:
   766 //		m_pthis = static_cast<GenericClass *>(static_cast<void *>(function_to_bind));
   767 		// BCC32, Comeau and DMC accept this method. MSVC7.1 needs __int64 instead of long
   768 //		m_pthis = reinterpret_cast<GenericClass *>(reinterpret_cast<long>(function_to_bind));
   769 	}
   770 	// ******** EVIL, EVIL CODE! *******
   771 	// This function will be called with an invalid 'this' pointer!!
   772 	// We're just returning the 'this' pointer, converted into
   773 	// a function pointer!
   774 	inline UnvoidStaticFuncPtr GetStaticFunction() const {
   775 		// Ensure that there's a compilation failure if function pointers
   776 		// and data pointers have different sizes.
   777 		// If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
   778 		typedef int ERROR_CantUseEvilMethod[sizeof(UnvoidStaticFuncPtr)==sizeof(this) ? 1 : -1];
   779 		return horrible_cast<UnvoidStaticFuncPtr>(this);
   780 	}
   781 #endif // !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
   782 
   783 };
   784 
   785 
   786 } // namespace detail
   787 
   788 ////////////////////////////////////////////////////////////////////////////////
   789 //						Fast Delegates, part 3:
   790 //
   791 //				Wrapper classes to ensure type safety
   792 //
   793 ////////////////////////////////////////////////////////////////////////////////
   794 
   795 
   796 // Once we have the member function conversion templates, it's easy to make the
   797 // wrapper classes. So that they will work with as many compilers as possible,
   798 // the classes are of the form
   799 //   FastDelegate3<int, char *, double>
   800 // They can cope with any combination of parameters. The max number of parameters
   801 // allowed is 8, but it is trivial to increase this limit.
   802 // Note that we need to treat const member functions seperately.
   803 // All this class does is to enforce type safety, and invoke the delegate with
   804 // the correct list of parameters.
   805 
   806 // Because of the weird rule about the class of derived member function pointers,
   807 // you sometimes need to apply a downcast to the 'this' pointer.
   808 // This is the reason for the use of "implicit_cast<X*>(pthis)" in the code below.
   809 // If CDerivedClass is derived from CBaseClass, but doesn't override SimpleVirtualFunction,
   810 // without this trick you'd need to write:
   811 //		MyDelegate(static_cast<CBaseClass *>(&d), &CDerivedClass::SimpleVirtualFunction);
   812 // but with the trick you can write
   813 //		MyDelegate(&d, &CDerivedClass::SimpleVirtualFunction);
   814 
   815 // RetType is the type the compiler uses in compiling the template. For VC6,
   816 // it cannot be void. DesiredRetType is the real type which is returned from
   817 // all of the functions. It can be void.
   818 
   819 //N=0
   820 template<class RetType=detail::DefaultVoid>
   821 class FastDelegate0 {
   822 private:
   823 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
   824 	typedef DesiredRetType (*StaticFunctionPtr)();
   825 	typedef RetType (*UnvoidStaticFunctionPtr)();
   826 	typedef RetType (detail::GenericClass::*GenericMemFn)();
   827 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
   828 public:
   829 	// Typedefs to aid generic programming
   830 	typedef FastDelegate0 type;
   831 
   832 	// Construction and comparison functions
   833 	FastDelegate0() { clear(); }
   834 	FastDelegate0(const FastDelegate0 &x) {
   835 		m_Closure.CopyFrom(this, x.m_Closure); }
   836 	void operator = (const FastDelegate0 &x)  {
   837 		m_Closure.CopyFrom(this, x.m_Closure); }
   838 	bool operator ==(const FastDelegate0 &x) const {
   839 		return m_Closure.IsEqual(x.m_Closure);	}
   840 	bool operator !=(const FastDelegate0 &x) const {
   841 		return !m_Closure.IsEqual(x.m_Closure); }
   842 	bool operator <(const FastDelegate0 &x) const {
   843 		return m_Closure.IsLess(x.m_Closure);	}
   844 	bool operator >(const FastDelegate0 &x) const {
   845 		return x.m_Closure.IsLess(m_Closure);	}
   846 	// Binding to non-const member functions
   847 	template < class X, class Y >
   848 	FastDelegate0(Y *pthis, DesiredRetType (X::* function_to_bind)() ) {
   849 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
   850 	template < class X, class Y >
   851 	inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)()) {
   852 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
   853 	// Binding to const member functions.
   854 	template < class X, class Y >
   855 	FastDelegate0(const Y *pthis, DesiredRetType (X::* function_to_bind)() const) {
   856 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
   857 	template < class X, class Y >
   858 	inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)() const) {
   859 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
   860 	// Static functions. We convert them into a member function call.
   861 	// Note that this also provides a conversion from static functions.
   862 	FastDelegate0(DesiredRetType (*function_to_bind)() ) {
   863 		bind(function_to_bind);	}
   864 	inline void bind(DesiredRetType (*function_to_bind)()) {
   865 		m_Closure.bindstaticfunc(this, &FastDelegate0::InvokeStaticFunction,
   866 			function_to_bind); }
   867 	RetType operator() () const { // Invoke the delegate
   868 		// this next line is the only one that violates the standard
   869 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(); }
   870 	inline bool operator ! () const	{	// Is it bound to anything?
   871 			return !m_Closure; }
   872 	inline bool empty() const	{
   873 			return !m_Closure; }
   874 	void clear() { m_Closure.clear();}
   875 	// Conversion to and from the DelegateMemento storage class
   876 	const DelegateMemento & GetMemento() { return m_Closure; }
   877 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
   878 
   879 private:	// Invoker for static functions
   880 	RetType InvokeStaticFunction() const {
   881 	return (*(m_Closure.GetStaticFunction()))(); }
   882 };
   883 
   884 //N=1
   885 template<class Param1, class RetType=detail::DefaultVoid>
   886 class FastDelegate1 {
   887 private:
   888 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
   889 	typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1);
   890 	typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1);
   891 	typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1);
   892 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
   893 public:
   894 	// Typedefs to aid generic programming
   895 	typedef FastDelegate1 type;
   896 
   897 	// Construction and comparison functions
   898 	FastDelegate1() { clear(); }
   899 	FastDelegate1(const FastDelegate1 &x) {
   900 		m_Closure.CopyFrom(this, x.m_Closure); }
   901 	void operator = (const FastDelegate1 &x)  {
   902 		m_Closure.CopyFrom(this, x.m_Closure); }
   903 	bool operator ==(const FastDelegate1 &x) const {
   904 		return m_Closure.IsEqual(x.m_Closure);	}
   905 	bool operator !=(const FastDelegate1 &x) const {
   906 		return !m_Closure.IsEqual(x.m_Closure); }
   907 	bool operator <(const FastDelegate1 &x) const {
   908 		return m_Closure.IsLess(x.m_Closure);	}
   909 	bool operator >(const FastDelegate1 &x) const {
   910 		return x.m_Closure.IsLess(m_Closure);	}
   911 	// Binding to non-const member functions
   912 	template < class X, class Y >
   913 	FastDelegate1(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) ) {
   914 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
   915 	template < class X, class Y >
   916 	inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1)) {
   917 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
   918 	// Binding to const member functions.
   919 	template < class X, class Y >
   920 	FastDelegate1(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) const) {
   921 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
   922 	template < class X, class Y >
   923 	inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) const) {
   924 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
   925 	// Static functions. We convert them into a member function call.
   926 	// Note that this also provides a conversion from static functions.
   927 	FastDelegate1(DesiredRetType (*function_to_bind)(Param1 p1) ) {
   928 		bind(function_to_bind);	}
   929 	inline void bind(DesiredRetType (*function_to_bind)(Param1 p1)) {
   930 		m_Closure.bindstaticfunc(this, &FastDelegate1::InvokeStaticFunction,
   931 			function_to_bind); }
   932 	RetType operator() (Param1 p1) const { // Invoke the delegate
   933 		// this next line is the only one that violates the standard
   934 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1); }
   935 	inline bool operator ! () const	{	// Is it bound to anything?
   936 			return !m_Closure; }
   937 	inline bool empty() const	{
   938 			return !m_Closure; }
   939 	void clear() { m_Closure.clear();}
   940 	// Conversion to and from the DelegateMemento storage class
   941 	const DelegateMemento & GetMemento() { return m_Closure; }
   942 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
   943 
   944 private:	// Invoker for static functions
   945 	RetType InvokeStaticFunction(Param1 p1) const {
   946 	return (*(m_Closure.GetStaticFunction()))(p1); }
   947 };
   948 
   949 //N=2
   950 template<class Param1, class Param2, class RetType=detail::DefaultVoid>
   951 class FastDelegate2 {
   952 private:
   953 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
   954 	typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2);
   955 	typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2);
   956 	typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2);
   957 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
   958 public:
   959 	// Typedefs to aid generic programming
   960 	typedef FastDelegate2 type;
   961 
   962 	// Construction and comparison functions
   963 	FastDelegate2() { clear(); }
   964 	FastDelegate2(const FastDelegate2 &x) {
   965 		m_Closure.CopyFrom(this, x.m_Closure); }
   966 	void operator = (const FastDelegate2 &x)  {
   967 		m_Closure.CopyFrom(this, x.m_Closure); }
   968 	bool operator ==(const FastDelegate2 &x) const {
   969 		return m_Closure.IsEqual(x.m_Closure);	}
   970 	bool operator !=(const FastDelegate2 &x) const {
   971 		return !m_Closure.IsEqual(x.m_Closure); }
   972 	bool operator <(const FastDelegate2 &x) const {
   973 		return m_Closure.IsLess(x.m_Closure);	}
   974 	bool operator >(const FastDelegate2 &x) const {
   975 		return x.m_Closure.IsLess(m_Closure);	}
   976 	// Binding to non-const member functions
   977 	template < class X, class Y >
   978 	FastDelegate2(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) ) {
   979 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
   980 	template < class X, class Y >
   981 	inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2)) {
   982 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
   983 	// Binding to const member functions.
   984 	template < class X, class Y >
   985 	FastDelegate2(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) const) {
   986 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
   987 	template < class X, class Y >
   988 	inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) const) {
   989 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
   990 	// Static functions. We convert them into a member function call.
   991 	// Note that this also provides a conversion from static functions.
   992 	FastDelegate2(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2) ) {
   993 		bind(function_to_bind);	}
   994 	inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2)) {
   995 		m_Closure.bindstaticfunc(this, &FastDelegate2::InvokeStaticFunction,
   996 			function_to_bind); }
   997 	RetType operator() (Param1 p1, Param2 p2) const { // Invoke the delegate
   998 		// this next line is the only one that violates the standard
   999 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2); }
  1000 	inline bool operator ! () const	{	// Is it bound to anything?
  1001 			return !m_Closure; }
  1002 	inline bool empty() const	{
  1003 			return !m_Closure; }
  1004 	void clear() { m_Closure.clear();}
  1005 	// Conversion to and from the DelegateMemento storage class
  1006 	const DelegateMemento & GetMemento() { return m_Closure; }
  1007 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1008 
  1009 private:	// Invoker for static functions
  1010 	RetType InvokeStaticFunction(Param1 p1, Param2 p2) const {
  1011 	return (*(m_Closure.GetStaticFunction()))(p1, p2); }
  1012 };
  1013 
  1014 //N=3
  1015 template<class Param1, class Param2, class Param3, class RetType=detail::DefaultVoid>
  1016 class FastDelegate3 {
  1017 private:
  1018 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1019 	typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
  1020 	typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
  1021 	typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3);
  1022 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1023 public:
  1024 	// Typedefs to aid generic programming
  1025 	typedef FastDelegate3 type;
  1026 
  1027 	// Construction and comparison functions
  1028 	FastDelegate3() { clear(); }
  1029 	FastDelegate3(const FastDelegate3 &x) {
  1030 		m_Closure.CopyFrom(this, x.m_Closure); }
  1031 	void operator = (const FastDelegate3 &x)  {
  1032 		m_Closure.CopyFrom(this, x.m_Closure); }
  1033 	bool operator ==(const FastDelegate3 &x) const {
  1034 		return m_Closure.IsEqual(x.m_Closure);	}
  1035 	bool operator !=(const FastDelegate3 &x) const {
  1036 		return !m_Closure.IsEqual(x.m_Closure); }
  1037 	bool operator <(const FastDelegate3 &x) const {
  1038 		return m_Closure.IsLess(x.m_Closure);	}
  1039 	bool operator >(const FastDelegate3 &x) const {
  1040 		return x.m_Closure.IsLess(m_Closure);	}
  1041 	// Binding to non-const member functions
  1042 	template < class X, class Y >
  1043 	FastDelegate3(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) {
  1044 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1045 	template < class X, class Y >
  1046 	inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
  1047 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1048 	// Binding to const member functions.
  1049 	template < class X, class Y >
  1050 	FastDelegate3(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const) {
  1051 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1052 	template < class X, class Y >
  1053 	inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const) {
  1054 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1055 	// Static functions. We convert them into a member function call.
  1056 	// Note that this also provides a conversion from static functions.
  1057 	FastDelegate3(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) {
  1058 		bind(function_to_bind);	}
  1059 	inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
  1060 		m_Closure.bindstaticfunc(this, &FastDelegate3::InvokeStaticFunction,
  1061 			function_to_bind); }
  1062 	RetType operator() (Param1 p1, Param2 p2, Param3 p3) const { // Invoke the delegate
  1063 		// this next line is the only one that violates the standard
  1064 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3); }
  1065 	inline bool operator ! () const	{	// Is it bound to anything?
  1066 			return !m_Closure; }
  1067 	inline bool empty() const	{
  1068 			return !m_Closure; }
  1069 	void clear() { m_Closure.clear();}
  1070 	// Conversion to and from the DelegateMemento storage class
  1071 	const DelegateMemento & GetMemento() { return m_Closure; }
  1072 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1073 
  1074 private:	// Invoker for static functions
  1075 	RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3) const {
  1076 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3); }
  1077 };
  1078 
  1079 //N=4
  1080 template<class Param1, class Param2, class Param3, class Param4, class RetType=detail::DefaultVoid>
  1081 class FastDelegate4 {
  1082 private:
  1083 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1084 	typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
  1085 	typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
  1086 	typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
  1087 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1088 public:
  1089 	// Typedefs to aid generic programming
  1090 	typedef FastDelegate4 type;
  1091 
  1092 	// Construction and comparison functions
  1093 	FastDelegate4() { clear(); }
  1094 	FastDelegate4(const FastDelegate4 &x) {
  1095 		m_Closure.CopyFrom(this, x.m_Closure); }
  1096 	void operator = (const FastDelegate4 &x)  {
  1097 		m_Closure.CopyFrom(this, x.m_Closure); }
  1098 	bool operator ==(const FastDelegate4 &x) const {
  1099 		return m_Closure.IsEqual(x.m_Closure);	}
  1100 	bool operator !=(const FastDelegate4 &x) const {
  1101 		return !m_Closure.IsEqual(x.m_Closure); }
  1102 	bool operator <(const FastDelegate4 &x) const {
  1103 		return m_Closure.IsLess(x.m_Closure);	}
  1104 	bool operator >(const FastDelegate4 &x) const {
  1105 		return x.m_Closure.IsLess(m_Closure);	}
  1106 	// Binding to non-const member functions
  1107 	template < class X, class Y >
  1108 	FastDelegate4(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) {
  1109 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1110 	template < class X, class Y >
  1111 	inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
  1112 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1113 	// Binding to const member functions.
  1114 	template < class X, class Y >
  1115 	FastDelegate4(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) {
  1116 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1117 	template < class X, class Y >
  1118 	inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) {
  1119 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1120 	// Static functions. We convert them into a member function call.
  1121 	// Note that this also provides a conversion from static functions.
  1122 	FastDelegate4(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) {
  1123 		bind(function_to_bind);	}
  1124 	inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
  1125 		m_Closure.bindstaticfunc(this, &FastDelegate4::InvokeStaticFunction,
  1126 			function_to_bind); }
  1127 	RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4) const { // Invoke the delegate
  1128 		// this next line is the only one that violates the standard
  1129 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4); }
  1130 	inline bool operator ! () const	{	// Is it bound to anything?
  1131 			return !m_Closure; }
  1132 	inline bool empty() const	{
  1133 			return !m_Closure; }
  1134 	void clear() { m_Closure.clear();}
  1135 	// Conversion to and from the DelegateMemento storage class
  1136 	const DelegateMemento & GetMemento() { return m_Closure; }
  1137 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1138 
  1139 private:	// Invoker for static functions
  1140 	RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const {
  1141 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4); }
  1142 };
  1143 
  1144 //N=5
  1145 template<class Param1, class Param2, class Param3, class Param4, class Param5, class RetType=detail::DefaultVoid>
  1146 class FastDelegate5 {
  1147 private:
  1148 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1149 	typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
  1150 	typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
  1151 	typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
  1152 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1153 public:
  1154 	// Typedefs to aid generic programming
  1155 	typedef FastDelegate5 type;
  1156 
  1157 	// Construction and comparison functions
  1158 	FastDelegate5() { clear(); }
  1159 	FastDelegate5(const FastDelegate5 &x) {
  1160 		m_Closure.CopyFrom(this, x.m_Closure); }
  1161 	void operator = (const FastDelegate5 &x)  {
  1162 		m_Closure.CopyFrom(this, x.m_Closure); }
  1163 	bool operator ==(const FastDelegate5 &x) const {
  1164 		return m_Closure.IsEqual(x.m_Closure);	}
  1165 	bool operator !=(const FastDelegate5 &x) const {
  1166 		return !m_Closure.IsEqual(x.m_Closure); }
  1167 	bool operator <(const FastDelegate5 &x) const {
  1168 		return m_Closure.IsLess(x.m_Closure);	}
  1169 	bool operator >(const FastDelegate5 &x) const {
  1170 		return x.m_Closure.IsLess(m_Closure);	}
  1171 	// Binding to non-const member functions
  1172 	template < class X, class Y >
  1173 	FastDelegate5(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) {
  1174 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1175 	template < class X, class Y >
  1176 	inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
  1177 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1178 	// Binding to const member functions.
  1179 	template < class X, class Y >
  1180 	FastDelegate5(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) {
  1181 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1182 	template < class X, class Y >
  1183 	inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) {
  1184 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1185 	// Static functions. We convert them into a member function call.
  1186 	// Note that this also provides a conversion from static functions.
  1187 	FastDelegate5(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) {
  1188 		bind(function_to_bind);	}
  1189 	inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
  1190 		m_Closure.bindstaticfunc(this, &FastDelegate5::InvokeStaticFunction,
  1191 			function_to_bind); }
  1192 	RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const { // Invoke the delegate
  1193 		// this next line is the only one that violates the standard
  1194 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5); }
  1195 	inline bool operator ! () const	{	// Is it bound to anything?
  1196 			return !m_Closure; }
  1197 	inline bool empty() const	{
  1198 			return !m_Closure; }
  1199 	void clear() { m_Closure.clear();}
  1200 	// Conversion to and from the DelegateMemento storage class
  1201 	const DelegateMemento & GetMemento() { return m_Closure; }
  1202 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1203 
  1204 private:	// Invoker for static functions
  1205 	RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const {
  1206 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5); }
  1207 };
  1208 
  1209 //N=6
  1210 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType=detail::DefaultVoid>
  1211 class FastDelegate6 {
  1212 private:
  1213 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1214 	typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
  1215 	typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
  1216 	typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
  1217 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1218 public:
  1219 	// Typedefs to aid generic programming
  1220 	typedef FastDelegate6 type;
  1221 
  1222 	// Construction and comparison functions
  1223 	FastDelegate6() { clear(); }
  1224 	FastDelegate6(const FastDelegate6 &x) {
  1225 		m_Closure.CopyFrom(this, x.m_Closure); }
  1226 	void operator = (const FastDelegate6 &x)  {
  1227 		m_Closure.CopyFrom(this, x.m_Closure); }
  1228 	bool operator ==(const FastDelegate6 &x) const {
  1229 		return m_Closure.IsEqual(x.m_Closure);	}
  1230 	bool operator !=(const FastDelegate6 &x) const {
  1231 		return !m_Closure.IsEqual(x.m_Closure); }
  1232 	bool operator <(const FastDelegate6 &x) const {
  1233 		return m_Closure.IsLess(x.m_Closure);	}
  1234 	bool operator >(const FastDelegate6 &x) const {
  1235 		return x.m_Closure.IsLess(m_Closure);	}
  1236 	// Binding to non-const member functions
  1237 	template < class X, class Y >
  1238 	FastDelegate6(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) {
  1239 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1240 	template < class X, class Y >
  1241 	inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
  1242 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1243 	// Binding to const member functions.
  1244 	template < class X, class Y >
  1245 	FastDelegate6(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) {
  1246 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1247 	template < class X, class Y >
  1248 	inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) {
  1249 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1250 	// Static functions. We convert them into a member function call.
  1251 	// Note that this also provides a conversion from static functions.
  1252 	FastDelegate6(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) {
  1253 		bind(function_to_bind);	}
  1254 	inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
  1255 		m_Closure.bindstaticfunc(this, &FastDelegate6::InvokeStaticFunction,
  1256 			function_to_bind); }
  1257 	RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const { // Invoke the delegate
  1258 		// this next line is the only one that violates the standard
  1259 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6); }
  1260 	inline bool operator ! () const	{	// Is it bound to anything?
  1261 			return !m_Closure; }
  1262 	inline bool empty() const	{
  1263 			return !m_Closure; }
  1264 	void clear() { m_Closure.clear();}
  1265 	// Conversion to and from the DelegateMemento storage class
  1266 	const DelegateMemento & GetMemento() { return m_Closure; }
  1267 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1268 
  1269 private:	// Invoker for static functions
  1270 	RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const {
  1271 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6); }
  1272 };
  1273 
  1274 //N=7
  1275 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType=detail::DefaultVoid>
  1276 class FastDelegate7 {
  1277 private:
  1278 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1279 	typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
  1280 	typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
  1281 	typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
  1282 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1283 public:
  1284 	// Typedefs to aid generic programming
  1285 	typedef FastDelegate7 type;
  1286 
  1287 	// Construction and comparison functions
  1288 	FastDelegate7() { clear(); }
  1289 	FastDelegate7(const FastDelegate7 &x) {
  1290 		m_Closure.CopyFrom(this, x.m_Closure); }
  1291 	void operator = (const FastDelegate7 &x)  {
  1292 		m_Closure.CopyFrom(this, x.m_Closure); }
  1293 	bool operator ==(const FastDelegate7 &x) const {
  1294 		return m_Closure.IsEqual(x.m_Closure);	}
  1295 	bool operator !=(const FastDelegate7 &x) const {
  1296 		return !m_Closure.IsEqual(x.m_Closure); }
  1297 	bool operator <(const FastDelegate7 &x) const {
  1298 		return m_Closure.IsLess(x.m_Closure);	}
  1299 	bool operator >(const FastDelegate7 &x) const {
  1300 		return x.m_Closure.IsLess(m_Closure);	}
  1301 	// Binding to non-const member functions
  1302 	template < class X, class Y >
  1303 	FastDelegate7(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) {
  1304 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1305 	template < class X, class Y >
  1306 	inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
  1307 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1308 	// Binding to const member functions.
  1309 	template < class X, class Y >
  1310 	FastDelegate7(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) {
  1311 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1312 	template < class X, class Y >
  1313 	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) {
  1314 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1315 	// Static functions. We convert them into a member function call.
  1316 	// Note that this also provides a conversion from static functions.
  1317 	FastDelegate7(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) {
  1318 		bind(function_to_bind);	}
  1319 	inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
  1320 		m_Closure.bindstaticfunc(this, &FastDelegate7::InvokeStaticFunction,
  1321 			function_to_bind); }
  1322 	RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const { // Invoke the delegate
  1323 		// this next line is the only one that violates the standard
  1324 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7); }
  1325 	inline bool operator ! () const	{	// Is it bound to anything?
  1326 			return !m_Closure; }
  1327 	inline bool empty() const	{
  1328 			return !m_Closure; }
  1329 	void clear() { m_Closure.clear();}
  1330 	// Conversion to and from the DelegateMemento storage class
  1331 	const DelegateMemento & GetMemento() { return m_Closure; }
  1332 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1333 
  1334 private:	// Invoker for static functions
  1335 	RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const {
  1336 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7); }
  1337 };
  1338 
  1339 //N=8
  1340 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType=detail::DefaultVoid>
  1341 class FastDelegate8 {
  1342 private:
  1343 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1344 	typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
  1345 	typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
  1346 	typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
  1347 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1348 public:
  1349 	// Typedefs to aid generic programming
  1350 	typedef FastDelegate8 type;
  1351 
  1352 	// Construction and comparison functions
  1353 	FastDelegate8() { clear(); }
  1354 	FastDelegate8(const FastDelegate8 &x) {
  1355 		m_Closure.CopyFrom(this, x.m_Closure); }
  1356 	void operator = (const FastDelegate8 &x)  {
  1357 		m_Closure.CopyFrom(this, x.m_Closure); }
  1358 	bool operator ==(const FastDelegate8 &x) const {
  1359 		return m_Closure.IsEqual(x.m_Closure);	}
  1360 	bool operator !=(const FastDelegate8 &x) const {
  1361 		return !m_Closure.IsEqual(x.m_Closure); }
  1362 	bool operator <(const FastDelegate8 &x) const {
  1363 		return m_Closure.IsLess(x.m_Closure);	}
  1364 	bool operator >(const FastDelegate8 &x) const {
  1365 		return x.m_Closure.IsLess(m_Closure);	}
  1366 	// Binding to non-const member functions
  1367 	template < class X, class Y >
  1368 	FastDelegate8(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) {
  1369 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1370 	template < class X, class Y >
  1371 	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)) {
  1372 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1373 	// Binding to const member functions.
  1374 	template < class X, class Y >
  1375 	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) {
  1376 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1377 	template < class X, class Y >
  1378 	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) {
  1379 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1380 	// Static functions. We convert them into a member function call.
  1381 	// Note that this also provides a conversion from static functions.
  1382 	FastDelegate8(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) {
  1383 		bind(function_to_bind);	}
  1384 	inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
  1385 		m_Closure.bindstaticfunc(this, &FastDelegate8::InvokeStaticFunction,
  1386 			function_to_bind); }
  1387 	RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const { // Invoke the delegate
  1388 		// this next line is the only one that violates the standard
  1389 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8); }
  1390 	inline bool operator ! () const	{	// Is it bound to anything?
  1391 			return !m_Closure; }
  1392 	inline bool empty() const	{
  1393 			return !m_Closure; }
  1394 	void clear() { m_Closure.clear();}
  1395 	// Conversion to and from the DelegateMemento storage class
  1396 	const DelegateMemento & GetMemento() { return m_Closure; }
  1397 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1398 
  1399 private:	// Invoker for static functions
  1400 	RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const {
  1401 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8); }
  1402 };
  1403 
  1404 //N=9
  1405 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class RetType=detail::DefaultVoid>
  1406 class FastDelegate9 {
  1407 private:
  1408 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1409 	typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9);
  1410 	typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9);
  1411 	typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9);
  1412 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1413 public:
  1414 	// Typedefs to aid generic programming
  1415 	typedef FastDelegate9 type;
  1416 
  1417 	// Construction and comparison functions
  1418 	FastDelegate9() { clear(); }
  1419 	FastDelegate9(const FastDelegate9 &x) {
  1420 		m_Closure.CopyFrom(this, x.m_Closure); }
  1421 	void operator = (const FastDelegate9 &x)  {
  1422 		m_Closure.CopyFrom(this, x.m_Closure); }
  1423 	bool operator ==(const FastDelegate9 &x) const {
  1424 		return m_Closure.IsEqual(x.m_Closure);	}
  1425 	bool operator !=(const FastDelegate9 &x) const {
  1426 		return !m_Closure.IsEqual(x.m_Closure); }
  1427 	bool operator <(const FastDelegate9 &x) const {
  1428 		return m_Closure.IsLess(x.m_Closure);	}
  1429 	bool operator >(const FastDelegate9 &x) const {
  1430 		return x.m_Closure.IsLess(m_Closure);	}
  1431 	// Binding to non-const member functions
  1432 	template < class X, class Y >
  1433 	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) ) {
  1434 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1435 	template < class X, class Y >
  1436 	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)) {
  1437 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1438 	// Binding to const member functions.
  1439 	template < class X, class Y >
  1440 	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) {
  1441 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1442 	template < class X, class Y >
  1443 	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) {
  1444 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1445 	// Static functions. We convert them into a member function call.
  1446 	// Note that this also provides a conversion from static functions.
  1447 	FastDelegate9(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) ) {
  1448 		bind(function_to_bind);	}
  1449 	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)) {
  1450 		m_Closure.bindstaticfunc(this, &FastDelegate9::InvokeStaticFunction,
  1451 			function_to_bind); }
  1452 	RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) const { // Invoke the delegate
  1453 		// this next line is the only one that violates the standard
  1454 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9); }
  1455 	inline bool operator ! () const	{	// Is it bound to anything?
  1456 			return !m_Closure; }
  1457 	inline bool empty() const	{
  1458 			return !m_Closure; }
  1459 	void clear() { m_Closure.clear();}
  1460 	// Conversion to and from the DelegateMemento storage class
  1461 	const DelegateMemento & GetMemento() { return m_Closure; }
  1462 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1463 
  1464 private:	// Invoker for static functions
  1465 	RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) const {
  1466 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9); }
  1467 };
  1468 
  1469 //N=10
  1470 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>
  1471 class FastDelegate10 {
  1472 private:
  1473 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1474 	typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10);
  1475 	typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10);
  1476 	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);
  1477 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1478 public:
  1479 	// Typedefs to aid generic programming
  1480 	typedef FastDelegate10 type;
  1481 
  1482 	// Construction and comparison functions
  1483 	FastDelegate10() { clear(); }
  1484 	FastDelegate10(const FastDelegate10 &x) {
  1485 		m_Closure.CopyFrom(this, x.m_Closure); }
  1486 	void operator = (const FastDelegate10 &x)  {
  1487 		m_Closure.CopyFrom(this, x.m_Closure); }
  1488 	bool operator ==(const FastDelegate10 &x) const {
  1489 		return m_Closure.IsEqual(x.m_Closure);	}
  1490 	bool operator !=(const FastDelegate10 &x) const {
  1491 		return !m_Closure.IsEqual(x.m_Closure); }
  1492 	bool operator <(const FastDelegate10 &x) const {
  1493 		return m_Closure.IsLess(x.m_Closure);	}
  1494 	bool operator >(const FastDelegate10 &x) const {
  1495 		return x.m_Closure.IsLess(m_Closure);	}
  1496 	// Binding to non-const member functions
  1497 	template < class X, class Y >
  1498 	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) ) {
  1499 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1500 	template < class X, class Y >
  1501 	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)) {
  1502 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1503 	// Binding to const member functions.
  1504 	template < class X, class Y >
  1505 	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) {
  1506 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1507 	template < class X, class Y >
  1508 	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) {
  1509 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1510 	// Static functions. We convert them into a member function call.
  1511 	// Note that this also provides a conversion from static functions.
  1512 	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) ) {
  1513 		bind(function_to_bind);	}
  1514 	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)) {
  1515 		m_Closure.bindstaticfunc(this, &FastDelegate10::InvokeStaticFunction,
  1516 			function_to_bind); }
  1517 	RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10) const { // Invoke the delegate
  1518 		// this next line is the only one that violates the standard
  1519 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); }
  1520 	inline bool operator ! () const	{	// Is it bound to anything?
  1521 			return !m_Closure; }
  1522 	inline bool empty() const	{
  1523 			return !m_Closure; }
  1524 	void clear() { m_Closure.clear();}
  1525 	// Conversion to and from the DelegateMemento storage class
  1526 	const DelegateMemento & GetMemento() { return m_Closure; }
  1527 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1528 
  1529 private:	// Invoker for static functions
  1530 	RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10) const {
  1531 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); }
  1532 };
  1533 
  1534 //N=11
  1535 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>
  1536 class FastDelegate11 {
  1537 private:
  1538 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1539 	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);
  1540 	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);
  1541 	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);
  1542 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1543 public:
  1544 	// Typedefs to aid generic programming
  1545 	typedef FastDelegate11 type;
  1546 
  1547 	// Construction and comparison functions
  1548 	FastDelegate11() { clear(); }
  1549 	FastDelegate11(const FastDelegate11 &x) {
  1550 		m_Closure.CopyFrom(this, x.m_Closure); }
  1551 	void operator = (const FastDelegate11 &x)  {
  1552 		m_Closure.CopyFrom(this, x.m_Closure); }
  1553 	bool operator ==(const FastDelegate11 &x) const {
  1554 		return m_Closure.IsEqual(x.m_Closure);	}
  1555 	bool operator !=(const FastDelegate11 &x) const {
  1556 		return !m_Closure.IsEqual(x.m_Closure); }
  1557 	bool operator <(const FastDelegate11 &x) const {
  1558 		return m_Closure.IsLess(x.m_Closure);	}
  1559 	bool operator >(const FastDelegate11 &x) const {
  1560 		return x.m_Closure.IsLess(m_Closure);	}
  1561 	// Binding to non-const member functions
  1562 	template < class X, class Y >
  1563 	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) ) {
  1564 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1565 	template < class X, class Y >
  1566 	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)) {
  1567 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1568 	// Binding to const member functions.
  1569 	template < class X, class Y >
  1570 	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) {
  1571 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1572 	template < class X, class Y >
  1573 	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) {
  1574 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1575 	// Static functions. We convert them into a member function call.
  1576 	// Note that this also provides a conversion from static functions.
  1577 	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) ) {
  1578 		bind(function_to_bind);	}
  1579 	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)) {
  1580 		m_Closure.bindstaticfunc(this, &FastDelegate11::InvokeStaticFunction,
  1581 			function_to_bind); }
  1582 	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 { // Invoke the delegate
  1583 		// this next line is the only one that violates the standard
  1584 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); }
  1585 	inline bool operator ! () const	{	// Is it bound to anything?
  1586 			return !m_Closure; }
  1587 	inline bool empty() const	{
  1588 			return !m_Closure; }
  1589 	void clear() { m_Closure.clear();}
  1590 	// Conversion to and from the DelegateMemento storage class
  1591 	const DelegateMemento & GetMemento() { return m_Closure; }
  1592 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1593 
  1594 private:	// Invoker for static functions
  1595 	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 {
  1596 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); }
  1597 };
  1598 
  1599 //N=12
  1600 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>
  1601 class FastDelegate12 {
  1602 private:
  1603 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1604 	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);
  1605 	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);
  1606 	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);
  1607 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1608 public:
  1609 	// Typedefs to aid generic programming
  1610 	typedef FastDelegate12 type;
  1611 
  1612 	// Construction and comparison functions
  1613 	FastDelegate12() { clear(); }
  1614 	FastDelegate12(const FastDelegate12 &x) {
  1615 		m_Closure.CopyFrom(this, x.m_Closure); }
  1616 	void operator = (const FastDelegate12 &x)  {
  1617 		m_Closure.CopyFrom(this, x.m_Closure); }
  1618 	bool operator ==(const FastDelegate12 &x) const {
  1619 		return m_Closure.IsEqual(x.m_Closure);	}
  1620 	bool operator !=(const FastDelegate12 &x) const {
  1621 		return !m_Closure.IsEqual(x.m_Closure); }
  1622 	bool operator <(const FastDelegate12 &x) const {
  1623 		return m_Closure.IsLess(x.m_Closure);	}
  1624 	bool operator >(const FastDelegate12 &x) const {
  1625 		return x.m_Closure.IsLess(m_Closure);	}
  1626 	// Binding to non-const member functions
  1627 	template < class X, class Y >
  1628 	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) ) {
  1629 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1630 	template < class X, class Y >
  1631 	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)) {
  1632 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1633 	// Binding to const member functions.
  1634 	template < class X, class Y >
  1635 	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) {
  1636 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1637 	template < class X, class Y >
  1638 	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) {
  1639 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1640 	// Static functions. We convert them into a member function call.
  1641 	// Note that this also provides a conversion from static functions.
  1642 	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) ) {
  1643 		bind(function_to_bind);	}
  1644 	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)) {
  1645 		m_Closure.bindstaticfunc(this, &FastDelegate12::InvokeStaticFunction,
  1646 			function_to_bind); }
  1647 	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 { // Invoke the delegate
  1648 		// this next line is the only one that violates the standard
  1649 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); }
  1650 	inline bool operator ! () const	{	// Is it bound to anything?
  1651 			return !m_Closure; }
  1652 	inline bool empty() const	{
  1653 			return !m_Closure; }
  1654 	void clear() { m_Closure.clear();}
  1655 	// Conversion to and from the DelegateMemento storage class
  1656 	const DelegateMemento & GetMemento() { return m_Closure; }
  1657 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1658 
  1659 private:	// Invoker for static functions
  1660 	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 {
  1661 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); }
  1662 };
  1663 
  1664 //N=13
  1665 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>
  1666 class FastDelegate13 {
  1667 private:
  1668 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1669 	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);
  1670 	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);
  1671 	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);
  1672 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1673 public:
  1674 	// Typedefs to aid generic programming
  1675 	typedef FastDelegate13 type;
  1676 
  1677 	// Construction and comparison functions
  1678 	FastDelegate13() { clear(); }
  1679 	FastDelegate13(const FastDelegate13 &x) {
  1680 		m_Closure.CopyFrom(this, x.m_Closure); }
  1681 	void operator = (const FastDelegate13 &x)  {
  1682 		m_Closure.CopyFrom(this, x.m_Closure); }
  1683 	bool operator ==(const FastDelegate13 &x) const {
  1684 		return m_Closure.IsEqual(x.m_Closure);	}
  1685 	bool operator !=(const FastDelegate13 &x) const {
  1686 		return !m_Closure.IsEqual(x.m_Closure); }
  1687 	bool operator <(const FastDelegate13 &x) const {
  1688 		return m_Closure.IsLess(x.m_Closure);	}
  1689 	bool operator >(const FastDelegate13 &x) const {
  1690 		return x.m_Closure.IsLess(m_Closure);	}
  1691 	// Binding to non-const member functions
  1692 	template < class X, class Y >
  1693 	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) ) {
  1694 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1695 	template < class X, class Y >
  1696 	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)) {
  1697 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1698 	// Binding to const member functions.
  1699 	template < class X, class Y >
  1700 	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) {
  1701 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1702 	template < class X, class Y >
  1703 	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) {
  1704 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1705 	// Static functions. We convert them into a member function call.
  1706 	// Note that this also provides a conversion from static functions.
  1707 	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) ) {
  1708 		bind(function_to_bind);	}
  1709 	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)) {
  1710 		m_Closure.bindstaticfunc(this, &FastDelegate13::InvokeStaticFunction,
  1711 			function_to_bind); }
  1712 	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 { // Invoke the delegate
  1713 		// this next line is the only one that violates the standard
  1714 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); }
  1715 	inline bool operator ! () const	{	// Is it bound to anything?
  1716 			return !m_Closure; }
  1717 	inline bool empty() const	{
  1718 			return !m_Closure; }
  1719 	void clear() { m_Closure.clear();}
  1720 	// Conversion to and from the DelegateMemento storage class
  1721 	const DelegateMemento & GetMemento() { return m_Closure; }
  1722 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1723 
  1724 private:	// Invoker for static functions
  1725 	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 {
  1726 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); }
  1727 };
  1728 
  1729 //N=14
  1730 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>
  1731 class FastDelegate14 {
  1732 private:
  1733 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1734 	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);
  1735 	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);
  1736 	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);
  1737 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1738 public:
  1739 	// Typedefs to aid generic programming
  1740 	typedef FastDelegate14 type;
  1741 
  1742 	// Construction and comparison functions
  1743 	FastDelegate14() { clear(); }
  1744 	FastDelegate14(const FastDelegate14 &x) {
  1745 		m_Closure.CopyFrom(this, x.m_Closure); }
  1746 	void operator = (const FastDelegate14 &x)  {
  1747 		m_Closure.CopyFrom(this, x.m_Closure); }
  1748 	bool operator ==(const FastDelegate14 &x) const {
  1749 		return m_Closure.IsEqual(x.m_Closure);	}
  1750 	bool operator !=(const FastDelegate14 &x) const {
  1751 		return !m_Closure.IsEqual(x.m_Closure); }
  1752 	bool operator <(const FastDelegate14 &x) const {
  1753 		return m_Closure.IsLess(x.m_Closure);	}
  1754 	bool operator >(const FastDelegate14 &x) const {
  1755 		return x.m_Closure.IsLess(m_Closure);	}
  1756 	// Binding to non-const member functions
  1757 	template < class X, class Y >
  1758 	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) ) {
  1759 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1760 	template < class X, class Y >
  1761 	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)) {
  1762 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1763 	// Binding to const member functions.
  1764 	template < class X, class Y >
  1765 	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) {
  1766 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1767 	template < class X, class Y >
  1768 	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) {
  1769 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1770 	// Static functions. We convert them into a member function call.
  1771 	// Note that this also provides a conversion from static functions.
  1772 	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) ) {
  1773 		bind(function_to_bind);	}
  1774 	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)) {
  1775 		m_Closure.bindstaticfunc(this, &FastDelegate14::InvokeStaticFunction,
  1776 			function_to_bind); }
  1777 	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 { // Invoke the delegate
  1778 		// this next line is the only one that violates the standard
  1779 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); }
  1780 	inline bool operator ! () const	{	// Is it bound to anything?
  1781 			return !m_Closure; }
  1782 	inline bool empty() const	{
  1783 			return !m_Closure; }
  1784 	void clear() { m_Closure.clear();}
  1785 	// Conversion to and from the DelegateMemento storage class
  1786 	const DelegateMemento & GetMemento() { return m_Closure; }
  1787 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1788 
  1789 private:	// Invoker for static functions
  1790 	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 {
  1791 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); }
  1792 };
  1793 
  1794 //N=15
  1795 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>
  1796 class FastDelegate15 {
  1797 private:
  1798 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1799 	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);
  1800 	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);
  1801 	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);
  1802 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1803 public:
  1804 	// Typedefs to aid generic programming
  1805 	typedef FastDelegate15 type;
  1806 
  1807 	// Construction and comparison functions
  1808 	FastDelegate15() { clear(); }
  1809 	FastDelegate15(const FastDelegate15 &x) {
  1810 		m_Closure.CopyFrom(this, x.m_Closure); }
  1811 	void operator = (const FastDelegate15 &x)  {
  1812 		m_Closure.CopyFrom(this, x.m_Closure); }
  1813 	bool operator ==(const FastDelegate15 &x) const {
  1814 		return m_Closure.IsEqual(x.m_Closure);	}
  1815 	bool operator !=(const FastDelegate15 &x) const {
  1816 		return !m_Closure.IsEqual(x.m_Closure); }
  1817 	bool operator <(const FastDelegate15 &x) const {
  1818 		return m_Closure.IsLess(x.m_Closure);	}
  1819 	bool operator >(const FastDelegate15 &x) const {
  1820 		return x.m_Closure.IsLess(m_Closure);	}
  1821 	// Binding to non-const member functions
  1822 	template < class X, class Y >
  1823 	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) ) {
  1824 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1825 	template < class X, class Y >
  1826 	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)) {
  1827 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1828 	// Binding to const member functions.
  1829 	template < class X, class Y >
  1830 	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) {
  1831 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1832 	template < class X, class Y >
  1833 	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) {
  1834 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1835 	// Static functions. We convert them into a member function call.
  1836 	// Note that this also provides a conversion from static functions.
  1837 	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) ) {
  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, Param12 p12, Param13 p13, Param14 p14, Param15 p15)) {
  1840 		m_Closure.bindstaticfunc(this, &FastDelegate15::InvokeStaticFunction,
  1841 			function_to_bind); }
  1842 	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 { // Invoke the delegate
  1843 		// this next line is the only one that violates the standard
  1844 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); }
  1845 	inline bool operator ! () const	{	// Is it bound to anything?
  1846 			return !m_Closure; }
  1847 	inline bool empty() const	{
  1848 			return !m_Closure; }
  1849 	void clear() { m_Closure.clear();}
  1850 	// Conversion to and from the DelegateMemento storage class
  1851 	const DelegateMemento & GetMemento() { return m_Closure; }
  1852 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1853 
  1854 private:	// Invoker for static functions
  1855 	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 {
  1856 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); }
  1857 };
  1858 
  1859 //N=16
  1860 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>
  1861 class FastDelegate16 {
  1862 private:
  1863 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1864 	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);
  1865 	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);
  1866 	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);
  1867 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1868 public:
  1869 	// Typedefs to aid generic programming
  1870 	typedef FastDelegate16 type;
  1871 
  1872 	// Construction and comparison functions
  1873 	FastDelegate16() { clear(); }
  1874 	FastDelegate16(const FastDelegate16 &x) {
  1875 		m_Closure.CopyFrom(this, x.m_Closure); }
  1876 	void operator = (const FastDelegate16 &x)  {
  1877 		m_Closure.CopyFrom(this, x.m_Closure); }
  1878 	bool operator ==(const FastDelegate16 &x) const {
  1879 		return m_Closure.IsEqual(x.m_Closure);	}
  1880 	bool operator !=(const FastDelegate16 &x) const {
  1881 		return !m_Closure.IsEqual(x.m_Closure); }
  1882 	bool operator <(const FastDelegate16 &x) const {
  1883 		return m_Closure.IsLess(x.m_Closure);	}
  1884 	bool operator >(const FastDelegate16 &x) const {
  1885 		return x.m_Closure.IsLess(m_Closure);	}
  1886 	// Binding to non-const member functions
  1887 	template < class X, class Y >
  1888 	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) ) {
  1889 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1890 	template < class X, class Y >
  1891 	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)) {
  1892 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1893 	// Binding to const member functions.
  1894 	template < class X, class Y >
  1895 	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) {
  1896 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1897 	template < class X, class Y >
  1898 	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) {
  1899 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1900 	// Static functions. We convert them into a member function call.
  1901 	// Note that this also provides a conversion from static functions.
  1902 	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) ) {
  1903 		bind(function_to_bind);	}
  1904 	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)) {
  1905 		m_Closure.bindstaticfunc(this, &FastDelegate16::InvokeStaticFunction,
  1906 			function_to_bind); }
  1907 	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 { // Invoke the delegate
  1908 		// this next line is the only one that violates the standard
  1909 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16); }
  1910 	inline bool operator ! () const	{	// Is it bound to anything?
  1911 			return !m_Closure; }
  1912 	inline bool empty() const	{
  1913 			return !m_Closure; }
  1914 	void clear() { m_Closure.clear();}
  1915 	// Conversion to and from the DelegateMemento storage class
  1916 	const DelegateMemento & GetMemento() { return m_Closure; }
  1917 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1918 
  1919 private:	// Invoker for static functions
  1920 	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 {
  1921 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16); }
  1922 };
  1923 
  1924 //N=17
  1925 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>
  1926 class FastDelegate17 {
  1927 private:
  1928 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1929 	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);
  1930 	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);
  1931 	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);
  1932 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1933 public:
  1934 	// Typedefs to aid generic programming
  1935 	typedef FastDelegate17 type;
  1936 
  1937 	// Construction and comparison functions
  1938 	FastDelegate17() { clear(); }
  1939 	FastDelegate17(const FastDelegate17 &x) {
  1940 		m_Closure.CopyFrom(this, x.m_Closure); }
  1941 	void operator = (const FastDelegate17 &x)  {
  1942 		m_Closure.CopyFrom(this, x.m_Closure); }
  1943 	bool operator ==(const FastDelegate17 &x) const {
  1944 		return m_Closure.IsEqual(x.m_Closure);	}
  1945 	bool operator !=(const FastDelegate17 &x) const {
  1946 		return !m_Closure.IsEqual(x.m_Closure); }
  1947 	bool operator <(const FastDelegate17 &x) const {
  1948 		return m_Closure.IsLess(x.m_Closure);	}
  1949 	bool operator >(const FastDelegate17 &x) const {
  1950 		return x.m_Closure.IsLess(m_Closure);	}
  1951 	// Binding to non-const member functions
  1952 	template < class X, class Y >
  1953 	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) ) {
  1954 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  1955 	template < class X, class Y >
  1956 	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)) {
  1957 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  1958 	// Binding to const member functions.
  1959 	template < class X, class Y >
  1960 	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) {
  1961 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  1962 	template < class X, class Y >
  1963 	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) {
  1964 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  1965 	// Static functions. We convert them into a member function call.
  1966 	// Note that this also provides a conversion from static functions.
  1967 	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) ) {
  1968 		bind(function_to_bind);	}
  1969 	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)) {
  1970 		m_Closure.bindstaticfunc(this, &FastDelegate17::InvokeStaticFunction,
  1971 			function_to_bind); }
  1972 	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 { // Invoke the delegate
  1973 		// this next line is the only one that violates the standard
  1974 	return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17); }
  1975 	inline bool operator ! () const	{	// Is it bound to anything?
  1976 			return !m_Closure; }
  1977 	inline bool empty() const	{
  1978 			return !m_Closure; }
  1979 	void clear() { m_Closure.clear();}
  1980 	// Conversion to and from the DelegateMemento storage class
  1981 	const DelegateMemento & GetMemento() { return m_Closure; }
  1982 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  1983 
  1984 private:	// Invoker for static functions
  1985 	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 {
  1986 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17); }
  1987 };
  1988 
  1989 //N=18
  1990 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>
  1991 class FastDelegate18 {
  1992 private:
  1993 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  1994 	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);
  1995 	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);
  1996 	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);
  1997 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  1998 public:
  1999 	// Typedefs to aid generic programming
  2000 	typedef FastDelegate18 type;
  2001 
  2002 	// Construction and comparison functions
  2003 	FastDelegate18() { clear(); }
  2004 	FastDelegate18(const FastDelegate18 &x) {
  2005 		m_Closure.CopyFrom(this, x.m_Closure); }
  2006 	void operator = (const FastDelegate18 &x)  {
  2007 		m_Closure.CopyFrom(this, x.m_Closure); }
  2008 	bool operator ==(const FastDelegate18 &x) const {
  2009 		return m_Closure.IsEqual(x.m_Closure);	}
  2010 	bool operator !=(const FastDelegate18 &x) const {
  2011 		return !m_Closure.IsEqual(x.m_Closure); }
  2012 	bool operator <(const FastDelegate18 &x) const {
  2013 		return m_Closure.IsLess(x.m_Closure);	}
  2014 	bool operator >(const FastDelegate18 &x) const {
  2015 		return x.m_Closure.IsLess(m_Closure);	}
  2016 	// Binding to non-const member functions
  2017 	template < class X, class Y >
  2018 	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) ) {
  2019 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  2020 	template < class X, class Y >
  2021 	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)) {
  2022 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  2023 	// Binding to const member functions.
  2024 	template < class X, class Y >
  2025 	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) {
  2026 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  2027 	template < class X, class Y >
  2028 	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) {
  2029 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  2030 	// Static functions. We convert them into a member function call.
  2031 	// Note that this also provides a conversion from static functions.
  2032 	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) ) {
  2033 		bind(function_to_bind);	}
  2034 	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)) {
  2035 		m_Closure.bindstaticfunc(this, &FastDelegate18::InvokeStaticFunction,
  2036 			function_to_bind); }
  2037 	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 { // Invoke the delegate
  2038 		// this next line is the only one that violates the standard
  2039 	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); }
  2040 	inline bool operator ! () const	{	// Is it bound to anything?
  2041 			return !m_Closure; }
  2042 	inline bool empty() const	{
  2043 			return !m_Closure; }
  2044 	void clear() { m_Closure.clear();}
  2045 	// Conversion to and from the DelegateMemento storage class
  2046 	const DelegateMemento & GetMemento() { return m_Closure; }
  2047 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  2048 
  2049 private:	// Invoker for static functions
  2050 	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 {
  2051 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18); }
  2052 };
  2053 
  2054 //N=19
  2055 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>
  2056 class FastDelegate19 {
  2057 private:
  2058 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  2059 	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);
  2060 	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);
  2061 	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);
  2062 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  2063 public:
  2064 	// Typedefs to aid generic programming
  2065 	typedef FastDelegate19 type;
  2066 
  2067 	// Construction and comparison functions
  2068 	FastDelegate19() { clear(); }
  2069 	FastDelegate19(const FastDelegate19 &x) {
  2070 		m_Closure.CopyFrom(this, x.m_Closure); }
  2071 	void operator = (const FastDelegate19 &x)  {
  2072 		m_Closure.CopyFrom(this, x.m_Closure); }
  2073 	bool operator ==(const FastDelegate19 &x) const {
  2074 		return m_Closure.IsEqual(x.m_Closure);	}
  2075 	bool operator !=(const FastDelegate19 &x) const {
  2076 		return !m_Closure.IsEqual(x.m_Closure); }
  2077 	bool operator <(const FastDelegate19 &x) const {
  2078 		return m_Closure.IsLess(x.m_Closure);	}
  2079 	bool operator >(const FastDelegate19 &x) const {
  2080 		return x.m_Closure.IsLess(m_Closure);	}
  2081 	// Binding to non-const member functions
  2082 	template < class X, class Y >
  2083 	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) ) {
  2084 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  2085 	template < class X, class Y >
  2086 	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)) {
  2087 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  2088 	// Binding to const member functions.
  2089 	template < class X, class Y >
  2090 	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) {
  2091 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  2092 	template < class X, class Y >
  2093 	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) {
  2094 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  2095 	// Static functions. We convert them into a member function call.
  2096 	// Note that this also provides a conversion from static functions.
  2097 	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) ) {
  2098 		bind(function_to_bind);	}
  2099 	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)) {
  2100 		m_Closure.bindstaticfunc(this, &FastDelegate19::InvokeStaticFunction,
  2101 			function_to_bind); }
  2102 	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 { // Invoke the delegate
  2103 		// this next line is the only one that violates the standard
  2104 	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); }
  2105 	inline bool operator ! () const	{	// Is it bound to anything?
  2106 			return !m_Closure; }
  2107 	inline bool empty() const	{
  2108 			return !m_Closure; }
  2109 	void clear() { m_Closure.clear();}
  2110 	// Conversion to and from the DelegateMemento storage class
  2111 	const DelegateMemento & GetMemento() { return m_Closure; }
  2112 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  2113 
  2114 private:	// Invoker for static functions
  2115 	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 {
  2116 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19); }
  2117 };
  2118 
  2119 //N=20
  2120 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>
  2121 class FastDelegate20 {
  2122 private:
  2123 	typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
  2124 	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);
  2125 	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);
  2126 	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);
  2127 	detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
  2128 public:
  2129 	// Typedefs to aid generic programming
  2130 	typedef FastDelegate20 type;
  2131 
  2132 	// Construction and comparison functions
  2133 	FastDelegate20() { clear(); }
  2134 	FastDelegate20(const FastDelegate20 &x) {
  2135 		m_Closure.CopyFrom(this, x.m_Closure); }
  2136 	void operator = (const FastDelegate20 &x)  {
  2137 		m_Closure.CopyFrom(this, x.m_Closure); }
  2138 	bool operator ==(const FastDelegate20 &x) const {
  2139 		return m_Closure.IsEqual(x.m_Closure);	}
  2140 	bool operator !=(const FastDelegate20 &x) const {
  2141 		return !m_Closure.IsEqual(x.m_Closure); }
  2142 	bool operator <(const FastDelegate20 &x) const {
  2143 		return m_Closure.IsLess(x.m_Closure);	}
  2144 	bool operator >(const FastDelegate20 &x) const {
  2145 		return x.m_Closure.IsLess(m_Closure);	}
  2146 	// Binding to non-const member functions
  2147 	template < class X, class Y >
  2148 	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) ) {
  2149 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
  2150 	template < class X, class Y >
  2151 	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)) {
  2152 		m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);	}
  2153 	// Binding to const member functions.
  2154 	template < class X, class Y >
  2155 	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) {
  2156 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);	}
  2157 	template < class X, class Y >
  2158 	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) {
  2159 		m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind);	}
  2160 	// Static functions. We convert them into a member function call.
  2161 	// Note that this also provides a conversion from static functions.
  2162 	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) ) {
  2163 		bind(function_to_bind);	}
  2164 	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)) {
  2165 		m_Closure.bindstaticfunc(this, &FastDelegate20::InvokeStaticFunction,
  2166 			function_to_bind); }
  2167 	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 { // Invoke the delegate
  2168 		// this next line is the only one that violates the standard
  2169 	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); }
  2170 	inline bool operator ! () const	{	// Is it bound to anything?
  2171 			return !m_Closure; }
  2172 	inline bool empty() const	{
  2173 			return !m_Closure; }
  2174 	void clear() { m_Closure.clear();}
  2175 	// Conversion to and from the DelegateMemento storage class
  2176 	const DelegateMemento & GetMemento() { return m_Closure; }
  2177 	void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
  2178 
  2179 private:	// Invoker for static functions
  2180 	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 {
  2181 	return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20); }
  2182 };
  2183 
  2184 
  2185 ////////////////////////////////////////////////////////////////////////////////
  2186 //						Fast Delegates, part 4:
  2187 //
  2188 //				FastDelegate<> class (Original author: Jody Hagins)
  2189 //	Allows boost::function style syntax like:
  2190 //			FastDelegate< double (int, long) >
  2191 // instead of:
  2192 //			FastDelegate2< int, long, double >
  2193 //
  2194 ////////////////////////////////////////////////////////////////////////////////
  2195 
  2196 #ifdef FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
  2197 
  2198 // Declare FastDelegate as a class template.  It will be specialized
  2199 // later for all number of arguments.
  2200 template <typename Signature>
  2201 class FastDelegate;
  2202 
  2203 //N=0
  2204 // Specialization to allow use of
  2205 // FastDelegate< R (  ) >
  2206 // instead of
  2207 // FastDelegate0 < R >
  2208 template<typename R>
  2209 class FastDelegate< R (  ) >
  2210   // Inherit from FastDelegate0 so that it can be treated just
  2211   // like a FastDelegate0
  2212   : public FastDelegate0 < R >
  2213 {
  2214 public:
  2215   // Make using the base type a bit easier via typedef.
  2216   typedef FastDelegate0 < R > BaseType;
  2217 
  2218   // Allow users access to the specific type of this delegate.
  2219   typedef FastDelegate SelfType;
  2220 
  2221   // Mimic the base class constructors.
  2222   FastDelegate() : BaseType() { }
  2223 
  2224   template < class X, class Y >
  2225   FastDelegate(Y * pthis,
  2226     R (X::* function_to_bind)(  ))
  2227     : BaseType(pthis, function_to_bind)  { }
  2228 
  2229   template < class X, class Y >
  2230   FastDelegate(const Y *pthis,
  2231       R (X::* function_to_bind)(  ) const)
  2232     : BaseType(pthis, function_to_bind)
  2233   {  }
  2234 
  2235   FastDelegate(R (*function_to_bind)(  ))
  2236     : BaseType(function_to_bind)  { }
  2237   void operator = (const BaseType &x)  {
  2238 		*static_cast<BaseType*>(this) = x; }
  2239 };
  2240 
  2241 //N=1
  2242 // Specialization to allow use of
  2243 // FastDelegate< R ( Param1 ) >
  2244 // instead of
  2245 // FastDelegate1 < Param1, R >
  2246 template<typename R, class Param1>
  2247 class FastDelegate< R ( Param1 ) >
  2248   // Inherit from FastDelegate1 so that it can be treated just
  2249   // like a FastDelegate1
  2250   : public FastDelegate1 < Param1, R >
  2251 {
  2252 public:
  2253   // Make using the base type a bit easier via typedef.
  2254   typedef FastDelegate1 < Param1, R > BaseType;
  2255 
  2256   // Allow users access to the specific type of this delegate.
  2257   typedef FastDelegate SelfType;
  2258 
  2259   // Mimic the base class constructors.
  2260   FastDelegate() : BaseType() { }
  2261 
  2262   template < class X, class Y >
  2263   FastDelegate(Y * pthis,
  2264     R (X::* function_to_bind)( Param1 p1 ))
  2265     : BaseType(pthis, function_to_bind)  { }
  2266 
  2267   template < class X, class Y >
  2268   FastDelegate(const Y *pthis,
  2269       R (X::* function_to_bind)( Param1 p1 ) const)
  2270     : BaseType(pthis, function_to_bind)
  2271   {  }
  2272 
  2273   FastDelegate(R (*function_to_bind)( Param1 p1 ))
  2274     : BaseType(function_to_bind)  { }
  2275   void operator = (const BaseType &x)  {
  2276 		*static_cast<BaseType*>(this) = x; }
  2277 };
  2278 
  2279 //N=2
  2280 // Specialization to allow use of
  2281 // FastDelegate< R ( Param1, Param2 ) >
  2282 // instead of
  2283 // FastDelegate2 < Param1, Param2, R >
  2284 template<typename R, class Param1, class Param2>
  2285 class FastDelegate< R ( Param1, Param2 ) >
  2286   // Inherit from FastDelegate2 so that it can be treated just
  2287   // like a FastDelegate2
  2288   : public FastDelegate2 < Param1, Param2, R >
  2289 {
  2290 public:
  2291   // Make using the base type a bit easier via typedef.
  2292   typedef FastDelegate2 < Param1, Param2, R > BaseType;
  2293 
  2294   // Allow users access to the specific type of this delegate.
  2295   typedef FastDelegate SelfType;
  2296 
  2297   // Mimic the base class constructors.
  2298   FastDelegate() : BaseType() { }
  2299 
  2300   template < class X, class Y >
  2301   FastDelegate(Y * pthis,
  2302     R (X::* function_to_bind)( Param1 p1, Param2 p2 ))
  2303     : BaseType(pthis, function_to_bind)  { }
  2304 
  2305   template < class X, class Y >
  2306   FastDelegate(const Y *pthis,
  2307       R (X::* function_to_bind)( Param1 p1, Param2 p2 ) const)
  2308     : BaseType(pthis, function_to_bind)
  2309   {  }
  2310 
  2311   FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2 ))
  2312     : BaseType(function_to_bind)  { }
  2313   void operator = (const BaseType &x)  {
  2314 		*static_cast<BaseType*>(this) = x; }
  2315 };
  2316 
  2317 //N=3
  2318 // Specialization to allow use of
  2319 // FastDelegate< R ( Param1, Param2, Param3 ) >
  2320 // instead of
  2321 // FastDelegate3 < Param1, Param2, Param3, R >
  2322 template<typename R, class Param1, class Param2, class Param3>
  2323 class FastDelegate< R ( Param1, Param2, Param3 ) >
  2324   // Inherit from FastDelegate3 so that it can be treated just
  2325   // like a FastDelegate3
  2326   : public FastDelegate3 < Param1, Param2, Param3, R >
  2327 {
  2328 public:
  2329   // Make using the base type a bit easier via typedef.
  2330   typedef FastDelegate3 < Param1, Param2, Param3, R > BaseType;
  2331 
  2332   // Allow users access to the specific type of this delegate.
  2333   typedef FastDelegate SelfType;
  2334 
  2335   // Mimic the base class constructors.
  2336   FastDelegate() : BaseType() { }
  2337 
  2338   template < class X, class Y >
  2339   FastDelegate(Y * pthis,
  2340     R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ))
  2341     : BaseType(pthis, function_to_bind)  { }
  2342 
  2343   template < class X, class Y >
  2344   FastDelegate(const Y *pthis,
  2345       R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ) const)
  2346     : BaseType(pthis, function_to_bind)
  2347   {  }
  2348 
  2349   FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ))
  2350     : BaseType(function_to_bind)  { }
  2351   void operator = (const BaseType &x)  {
  2352 		*static_cast<BaseType*>(this) = x; }
  2353 };
  2354 
  2355 //N=4
  2356 // Specialization to allow use of
  2357 // FastDelegate< R ( Param1, Param2, Param3, Param4 ) >
  2358 // instead of
  2359 // FastDelegate4 < Param1, Param2, Param3, Param4, R >
  2360 template<typename R, class Param1, class Param2, class Param3, class Param4>
  2361 class FastDelegate< R ( Param1, Param2, Param3, Param4 ) >
  2362   // Inherit from FastDelegate4 so that it can be treated just
  2363   // like a FastDelegate4
  2364   : public FastDelegate4 < Param1, Param2, Param3, Param4, R >
  2365 {
  2366 public:
  2367   // Make using the base type a bit easier via typedef.
  2368   typedef FastDelegate4 < Param1, Param2, Param3, Param4, R > BaseType;
  2369 
  2370   // Allow users access to the specific type of this delegate.
  2371   typedef FastDelegate SelfType;
  2372 
  2373   // Mimic the base class constructors.
  2374   FastDelegate() : BaseType() { }
  2375 
  2376   template < class X, class Y >
  2377   FastDelegate(Y * pthis,
  2378     R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ))
  2379     : BaseType(pthis, function_to_bind)  { }
  2380 
  2381   template < class X, class Y >
  2382   FastDelegate(const Y *pthis,
  2383       R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const)
  2384     : BaseType(pthis, function_to_bind)
  2385   {  }
  2386 
  2387   FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ))
  2388     : BaseType(function_to_bind)  { }
  2389   void operator = (const BaseType &x)  {
  2390 		*static_cast<BaseType*>(this) = x; }
  2391 };
  2392 
  2393 //N=5
  2394 // Specialization to allow use of
  2395 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) >
  2396 // instead of
  2397 // FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R >
  2398 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5>
  2399 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) >
  2400   // Inherit from FastDelegate5 so that it can be treated just
  2401   // like a FastDelegate5
  2402   : public FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R >
  2403 {
  2404 public:
  2405   // Make using the base type a bit easier via typedef.
  2406   typedef FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R > BaseType;
  2407 
  2408   // Allow users access to the specific type of this delegate.
  2409   typedef FastDelegate SelfType;
  2410 
  2411   // Mimic the base class constructors.
  2412   FastDelegate() : BaseType() { }
  2413 
  2414   template < class X, class Y >
  2415   FastDelegate(Y * pthis,
  2416     R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ))
  2417     : BaseType(pthis, function_to_bind)  { }
  2418 
  2419   template < class X, class Y >
  2420   FastDelegate(const Y *pthis,
  2421       R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const)
  2422     : BaseType(pthis, function_to_bind)
  2423   {  }
  2424 
  2425   FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ))
  2426     : BaseType(function_to_bind)  { }
  2427   void operator = (const BaseType &x)  {
  2428 		*static_cast<BaseType*>(this) = x; }
  2429 };
  2430 
  2431 //N=6
  2432 // Specialization to allow use of
  2433 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) >
  2434 // instead of
  2435 // FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R >
  2436 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6>
  2437 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) >
  2438   // Inherit from FastDelegate6 so that it can be treated just
  2439   // like a FastDelegate6
  2440   : public FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R >
  2441 {
  2442 public:
  2443   // Make using the base type a bit easier via typedef.
  2444   typedef FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R > BaseType;
  2445 
  2446   // Allow users access to the specific type of this delegate.
  2447   typedef FastDelegate SelfType;
  2448 
  2449   // Mimic the base class constructors.
  2450   FastDelegate() : BaseType() { }
  2451 
  2452   template < class X, class Y >
  2453   FastDelegate(Y * pthis,
  2454     R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ))
  2455     : BaseType(pthis, function_to_bind)  { }
  2456 
  2457   template < class X, class Y >
  2458   FastDelegate(const Y *pthis,
  2459       R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const)
  2460     : BaseType(pthis, function_to_bind)
  2461   {  }
  2462 
  2463   FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ))
  2464     : BaseType(function_to_bind)  { }
  2465   void operator = (const BaseType &x)  {
  2466 		*static_cast<BaseType*>(this) = x; }
  2467 };
  2468 
  2469 //N=7
  2470 // Specialization to allow use of
  2471 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) >
  2472 // instead of
  2473 // FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R >
  2474 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7>
  2475 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) >
  2476   // Inherit from FastDelegate7 so that it can be treated just
  2477   // like a FastDelegate7
  2478   : public FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R >
  2479 {
  2480 public:
  2481   // Make using the base type a bit easier via typedef.
  2482   typedef FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R > BaseType;
  2483 
  2484   // Allow users access to the specific type of this delegate.
  2485   typedef FastDelegate SelfType;
  2486 
  2487   // Mimic the base class constructors.
  2488   FastDelegate() : BaseType() { }
  2489 
  2490   template < class X, class Y >
  2491   FastDelegate(Y * pthis,
  2492     R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ))
  2493     : BaseType(pthis, function_to_bind)  { }
  2494 
  2495   template < class X, class Y >
  2496   FastDelegate(const Y *pthis,
  2497       R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const)
  2498     : BaseType(pthis, function_to_bind)
  2499   {  }
  2500 
  2501   FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ))
  2502     : BaseType(function_to_bind)  { }
  2503   void operator = (const BaseType &x)  {
  2504 		*static_cast<BaseType*>(this) = x; }
  2505 };
  2506 
  2507 //N=8
  2508 // Specialization to allow use of
  2509 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) >
  2510 // instead of
  2511 // FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R >
  2512 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8>
  2513 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) >
  2514   // Inherit from FastDelegate8 so that it can be treated just
  2515   // like a FastDelegate8
  2516   : public FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R >
  2517 {
  2518 public:
  2519   // Make using the base type a bit easier via typedef.
  2520   typedef FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R > BaseType;
  2521 
  2522   // Allow users access to the specific type of this delegate.
  2523   typedef FastDelegate SelfType;
  2524 
  2525   // Mimic the base class constructors.
  2526   FastDelegate() : BaseType() { }
  2527 
  2528   template < class X, class Y >
  2529   FastDelegate(Y * pthis,
  2530     R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ))
  2531     : BaseType(pthis, function_to_bind)  { }
  2532 
  2533   template < class X, class Y >
  2534   FastDelegate(const Y *pthis,
  2535       R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const)
  2536     : BaseType(pthis, function_to_bind)
  2537   {  }
  2538 
  2539   FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ))
  2540     : BaseType(function_to_bind)  { }
  2541   void operator = (const BaseType &x)  {
  2542 		*static_cast<BaseType*>(this) = x; }
  2543 };
  2544 
  2545 //N=9
  2546 // Specialization to allow use of
  2547 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9 ) >
  2548 // instead of
  2549 // FastDelegate9 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, R >
  2550 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9>
  2551 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9 ) >
  2552   // Inherit from FastDelegate9 so that it can be treated just
  2553   // like a FastDelegate9
  2554   : public FastDelegate9 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, R >
  2555 {
  2556 public:
  2557   // Make using the base type a bit easier via typedef.
  2558   typedef FastDelegate9 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, R > BaseType;
  2559 
  2560   // Allow users access to the specific type of this delegate.
  2561   typedef FastDelegate SelfType;
  2562 
  2563   // Mimic the base class constructors.
  2564   FastDelegate() : BaseType() { }
  2565 
  2566   template < class X, class Y >
  2567   FastDelegate(Y * pthis,
  2568     R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9 ))
  2569     : BaseType(pthis, function_to_bind)  { }
  2570 
  2571   template < class X, class Y >
  2572   FastDelegate(const Y *pthis,
  2573       R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9 ) const)
  2574     : BaseType(pthis, function_to_bind)
  2575   {  }
  2576 
  2577   FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9 ))
  2578     : BaseType(function_to_bind)  { }
  2579   void operator = (const BaseType &x)  {
  2580 		*static_cast<BaseType*>(this) = x; }
  2581 };
  2582 
  2583 //N=10
  2584 // Specialization to allow use of
  2585 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10 ) >
  2586 // instead of
  2587 // FastDelegate10 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, R >
  2588 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10>
  2589 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10 ) >
  2590   // Inherit from FastDelegate10 so that it can be treated just
  2591   // like a FastDelegate10
  2592   : public FastDelegate10 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, R >
  2593 {
  2594 public:
  2595   // Make using the base type a bit easier via typedef.
  2596   typedef FastDelegate10 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, R > BaseType;
  2597 
  2598   // Allow users access to the specific type of this delegate.
  2599   typedef FastDelegate SelfType;
  2600 
  2601   // Mimic the base class constructors.
  2602   FastDelegate() : BaseType() { }
  2603 
  2604   template < class X, class Y >
  2605   FastDelegate(Y * pthis,
  2606     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 ))
  2607     : BaseType(pthis, function_to_bind)  { }
  2608 
  2609   template < class X, class Y >
  2610   FastDelegate(const Y *pthis,
  2611       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)
  2612     : BaseType(pthis, function_to_bind)
  2613   {  }
  2614 
  2615   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 ))
  2616     : BaseType(function_to_bind)  { }
  2617   void operator = (const BaseType &x)  {
  2618 		*static_cast<BaseType*>(this) = x; }
  2619 };
  2620 
  2621 //N=11
  2622 // Specialization to allow use of
  2623 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11 ) >
  2624 // instead of
  2625 // FastDelegate11 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, R >
  2626 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>
  2627 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11 ) >
  2628   // Inherit from FastDelegate11 so that it can be treated just
  2629   // like a FastDelegate11
  2630   : public FastDelegate11 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, R >
  2631 {
  2632 public:
  2633   // Make using the base type a bit easier via typedef.
  2634   typedef FastDelegate11 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, R > BaseType;
  2635 
  2636   // Allow users access to the specific type of this delegate.
  2637   typedef FastDelegate SelfType;
  2638 
  2639   // Mimic the base class constructors.
  2640   FastDelegate() : BaseType() { }
  2641 
  2642   template < class X, class Y >
  2643   FastDelegate(Y * pthis,
  2644     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 ))
  2645     : BaseType(pthis, function_to_bind)  { }
  2646 
  2647   template < class X, class Y >
  2648   FastDelegate(const Y *pthis,
  2649       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)
  2650     : BaseType(pthis, function_to_bind)
  2651   {  }
  2652 
  2653   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 ))
  2654     : BaseType(function_to_bind)  { }
  2655   void operator = (const BaseType &x)  {
  2656 		*static_cast<BaseType*>(this) = x; }
  2657 };
  2658 
  2659 //N=12
  2660 // Specialization to allow use of
  2661 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12 ) >
  2662 // instead of
  2663 // FastDelegate12 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, R >
  2664 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>
  2665 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12 ) >
  2666   // Inherit from FastDelegate12 so that it can be treated just
  2667   // like a FastDelegate12
  2668   : public FastDelegate12 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, R >
  2669 {
  2670 public:
  2671   // Make using the base type a bit easier via typedef.
  2672   typedef FastDelegate12 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, R > BaseType;
  2673 
  2674   // Allow users access to the specific type of this delegate.
  2675   typedef FastDelegate SelfType;
  2676 
  2677   // Mimic the base class constructors.
  2678   FastDelegate() : BaseType() { }
  2679 
  2680   template < class X, class Y >
  2681   FastDelegate(Y * pthis,
  2682     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 ))
  2683     : BaseType(pthis, function_to_bind)  { }
  2684 
  2685   template < class X, class Y >
  2686   FastDelegate(const Y *pthis,
  2687       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)
  2688     : BaseType(pthis, function_to_bind)
  2689   {  }
  2690 
  2691   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 ))
  2692     : BaseType(function_to_bind)  { }
  2693   void operator = (const BaseType &x)  {
  2694 		*static_cast<BaseType*>(this) = x; }
  2695 };
  2696 
  2697 //N=13
  2698 // Specialization to allow use of
  2699 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13 ) >
  2700 // instead of
  2701 // FastDelegate13 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, R >
  2702 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>
  2703 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13 ) >
  2704   // Inherit from FastDelegate13 so that it can be treated just
  2705   // like a FastDelegate13
  2706   : public FastDelegate13 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, R >
  2707 {
  2708 public:
  2709   // Make using the base type a bit easier via typedef.
  2710   typedef FastDelegate13 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, R > BaseType;
  2711 
  2712   // Allow users access to the specific type of this delegate.
  2713   typedef FastDelegate SelfType;
  2714 
  2715   // Mimic the base class constructors.
  2716   FastDelegate() : BaseType() { }
  2717 
  2718   template < class X, class Y >
  2719   FastDelegate(Y * pthis,
  2720     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 ))
  2721     : BaseType(pthis, function_to_bind)  { }
  2722 
  2723   template < class X, class Y >
  2724   FastDelegate(const Y *pthis,
  2725       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)
  2726     : BaseType(pthis, function_to_bind)
  2727   {  }
  2728 
  2729   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 ))
  2730     : BaseType(function_to_bind)  { }
  2731   void operator = (const BaseType &x)  {
  2732 		*static_cast<BaseType*>(this) = x; }
  2733 };
  2734 
  2735 //N=14
  2736 // Specialization to allow use of
  2737 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14 ) >
  2738 // instead of
  2739 // FastDelegate14 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, R >
  2740 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>
  2741 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14 ) >
  2742   // Inherit from FastDelegate14 so that it can be treated just
  2743   // like a FastDelegate14
  2744   : public FastDelegate14 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, R >
  2745 {
  2746 public:
  2747   // Make using the base type a bit easier via typedef.
  2748   typedef FastDelegate14 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, R > BaseType;
  2749 
  2750   // Allow users access to the specific type of this delegate.
  2751   typedef FastDelegate SelfType;
  2752 
  2753   // Mimic the base class constructors.
  2754   FastDelegate() : BaseType() { }
  2755 
  2756   template < class X, class Y >
  2757   FastDelegate(Y * pthis,
  2758     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 ))
  2759     : BaseType(pthis, function_to_bind)  { }
  2760 
  2761   template < class X, class Y >
  2762   FastDelegate(const Y *pthis,
  2763       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)
  2764     : BaseType(pthis, function_to_bind)
  2765   {  }
  2766 
  2767   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 ))
  2768     : BaseType(function_to_bind)  { }
  2769   void operator = (const BaseType &x)  {
  2770 		*static_cast<BaseType*>(this) = x; }
  2771 };
  2772 
  2773 //N=15
  2774 // Specialization to allow use of
  2775 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15 ) >
  2776 // instead of
  2777 // FastDelegate15 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, R >
  2778 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>
  2779 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15 ) >
  2780   // Inherit from FastDelegate15 so that it can be treated just
  2781   // like a FastDelegate15
  2782   : public FastDelegate15 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, R >
  2783 {
  2784 public:
  2785   // Make using the base type a bit easier via typedef.
  2786   typedef FastDelegate15 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, R > BaseType;
  2787 
  2788   // Allow users access to the specific type of this delegate.
  2789   typedef FastDelegate SelfType;
  2790 
  2791   // Mimic the base class constructors.
  2792   FastDelegate() : BaseType() { }
  2793 
  2794   template < class X, class Y >
  2795   FastDelegate(Y * pthis,
  2796     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 ))
  2797     : BaseType(pthis, function_to_bind)  { }
  2798 
  2799   template < class X, class Y >
  2800   FastDelegate(const Y *pthis,
  2801       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)
  2802     : BaseType(pthis, function_to_bind)
  2803   {  }
  2804 
  2805   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 ))
  2806     : BaseType(function_to_bind)  { }
  2807   void operator = (const BaseType &x)  {
  2808 		*static_cast<BaseType*>(this) = x; }
  2809 };
  2810 
  2811 //N=16
  2812 // Specialization to allow use of
  2813 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16 ) >
  2814 // instead of
  2815 // FastDelegate16 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, R >
  2816 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>
  2817 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16 ) >
  2818   // Inherit from FastDelegate16 so that it can be treated just
  2819   // like a FastDelegate16
  2820   : public FastDelegate16 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, R >
  2821 {
  2822 public:
  2823   // Make using the base type a bit easier via typedef.
  2824   typedef FastDelegate16 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, R > BaseType;
  2825 
  2826   // Allow users access to the specific type of this delegate.
  2827   typedef FastDelegate SelfType;
  2828 
  2829   // Mimic the base class constructors.
  2830   FastDelegate() : BaseType() { }
  2831 
  2832   template < class X, class Y >
  2833   FastDelegate(Y * pthis,
  2834     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 ))
  2835     : BaseType(pthis, function_to_bind)  { }
  2836 
  2837   template < class X, class Y >
  2838   FastDelegate(const Y *pthis,
  2839       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)
  2840     : BaseType(pthis, function_to_bind)
  2841   {  }
  2842 
  2843   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 ))
  2844     : BaseType(function_to_bind)  { }
  2845   void operator = (const BaseType &x)  {
  2846 		*static_cast<BaseType*>(this) = x; }
  2847 };
  2848 
  2849 //N=17
  2850 // Specialization to allow use of
  2851 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17 ) >
  2852 // instead of
  2853 // FastDelegate17 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, R >
  2854 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>
  2855 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17 ) >
  2856   // Inherit from FastDelegate17 so that it can be treated just
  2857   // like a FastDelegate17
  2858   : public FastDelegate17 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, R >
  2859 {
  2860 public:
  2861   // Make using the base type a bit easier via typedef.
  2862   typedef FastDelegate17 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, R > BaseType;
  2863 
  2864   // Allow users access to the specific type of this delegate.
  2865   typedef FastDelegate SelfType;
  2866 
  2867   // Mimic the base class constructors.
  2868   FastDelegate() : BaseType() { }
  2869 
  2870   template < class X, class Y >
  2871   FastDelegate(Y * pthis,
  2872     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 ))
  2873     : BaseType(pthis, function_to_bind)  { }
  2874 
  2875   template < class X, class Y >
  2876   FastDelegate(const Y *pthis,
  2877       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)
  2878     : BaseType(pthis, function_to_bind)
  2879   {  }
  2880 
  2881   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 ))
  2882     : BaseType(function_to_bind)  { }
  2883   void operator = (const BaseType &x)  {
  2884 		*static_cast<BaseType*>(this) = x; }
  2885 };
  2886 
  2887 //N=18
  2888 // Specialization to allow use of
  2889 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18 ) >
  2890 // instead of
  2891 // FastDelegate18 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, R >
  2892 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>
  2893 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18 ) >
  2894   // Inherit from FastDelegate18 so that it can be treated just
  2895   // like a FastDelegate18
  2896   : public FastDelegate18 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, R >
  2897 {
  2898 public:
  2899   // Make using the base type a bit easier via typedef.
  2900   typedef FastDelegate18 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, R > BaseType;
  2901 
  2902   // Allow users access to the specific type of this delegate.
  2903   typedef FastDelegate SelfType;
  2904 
  2905   // Mimic the base class constructors.
  2906   FastDelegate() : BaseType() { }
  2907 
  2908   template < class X, class Y >
  2909   FastDelegate(Y * pthis,
  2910     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 ))
  2911     : BaseType(pthis, function_to_bind)  { }
  2912 
  2913   template < class X, class Y >
  2914   FastDelegate(const Y *pthis,
  2915       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)
  2916     : BaseType(pthis, function_to_bind)
  2917   {  }
  2918 
  2919   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 ))
  2920     : BaseType(function_to_bind)  { }
  2921   void operator = (const BaseType &x)  {
  2922 		*static_cast<BaseType*>(this) = x; }
  2923 };
  2924 
  2925 //N=19
  2926 // Specialization to allow use of
  2927 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19 ) >
  2928 // instead of
  2929 // FastDelegate19 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, R >
  2930 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>
  2931 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19 ) >
  2932   // Inherit from FastDelegate19 so that it can be treated just
  2933   // like a FastDelegate19
  2934   : public FastDelegate19 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, R >
  2935 {
  2936 public:
  2937   // Make using the base type a bit easier via typedef.
  2938   typedef FastDelegate19 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, R > BaseType;
  2939 
  2940   // Allow users access to the specific type of this delegate.
  2941   typedef FastDelegate SelfType;
  2942 
  2943   // Mimic the base class constructors.
  2944   FastDelegate() : BaseType() { }
  2945 
  2946   template < class X, class Y >
  2947   FastDelegate(Y * pthis,
  2948     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 ))
  2949     : BaseType(pthis, function_to_bind)  { }
  2950 
  2951   template < class X, class Y >
  2952   FastDelegate(const Y *pthis,
  2953       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)
  2954     : BaseType(pthis, function_to_bind)
  2955   {  }
  2956 
  2957   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 ))
  2958     : BaseType(function_to_bind)  { }
  2959   void operator = (const BaseType &x)  {
  2960 		*static_cast<BaseType*>(this) = x; }
  2961 };
  2962 
  2963 //N=20
  2964 // Specialization to allow use of
  2965 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20 ) >
  2966 // instead of
  2967 // FastDelegate20 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, R >
  2968 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>
  2969 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20 ) >
  2970   // Inherit from FastDelegate20 so that it can be treated just
  2971   // like a FastDelegate20
  2972   : public FastDelegate20 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, R >
  2973 {
  2974 public:
  2975   // Make using the base type a bit easier via typedef.
  2976   typedef FastDelegate20 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, R > BaseType;
  2977 
  2978   // Allow users access to the specific type of this delegate.
  2979   typedef FastDelegate SelfType;
  2980 
  2981   // Mimic the base class constructors.
  2982   FastDelegate() : BaseType() { }
  2983 
  2984   template < class X, class Y >
  2985   FastDelegate(Y * pthis,
  2986     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 ))
  2987     : BaseType(pthis, function_to_bind)  { }
  2988 
  2989   template < class X, class Y >
  2990   FastDelegate(const Y *pthis,
  2991       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)
  2992     : BaseType(pthis, function_to_bind)
  2993   {  }
  2994 
  2995   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 ))
  2996     : BaseType(function_to_bind)  { }
  2997   void operator = (const BaseType &x)  {
  2998 		*static_cast<BaseType*>(this) = x; }
  2999 };
  3000 
  3001 
  3002 #endif //FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
  3003 
  3004 ////////////////////////////////////////////////////////////////////////////////
  3005 //						Fast Delegates, part 5:
  3006 //
  3007 //				MakeDelegate() helper function
  3008 //
  3009 //			MakeDelegate(&x, &X::func) returns a fastdelegate of the type
  3010 //			necessary for calling x.func() with the correct number of arguments.
  3011 //			This makes it possible to eliminate many typedefs from user code.
  3012 //
  3013 ////////////////////////////////////////////////////////////////////////////////
  3014 
  3015 // Also declare overloads of a MakeDelegate() global function to
  3016 // reduce the need for typedefs.
  3017 // We need seperate overloads for const and non-const member functions.
  3018 // Also, because of the weird rule about the class of derived member function pointers,
  3019 // implicit downcasts may need to be applied later to the 'this' pointer.
  3020 // That's why two classes (X and Y) appear in the definitions. Y must be implicitly
  3021 // castable to X.
  3022 
  3023 // Workaround for VC6. VC6 needs void return types converted into DefaultVoid.
  3024 // GCC 3.2 and later won't compile this unless it's preceded by 'typename',
  3025 // but VC6 doesn't allow 'typename' in this context.
  3026 // So, I have to use a macro.
  3027 
  3028 #ifdef FASTDLGT_VC6
  3029 #define FASTDLGT_RETTYPE detail::VoidToDefaultVoid<RetType>::type
  3030 #else
  3031 #define FASTDLGT_RETTYPE RetType
  3032 #endif
  3033 
  3034 //N=0
  3035 template <class X, class Y, class RetType>
  3036 FastDelegate0<FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)()) {
  3037 	return FastDelegate0<FASTDLGT_RETTYPE>(x, func);
  3038 }
  3039 
  3040 template <class X, class Y, class RetType>
  3041 FastDelegate0<FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)() const) {
  3042 	return FastDelegate0<FASTDLGT_RETTYPE>(x, func);
  3043 }
  3044 
  3045 template <class RetType>
  3046 FastDelegate0<FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)()) {
  3047 	return FastDelegate0<FASTDLGT_RETTYPE>(func);
  3048 }
  3049 
  3050 //N=1
  3051 template <class X, class Y, class Param1, class RetType>
  3052 FastDelegate1<Param1, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1)) {
  3053 	return FastDelegate1<Param1, FASTDLGT_RETTYPE>(x, func);
  3054 }
  3055 
  3056 template <class X, class Y, class Param1, class RetType>
  3057 FastDelegate1<Param1, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1) const) {
  3058 	return FastDelegate1<Param1, FASTDLGT_RETTYPE>(x, func);
  3059 }
  3060 
  3061 template <class Param1, class RetType>
  3062 FastDelegate1<Param1, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1)) {
  3063 	return FastDelegate1<Param1, FASTDLGT_RETTYPE>(func);
  3064 }
  3065 
  3066 //N=2
  3067 template <class X, class Y, class Param1, class Param2, class RetType>
  3068 FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2)) {
  3069 	return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(x, func);
  3070 }
  3071 
  3072 template <class X, class Y, class Param1, class Param2, class RetType>
  3073 FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2) const) {
  3074 	return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(x, func);
  3075 }
  3076 
  3077 template <class Param1, class Param2, class RetType>
  3078 FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2)) {
  3079 	return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(func);
  3080 }
  3081 
  3082 //N=3
  3083 template <class X, class Y, class Param1, class Param2, class Param3, class RetType>
  3084 FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3)) {
  3085 	return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(x, func);
  3086 }
  3087 
  3088 template <class X, class Y, class Param1, class Param2, class Param3, class RetType>
  3089 FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3) const) {
  3090 	return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(x, func);
  3091 }
  3092 
  3093 template <class Param1, class Param2, class Param3, class RetType>
  3094 FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3)) {
  3095 	return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(func);
  3096 }
  3097 
  3098 //N=4
  3099 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class RetType>
  3100 FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
  3101 	return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(x, func);
  3102 }
  3103 
  3104 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class RetType>
  3105 FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) {
  3106 	return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(x, func);
  3107 }
  3108 
  3109 template <class Param1, class Param2, class Param3, class Param4, class RetType>
  3110 FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
  3111 	return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(func);
  3112 }
  3113 
  3114 //N=5
  3115 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class RetType>
  3116 FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
  3117 	return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(x, func);
  3118 }
  3119 
  3120 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class RetType>
  3121 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) {
  3122 	return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(x, func);
  3123 }
  3124 
  3125 template <class Param1, class Param2, class Param3, class Param4, class Param5, class RetType>
  3126 FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
  3127 	return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(func);
  3128 }
  3129 
  3130 //N=6
  3131 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType>
  3132 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)) {
  3133 	return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(x, func);
  3134 }
  3135 
  3136 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType>
  3137 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) {
  3138 	return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(x, func);
  3139 }
  3140 
  3141 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType>
  3142 FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
  3143 	return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(func);
  3144 }
  3145 
  3146 //N=7
  3147 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType>
  3148 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)) {
  3149 	return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(x, func);
  3150 }
  3151 
  3152 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType>
  3153 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) {
  3154 	return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(x, func);
  3155 }
  3156 
  3157 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType>
  3158 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)) {
  3159 	return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(func);
  3160 }
  3161 
  3162 //N=8
  3163 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType>
  3164 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)) {
  3165 	return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(x, func);
  3166 }
  3167 
  3168 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType>
  3169 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) {
  3170 	return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(x, func);
  3171 }
  3172 
  3173 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType>
  3174 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)) {
  3175 	return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(func);
  3176 }
  3177 
  3178 //N=9
  3179 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>
  3180 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)) {
  3181 	return FastDelegate9<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, FASTDLGT_RETTYPE>(x, func);
  3182 }
  3183 
  3184 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>
  3185 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) {
  3186 	return FastDelegate9<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, FASTDLGT_RETTYPE>(x, func);
  3187 }
  3188 
  3189 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class RetType>
  3190 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)) {
  3191 	return FastDelegate9<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, FASTDLGT_RETTYPE>(func);
  3192 }
  3193 
  3194 //N=10
  3195 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>
  3196 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)) {
  3197 	return FastDelegate10<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, FASTDLGT_RETTYPE>(x, func);
  3198 }
  3199 
  3200 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>
  3201 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) {
  3202 	return FastDelegate10<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, FASTDLGT_RETTYPE>(x, func);
  3203 }
  3204 
  3205 template <class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class RetType>
  3206 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)) {
  3207 	return FastDelegate10<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, FASTDLGT_RETTYPE>(func);
  3208 }
  3209 
  3210 //N=11
  3211 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>
  3212 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)) {
  3213 	return FastDelegate11<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, FASTDLGT_RETTYPE>(x, func);
  3214 }
  3215 
  3216 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>
  3217 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) {
  3218 	return FastDelegate11<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, FASTDLGT_RETTYPE>(x, func);
  3219 }
  3220 
  3221 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>
  3222 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)) {
  3223 	return FastDelegate11<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, FASTDLGT_RETTYPE>(func);
  3224 }
  3225 
  3226 //N=12
  3227 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>
  3228 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)) {
  3229 	return FastDelegate12<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, FASTDLGT_RETTYPE>(x, func);
  3230 }
  3231 
  3232 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>
  3233 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) {
  3234 	return FastDelegate12<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, FASTDLGT_RETTYPE>(x, func);
  3235 }
  3236 
  3237 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>
  3238 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)) {
  3239 	return FastDelegate12<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, FASTDLGT_RETTYPE>(func);
  3240 }
  3241 
  3242 //N=13
  3243 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>
  3244 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)) {
  3245 	return FastDelegate13<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, FASTDLGT_RETTYPE>(x, func);
  3246 }
  3247 
  3248 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>
  3249 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) {
  3250 	return FastDelegate13<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, FASTDLGT_RETTYPE>(x, func);
  3251 }
  3252 
  3253 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>
  3254 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)) {
  3255 	return FastDelegate13<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, FASTDLGT_RETTYPE>(func);
  3256 }
  3257 
  3258 //N=14
  3259 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>
  3260 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)) {
  3261 	return FastDelegate14<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, FASTDLGT_RETTYPE>(x, func);
  3262 }
  3263 
  3264 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>
  3265 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) {
  3266 	return FastDelegate14<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, FASTDLGT_RETTYPE>(x, func);
  3267 }
  3268 
  3269 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>
  3270 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)) {
  3271 	return FastDelegate14<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, FASTDLGT_RETTYPE>(func);
  3272 }
  3273 
  3274 //N=15
  3275 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>
  3276 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)) {
  3277 	return FastDelegate15<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, FASTDLGT_RETTYPE>(x, func);
  3278 }
  3279 
  3280 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>
  3281 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) {
  3282 	return FastDelegate15<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, FASTDLGT_RETTYPE>(x, func);
  3283 }
  3284 
  3285 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>
  3286 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)) {
  3287 	return FastDelegate15<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, FASTDLGT_RETTYPE>(func);
  3288 }
  3289 
  3290 //N=16
  3291 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>
  3292 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)) {
  3293 	return FastDelegate16<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, FASTDLGT_RETTYPE>(x, func);
  3294 }
  3295 
  3296 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>
  3297 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) {
  3298 	return FastDelegate16<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, FASTDLGT_RETTYPE>(x, func);
  3299 }
  3300 
  3301 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>
  3302 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)) {
  3303 	return FastDelegate16<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, FASTDLGT_RETTYPE>(func);
  3304 }
  3305 
  3306 //N=17
  3307 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>
  3308 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)) {
  3309 	return FastDelegate17<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, FASTDLGT_RETTYPE>(x, func);
  3310 }
  3311 
  3312 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>
  3313 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) {
  3314 	return FastDelegate17<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, FASTDLGT_RETTYPE>(x, func);
  3315 }
  3316 
  3317 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>
  3318 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)) {
  3319 	return FastDelegate17<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, FASTDLGT_RETTYPE>(func);
  3320 }
  3321 
  3322 //N=18
  3323 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>
  3324 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)) {
  3325 	return FastDelegate18<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, FASTDLGT_RETTYPE>(x, func);
  3326 }
  3327 
  3328 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>
  3329 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) {
  3330 	return FastDelegate18<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, FASTDLGT_RETTYPE>(x, func);
  3331 }
  3332 
  3333 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>
  3334 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)) {
  3335 	return FastDelegate18<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, FASTDLGT_RETTYPE>(func);
  3336 }
  3337 
  3338 //N=19
  3339 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>
  3340 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)) {
  3341 	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);
  3342 }
  3343 
  3344 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>
  3345 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) {
  3346 	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);
  3347 }
  3348 
  3349 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>
  3350 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)) {
  3351 	return FastDelegate19<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, FASTDLGT_RETTYPE>(func);
  3352 }
  3353 
  3354 //N=20
  3355 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>
  3356 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)) {
  3357 	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);
  3358 }
  3359 
  3360 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>
  3361 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) {
  3362 	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);
  3363 }
  3364 
  3365 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>
  3366 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)) {
  3367 	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);
  3368 }
  3369 
  3370 
  3371  // clean up after ourselves...
  3372 #undef FASTDLGT_RETTYPE
  3373 
  3374 } // namespace fastdelegate
  3375 
  3376 #endif // !defined(FASTDELEGATE_H)
  3377