2 // Efficient delegates in C++ that generate only two lines of asm code!
3 // Documentation is found at http://www.codeproject.com/cpp/FastDelegate.asp
5 // - Don Clugston, Mar 2004.
6 // Major contributions were made by Jody Hagins.
8 // 24-Apr-04 1.0 Submitted to CodeProject.
9 // 28-Apr-04 1.1 * Prevent most unsafe uses of evil static function hack.
10 // * Improved syntax for horrible_cast (thanks Paul Bludov).
11 // * Tested on Metrowerks MWCC and Intel ICL (IA32)
12 // * Compiled, but not run, on Comeau C++ and Intel Itanium ICL.
13 // 27-Jun-04 1.2 * Now works on Borland C++ Builder 5.5
14 // * Now works on /clr "managed C++" code on VC7, VC7.1
15 // * Comeau C++ now compiles without warnings.
16 // * Prevent the virtual inheritance case from being used on
17 // VC6 and earlier, which generate incorrect code.
18 // * Improved warning and error messages. Non-standard hacks
19 // now have compile-time checks to make them safer.
20 // * implicit_cast used instead of static_cast in many cases.
21 // * If calling a const member function, a const class pointer can be used.
22 // * MakeDelegate() global helper function added to simplify pass-by-value.
23 // * Added fastdelegate.clear()
24 // 16-Jul-04 1.2.1* Workaround for gcc bug (const member function pointers in templates)
25 // 30-Oct-04 1.3 * Support for (non-void) return values.
26 // * No more workarounds in client code!
27 // MSVC and Intel now use a clever hack invented by John Dlugosz:
28 // - The FASTDELEGATEDECLARE workaround is no longer necessary.
29 // - No more warning messages for VC6
30 // * Less use of macros. Error messages should be more comprehensible.
31 // * Added include guards
32 // * Added FastDelegate::empty() to test if invocation is safe (Thanks Neville Franks).
33 // * Now tested on VS 2005 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) >.
42 #ifndef FASTDELEGATE_H
43 #define FASTDELEGATE_H
46 #endif // _MSC_VER > 1000
48 #include <memory.h> // to allow <,> comparisons
50 ////////////////////////////////////////////////////////////////////////////////
51 // Configuration options
53 ////////////////////////////////////////////////////////////////////////////////
55 // Uncomment the following #define for optimally-sized delegates.
56 // In this case, the generated asm code is almost identical to the code you'd get
57 // if the compiler had native support for delegates.
58 // It will not work on systems where sizeof(dataptr) < sizeof(codeptr).
59 // Thus, it will not work for DOS compilers using the medium model.
60 // It will also probably fail on some DSP systems.
61 #define FASTDELEGATE_USESTATICFUNCTIONHACK
63 // Uncomment the next line to allow function declarator syntax.
64 // It is automatically enabled for those compilers where it is known to work.
65 //#define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
67 ////////////////////////////////////////////////////////////////////////////////
68 // Compiler identification for workarounds
70 ////////////////////////////////////////////////////////////////////////////////
72 // Compiler identification. It's not easy to identify Visual C++ because
73 // many vendors fraudulently define Microsoft's identifiers.
74 #if defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__VECTOR_C) && !defined(__ICL) && !defined(__BORLANDC__)
75 #define FASTDLGT_ISMSVC
77 #if (_MSC_VER <1300) // Many workarounds are required for VC6.
79 #pragma warning(disable:4786) // disable this ridiculous warning
84 // Does the compiler uses Microsoft's member function pointer structure?
85 // If so, it needs special treatment.
86 // Metrowerks CodeWarrior, Intel, and CodePlay fraudulently define Microsoft's
87 // identifier, _MSC_VER. We need to filter Metrowerks out.
88 #if defined(_MSC_VER) && !defined(__MWERKS__)
89 #define FASTDLGT_MICROSOFT_MFP
91 #if !defined(__VECTOR_C)
92 // CodePlay doesn't have the __single/multi/virtual_inheritance keywords
93 #define FASTDLGT_HASINHERITANCE_KEYWORDS
97 // Does it allow function declarator syntax? The following compilers are known to work:
98 #if defined(FASTDLGT_ISMSVC) && (_MSC_VER >=1310) // VC 7.1
99 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
102 // Gcc(2.95+), and versions of Digital Mars, Intel and Comeau in common use.
103 #if defined (__DMC__) || defined(__GNUC__) || defined(__ICL) || defined(__COMO__)
104 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
107 // It works on Metrowerks MWCC 3.2.2. From boost.Config it should work on earlier ones too.
108 #if defined (__MWERKS__)
109 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
112 #ifdef __GNUC__ // Workaround GCC bug #8271
113 // At present, GCC doesn't recognize constness of MFPs in templates
114 #define FASTDELEGATE_GCC_BUG_8271
119 ////////////////////////////////////////////////////////////////////////////////
120 // General tricks used in this code
122 // (a) Error messages are generated by typdefing an array of negative size to
123 // generate compile-time errors.
124 // (b) Warning messages on MSVC are generated by declaring unused variables, and
125 // enabling the "variable XXX is never used" warning.
126 // (c) Unions are used in a few compiler-specific cases to perform illegal casts.
127 // (d) For Microsoft and Intel, when adjusting the 'this' pointer, it's cast to
128 // (char *) first to ensure that the correct number of *bytes* are added.
130 ////////////////////////////////////////////////////////////////////////////////
133 ////////////////////////////////////////////////////////////////////////////////
136 namespace fastdelegate {
137 namespace detail { // we'll hide the implementation details in a nested namespace.
140 // I believe this was originally going to be in the C++ standard but
141 // was left out by accident. It's even milder than static_cast.
142 // I use it instead of static_cast<> to emphasize that I'm not doing
144 // Usage is identical to static_cast<>
145 template <class OutputClass, class InputClass>
146 inline OutputClass implicit_cast(InputClass input){
151 // This is truly evil. It completely subverts C++'s type system, allowing you
152 // to cast from any class to any other class. Technically, using a union
153 // to perform the cast is undefined behaviour (even in C). But we can see if
154 // it is OK by checking that the union is the same size as each of its members.
155 // horrible_cast<> should only be used for compiler-specific workarounds.
156 // Usage is identical to reinterpret_cast<>.
158 // This union is declared outside the horrible_cast because BCC 5.5.1
159 // can't inline a function with a nested class, and gives a warning.
160 template <class OutputClass, class InputClass>
161 union horrible_union{
166 template <class OutputClass, class InputClass>
167 inline OutputClass horrible_cast(const InputClass input){
168 horrible_union<OutputClass, InputClass> u;
169 // Cause a compile-time error if in, out and u are not the same size.
170 // If the compile fails here, it means the compiler has peculiar
171 // unions which would prevent the cast from working.
172 typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u)
173 && sizeof(InputClass)==sizeof(OutputClass) ? 1 : -1];
178 ////////////////////////////////////////////////////////////////////////////////
181 ////////////////////////////////////////////////////////////////////////////////
183 // Backwards compatibility: This macro used to be necessary in the virtual inheritance
184 // case for Intel and Microsoft. Now it just forward-declares the class.
185 #define FASTDELEGATEDECLARE(CLASSNAME) class CLASSNAME;
187 // Prevent use of the static function hack with the DOS medium model.
189 #undef FASTDELEGATE_USESTATICFUNCTIONHACK
192 // DefaultVoid - a workaround for 'void' templates in VC6.
194 // (1) VC6 and earlier do not allow 'void' as a default template argument.
195 // (2) They also doesn't allow you to return 'void' from a function.
197 // Workaround for (1): Declare a dummy type 'DefaultVoid' which we use
198 // when we'd like to use 'void'. We convert it into 'void' and back
199 // using the templates DefaultVoidToVoid<> and VoidToDefaultVoid<>.
200 // Workaround for (2): On VC6, the code for calling a void function is
201 // identical to the code for calling a non-void function in which the
202 // return value is never used, provided the return value is returned
203 // in the EAX register, rather than on the stack.
204 // This is true for most fundamental types such as int, enum, void *.
205 // Const void * is the safest option since it doesn't participate
206 // in any automatic conversions. But on a 16-bit compiler it might
207 // cause extra code to be generated, so we disable it for all compilers
208 // except for VC6 (and VC5).
211 typedef const void * DefaultVoid;
213 // On any other compiler, just use a normal void.
214 typedef void DefaultVoid;
217 // Translate from 'DefaultVoid' to 'void'.
218 // Everything else is unchanged
220 struct DefaultVoidToVoid { typedef T type; };
223 struct DefaultVoidToVoid<DefaultVoid> { typedef void type; };
225 // Translate from 'void' into 'DefaultVoid'
226 // Everything else is unchanged
228 struct VoidToDefaultVoid { typedef T type; };
231 struct VoidToDefaultVoid<void> { typedef DefaultVoid type; };
235 ////////////////////////////////////////////////////////////////////////////////
236 // Fast Delegates, part 1:
238 // Conversion of member function pointer to a standard form
240 ////////////////////////////////////////////////////////////////////////////////
242 // GenericClass is a fake class, ONLY used to provide a type.
243 // It is vitally important that it is never defined, so that the compiler doesn't
244 // think it can optimize the invocation. For example, Borland generates simpler
245 // code if it knows the class only uses single inheritance.
247 // Compilers using Microsoft's structure need to be treated as a special case.
248 #ifdef FASTDLGT_MICROSOFT_MFP
250 #ifdef FASTDLGT_HASINHERITANCE_KEYWORDS
251 // For Microsoft and Intel, we want to ensure that it's the most efficient type of MFP
252 // (4 bytes), even when the /vmg option is used. Declaring an empty class
253 // would give 16 byte pointers in this case....
254 class __single_inheritance GenericClass;
256 // ...but for Codeplay, an empty class *always* gives 4 byte pointers.
257 // If compiled with the /clr option ("managed C++"), the JIT compiler thinks
258 // it needs to load GenericClass before it can call any of its functions,
259 // (compiles OK but crashes at runtime!), so we need to declare an
260 // empty class to make it happy.
261 // Codeplay and VC4 can't cope with the unknown_inheritance case either.
262 class GenericClass {};
267 // The size of a single inheritance member function pointer.
268 const int SINGLE_MEMFUNCPTR_SIZE = sizeof(void (GenericClass::*)());
270 // SimplifyMemFunc< >::Convert()
272 // A template function that converts an arbitrary member function pointer into the
273 // simplest possible form of member function pointer, using a supplied 'this' pointer.
274 // According to the standard, this can be done legally with reinterpret_cast<>.
275 // For (non-standard) compilers which use member function pointers which vary in size
276 // depending on the class, we need to use knowledge of the internal structure of a
277 // member function pointer, as used by the compiler. Template specialization is used
278 // to distinguish between the sizes. Because some compilers don't support partial
279 // template specialisation, I use full specialisation of a wrapper struct.
281 // general case -- don't know how to convert it. Force a compile failure
283 struct SimplifyMemFunc {
284 template <class X, class XFuncType, class GenericMemFuncType>
285 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
286 GenericMemFuncType &bound_func) {
287 // Unsupported member function type -- force a compile failure.
288 // (it's illegal to have a array with negative size).
289 typedef char ERROR_Unsupported_member_function_pointer_on_this_compiler[N-100];
294 // For compilers where all member func ptrs are the same size, everything goes here.
295 // For non-standard compilers, only single_inheritance classes go here.
297 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE> {
298 template <class X, class XFuncType, class GenericMemFuncType>
299 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
300 GenericMemFuncType &bound_func) {
302 // Digital Mars doesn't allow you to cast between abitrary PMF's,
303 // even though the standard says you can. The 32-bit compiler lets you
304 // static_cast through an int, but the DOS compiler doesn't.
305 bound_func = horrible_cast<GenericMemFuncType>(function_to_bind);
307 bound_func = reinterpret_cast<GenericMemFuncType>(function_to_bind);
309 return reinterpret_cast<GenericClass *>(pthis);
313 ////////////////////////////////////////////////////////////////////////////////
314 // Fast Delegates, part 1b:
316 // Workarounds for Microsoft and Intel
318 ////////////////////////////////////////////////////////////////////////////////
321 // Compilers with member function pointers which violate the standard (MSVC, Intel, Codeplay),
322 // need to be treated as a special case.
323 #ifdef FASTDLGT_MICROSOFT_MFP
325 // We use unions to perform horrible_casts. I would like to use #pragma pack(push, 1)
326 // at the start of each function for extra safety, but VC6 seems to ICE
327 // intermittently if you do this inside a template.
329 // __multiple_inheritance classes go here
330 // Nasty hack for Microsoft and Intel (IA32 and Itanium)
332 struct SimplifyMemFunc< SINGLE_MEMFUNCPTR_SIZE + sizeof(int) > {
333 template <class X, class XFuncType, class GenericMemFuncType>
334 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
335 GenericMemFuncType &bound_func) {
336 // We need to use a horrible_cast to do this conversion.
337 // In MSVC, a multiple inheritance member pointer is internally defined as:
341 GenericMemFuncType funcaddress; // points to the actual member function
342 int delta; // #BYTES to be added to the 'this' pointer
345 // Check that the horrible_cast will work
346 typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)? 1 : -1];
347 u.func = function_to_bind;
348 bound_func = u.s.funcaddress;
349 return reinterpret_cast<GenericClass *>(reinterpret_cast<char *>(pthis) + u.s.delta);
353 // virtual inheritance is a real nuisance. It's inefficient and complicated.
354 // On MSVC and Intel, there isn't enough information in the pointer itself to
355 // enable conversion to a closure pointer. Earlier versions of this code didn't
356 // work for all cases, and generated a compile-time error instead.
357 // But a very clever hack invented by John M. Dlugosz solves this problem.
358 // My code is somewhat different to his: I have no asm code, and I make no
359 // assumptions about the calling convention that is used.
361 // In VC++ and ICL, a virtual_inheritance member pointer
362 // is internally defined as:
363 struct MicrosoftVirtualMFP {
364 void (GenericClass::*codeptr)(); // points to the actual member function
365 int delta; // #bytes to be added to the 'this' pointer
366 int vtable_index; // or 0 if no virtual inheritance
368 // The CRUCIAL feature of Microsoft/Intel MFPs which we exploit is that the
369 // m_codeptr member is *always* called, regardless of the values of the other
370 // members. (This is *not* true for other compilers, eg GCC, which obtain the
371 // function address from the vtable if a virtual function is being called).
372 // Dlugosz's trick is to make the codeptr point to a probe function which
373 // returns the 'this' pointer that was used.
375 // Define a generic class that uses virtual inheritance.
376 // It has a trival member function that returns the value of the 'this' pointer.
377 struct GenericVirtualClass : virtual public GenericClass
379 typedef GenericVirtualClass * (GenericVirtualClass::*ProbePtrType)();
380 GenericVirtualClass * GetThis() { return this; }
383 // __virtual_inheritance classes go here
385 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 2*sizeof(int) >
388 template <class X, class XFuncType, class GenericMemFuncType>
389 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
390 GenericMemFuncType &bound_func) {
393 GenericClass* (X::*ProbeFunc)();
394 MicrosoftVirtualMFP s;
396 u.func = function_to_bind;
397 bound_func = reinterpret_cast<GenericMemFuncType>(u.s.codeptr);
399 GenericVirtualClass::ProbePtrType virtfunc;
400 MicrosoftVirtualMFP s;
402 // Check that the horrible_cast<>s will work
403 typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)
404 && sizeof(function_to_bind)==sizeof(u.ProbeFunc)
405 && sizeof(u2.virtfunc)==sizeof(u2.s) ? 1 : -1];
406 // Unfortunately, taking the address of a MF prevents it from being inlined, so
407 // this next line can't be completely optimised away by the compiler.
408 u2.virtfunc = &GenericVirtualClass::GetThis;
409 u.s.codeptr = u2.s.codeptr;
410 return (pthis->*u.ProbeFunc)();
416 // Nasty hack for Microsoft Visual C++ 6.0
417 // unknown_inheritance classes go here
418 // There is a compiler bug in MSVC6 which generates incorrect code in this case!!
420 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*sizeof(int) >
422 template <class X, class XFuncType, class GenericMemFuncType>
423 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
424 GenericMemFuncType &bound_func) {
425 // There is an apalling but obscure compiler bug in MSVC6 and earlier:
426 // vtable_index and 'vtordisp' are always set to 0 in the
427 // unknown_inheritance case!
428 // This means that an incorrect function could be called!!!
429 // Compiling with the /vmg option leads to potentially incorrect code.
430 // This is probably the reason that the IDE has a user interface for specifying
431 // the /vmg option, but it is disabled - you can only specify /vmg on
432 // the command line. In VC1.5 and earlier, the compiler would ICE if it ever
433 // encountered this situation.
434 // It is OK to use the /vmg option if /vmm or /vms is specified.
436 // Fortunately, the wrong function is only called in very obscure cases.
437 // It only occurs when a derived class overrides a virtual function declared
438 // in a virtual base class, and the member function
439 // points to the *Derived* version of that function. The problem can be
440 // completely averted in 100% of cases by using the *Base class* for the
441 // member fpointer. Ie, if you use the base class as an interface, you'll
442 // stay out of trouble.
443 // Occasionally, you might want to point directly to a derived class function
444 // that isn't an override of a base class. In this case, both vtable_index
445 // and 'vtordisp' are zero, but a virtual_inheritance pointer will be generated.
446 // We can generate correct code in this case. To prevent an incorrect call from
447 // ever being made, on MSVC6 we generate a warning, and call a function to
448 // make the program crash instantly.
449 typedef char ERROR_VC6CompilerBug[-100];
457 // Nasty hack for Microsoft and Intel (IA32 and Itanium)
458 // unknown_inheritance classes go here
459 // This is probably the ugliest bit of code I've ever written. Look at the casts!
460 // There is a compiler bug in MSVC6 which prevents it from using this code.
462 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*sizeof(int) >
464 template <class X, class XFuncType, class GenericMemFuncType>
465 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
466 GenericMemFuncType &bound_func) {
467 // The member function pointer is 16 bytes long. We can't use a normal cast, but
468 // we can use a union to do the conversion.
471 // In VC++ and ICL, an unknown_inheritance member pointer
472 // is internally defined as:
474 GenericMemFuncType m_funcaddress; // points to the actual member function
475 int delta; // #bytes to be added to the 'this' pointer
476 int vtordisp; // #bytes to add to 'this' to find the vtable
477 int vtable_index; // or 0 if no virtual inheritance
480 // Check that the horrible_cast will work
481 typedef int ERROR_CantUsehorrible_cast[sizeof(XFuncType)==sizeof(u.s)? 1 : -1];
482 u.func = function_to_bind;
483 bound_func = u.s.funcaddress;
484 int virtual_delta = 0;
485 if (u.s.vtable_index) { // Virtual inheritance is used
486 // First, get to the vtable.
487 // It is 'vtordisp' bytes from the start of the class.
488 const int * vtable = *reinterpret_cast<const int *const*>(
489 reinterpret_cast<const char *>(pthis) + u.s.vtordisp );
491 // 'vtable_index' tells us where in the table we should be looking.
492 virtual_delta = u.s.vtordisp + *reinterpret_cast<const int *>(
493 reinterpret_cast<const char *>(vtable) + u.s.vtable_index);
495 // The int at 'virtual_delta' gives us the amount to add to 'this'.
496 // Finally we can add the three components together. Phew!
497 return reinterpret_cast<GenericClass *>(
498 reinterpret_cast<char *>(pthis) + u.s.delta + virtual_delta);
501 #endif // MSVC 7 and greater
503 #endif // MS/Intel hacks
505 } // namespace detail
507 ////////////////////////////////////////////////////////////////////////////////
508 // Fast Delegates, part 2:
510 // Define the delegate storage, and cope with static functions
512 ////////////////////////////////////////////////////////////////////////////////
514 // DelegateMemento -- an opaque structure which can hold an arbitary delegate.
515 // It knows nothing about the calling convention or number of arguments used by
516 // the function pointed to.
517 // It supplies comparison operators so that it can be stored in STL collections.
518 // It cannot be set to anything other than null, nor invoked directly:
519 // it must be converted to a specific delegate.
522 // There are two possible implementations: the Safe method and the Evil method.
523 // DelegateMemento - Safe version
525 // This implementation is standard-compliant, but a bit tricky.
526 // A static function pointer is stored inside the class.
527 // Here are the valid values:
528 // +-- Static pointer --+--pThis --+-- pMemFunc-+-- Meaning------+
529 // | 0 | 0 | 0 | Empty |
530 // | !=0 |(dontcare)| Invoker | Static function|
531 // | 0 | !=0 | !=0 | Method call |
532 // +--------------------+----------+------------+----------------+
533 // When stored stored inside a specific delegate, the 'dontcare' entries are replaced
534 // with a reference to the delegate itself. This complicates the = and == operators
535 // for the delegate class.
537 // DelegateMemento - Evil version
539 // For compilers where data pointers are at least as big as code pointers, it is
540 // possible to store the function pointer in the this pointer, using another
541 // horrible_cast. In this case the DelegateMemento implementation is simple:
542 // +--pThis --+-- pMemFunc-+-- Meaning---------------------+
544 // | !=0 | !=0 | Static function or method call|
545 // +----------+------------+-------------------------------+
546 // Note that the Sun C++ and MSVC documentation explicitly state that they
547 // support static_cast between void * and function pointers.
549 class DelegateMemento {
551 // the data is protected, not private, because many
552 // compilers have problems with template friends.
553 typedef void (detail::GenericClass::*GenericMemFuncType)(); // arbitrary MFP.
554 detail::GenericClass *m_pthis;
555 GenericMemFuncType m_pFunction;
557 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
558 typedef void (*GenericFuncPtr)(); // arbitrary code pointer
559 GenericFuncPtr m_pStaticFunction;
563 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
564 DelegateMemento() : m_pthis(0), m_pFunction(0), m_pStaticFunction(0) {};
566 m_pthis=0; m_pFunction=0; m_pStaticFunction=0;
569 DelegateMemento() : m_pthis(0), m_pFunction(0) {};
571 m_pthis=0; m_pFunction=0;
575 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
576 inline bool IsEqual (const DelegateMemento &x) const{
577 // We have to cope with the static function pointers as a special case
578 if (m_pFunction!=x.m_pFunction) return false;
579 // the static function ptrs must either both be equal, or both be 0.
580 if (m_pStaticFunction!=x.m_pStaticFunction) return false;
581 if (m_pStaticFunction!=0) return m_pthis==x.m_pthis;
585 inline bool IsEqual (const DelegateMemento &x) const{
586 return m_pthis==x.m_pthis && m_pFunction==x.m_pFunction;
589 // Provide a strict weak ordering for DelegateMementos.
590 inline bool IsLess(const DelegateMemento &right) const {
591 // deal with static function pointers first
592 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
593 if (m_pStaticFunction !=0 || right.m_pStaticFunction!=0)
594 return m_pStaticFunction < right.m_pStaticFunction;
596 if (m_pthis !=right.m_pthis) return m_pthis < right.m_pthis;
597 // There are no ordering operators for member function pointers,
598 // but we can fake one by comparing each byte. The resulting ordering is
599 // arbitrary (and compiler-dependent), but it permits storage in ordered STL containers.
600 return memcmp(&m_pFunction, &right.m_pFunction, sizeof(m_pFunction)) < 0;
603 inline bool operator ! () const // Is it bound to anything?
604 { return m_pFunction==0; }
606 DelegateMemento & operator = (const DelegateMemento &right) {
607 SetMementoFrom(right);
610 inline bool operator <(const DelegateMemento &right) {
611 return IsLess(right);
613 inline bool operator >(const DelegateMemento &right) {
614 return right.IsLess(*this);
616 DelegateMemento (const DelegateMemento &right) :
617 m_pFunction(right.m_pFunction), m_pthis(right.m_pthis)
618 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
619 , m_pStaticFunction (right.m_pStaticFunction)
623 void SetMementoFrom(const DelegateMemento &right) {
624 m_pFunction = right.m_pFunction;
625 m_pthis = right.m_pthis;
626 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
627 m_pStaticFunction = right.m_pStaticFunction;
635 // A private wrapper class that adds function signatures to DelegateMemento.
636 // It's the class that does most of the actual work.
637 // The signatures are specified by:
638 // GenericMemFunc: must be a type of GenericClass member function pointer.
639 // StaticFuncPtr: must be a type of function pointer with the same signature
640 // as GenericMemFunc.
641 // UnvoidStaticFuncPtr: is the same as StaticFuncPtr, except on VC6
642 // where it never returns void (returns DefaultVoid instead).
644 // An outer class, FastDelegateN<>, handles the invoking and creates the
645 // necessary typedefs.
646 // This class does everything else.
650 template < class GenericMemFunc, class StaticFuncPtr, class UnvoidStaticFuncPtr>
651 class ClosurePtr : public DelegateMemento {
653 // These functions are for setting the delegate to a member function.
655 // Here's the clever bit: we convert an arbitrary member function into a
656 // standard form. XMemFunc should be a member function of class X, but I can't
657 // enforce that here. It needs to be enforced by the wrapper class.
658 template < class X, class XMemFunc >
659 inline void bindmemfunc(X *pthis, XMemFunc function_to_bind ) {
660 m_pthis = SimplifyMemFunc< sizeof(function_to_bind) >
661 ::Convert(pthis, function_to_bind, m_pFunction);
662 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
663 m_pStaticFunction = 0;
666 // For const member functions, we only need a const class pointer.
667 // Since we know that the member function is const, it's safe to
668 // remove the const qualifier from the 'this' pointer with a const_cast.
669 // VC6 has problems if we just overload 'bindmemfunc', so we give it a different name.
670 template < class X, class XMemFunc>
671 inline void bindconstmemfunc(const X *pthis, XMemFunc function_to_bind) {
672 m_pthis= SimplifyMemFunc< sizeof(function_to_bind) >
673 ::Convert(const_cast<X*>(pthis), function_to_bind, m_pFunction);
674 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
675 m_pStaticFunction = 0;
678 #ifdef FASTDELEGATE_GCC_BUG_8271 // At present, GCC doesn't recognize constness of MFPs in templates
679 template < class X, class XMemFunc>
680 inline void bindmemfunc(const X *pthis, XMemFunc function_to_bind) {
681 bindconstmemfunc(pthis, function_to_bind);
682 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
683 m_pStaticFunction = 0;
687 // These functions are required for invoking the stored function
688 inline GenericClass *GetClosureThis() const { return m_pthis; }
689 inline GenericMemFunc GetClosureMemPtr() const { return reinterpret_cast<GenericMemFunc>(m_pFunction); }
691 // There are a few ways of dealing with static function pointers.
692 // There's a standard-compliant, but tricky method.
693 // There's also a straightforward hack, that won't work on DOS compilers using the
694 // medium memory model. It's so evil that I can't recommend it, but I've
695 // implemented it anyway because it produces very nice asm code.
697 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
699 // ClosurePtr<> - Safe version
701 // This implementation is standard-compliant, but a bit tricky.
702 // I store the function pointer inside the class, and the delegate then
703 // points to itself. Whenever the delegate is copied, these self-references
704 // must be transformed, and this complicates the = and == operators.
706 // The next two functions are for operator ==, =, and the copy constructor.
707 // We may need to convert the m_pthis pointers, so that
708 // they remain as self-references.
709 template< class DerivedClass >
710 inline void CopyFrom (DerivedClass *pParent, const DelegateMemento &x) {
712 if (m_pStaticFunction!=0) {
713 // transform self references...
714 m_pthis=reinterpret_cast<GenericClass *>(pParent);
717 // For static functions, the 'static_function_invoker' class in the parent
718 // will be called. The parent then needs to call GetStaticFunction() to find out
719 // the actual function to invoke.
720 template < class DerivedClass, class ParentInvokerSig >
721 inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker,
722 StaticFuncPtr function_to_bind ) {
723 bindmemfunc(pParent, static_function_invoker);
724 m_pStaticFunction=reinterpret_cast<GenericFuncPtr>(function_to_bind);
726 inline UnvoidStaticFuncPtr GetStaticFunction() const {
727 return reinterpret_cast<UnvoidStaticFuncPtr>(m_pStaticFunction);
731 // ClosurePtr<> - Evil version
733 // For compilers where data pointers are at least as big as code pointers, it is
734 // possible to store the function pointer in the this pointer, using another
735 // horrible_cast. Invocation isn't any faster, but it saves 4 bytes, and
736 // speeds up comparison and assignment. If C++ provided direct language support
737 // for delegates, they would produce asm code that was almost identical to this.
738 // Note that the Sun C++ and MSVC documentation explicitly state that they
739 // support static_cast between void * and function pointers.
741 template< class DerivedClass >
742 inline void CopyFrom (DerivedClass *pParent, const DelegateMemento &right) {
743 SetMementoFrom(right);
745 // For static functions, the 'static_function_invoker' class in the parent
746 // will be called. The parent then needs to call GetStaticFunction() to find out
747 // the actual function to invoke.
748 // ******** EVIL, EVIL CODE! *******
749 template < class DerivedClass, class ParentInvokerSig>
750 inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker,
751 StaticFuncPtr function_to_bind) {
752 // We'll be ignoring the 'this' pointer, but we need to make sure we pass
753 // a valid value to bindmemfunc().
754 bindmemfunc(pParent, static_function_invoker);
756 // WARNING! Evil hack. We store the function in the 'this' pointer!
757 // Ensure that there's a compilation failure if function pointers
758 // and data pointers have different sizes.
759 // If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
760 typedef int ERROR_CantUseEvilMethod[sizeof(GenericClass *)==sizeof(function_to_bind) ? 1 : -1];
761 m_pthis = horrible_cast<GenericClass *>(function_to_bind);
762 // MSVC, SunC++ and DMC accept the following (non-standard) code:
763 // m_pthis = static_cast<GenericClass *>(static_cast<void *>(function_to_bind));
764 // BCC32, Comeau and DMC accept this method. MSVC7.1 needs __int64 instead of long
765 // m_pthis = reinterpret_cast<GenericClass *>(reinterpret_cast<long>(function_to_bind));
767 // ******** EVIL, EVIL CODE! *******
768 // This function will be called with an invalid 'this' pointer!!
769 // We're just returning the 'this' pointer, converted into
770 // a function pointer!
771 inline UnvoidStaticFuncPtr GetStaticFunction() const {
772 // Ensure that there's a compilation failure if function pointers
773 // and data pointers have different sizes.
774 // If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
775 typedef int ERROR_CantUseEvilMethod[sizeof(UnvoidStaticFuncPtr)==sizeof(this) ? 1 : -1];
776 return horrible_cast<UnvoidStaticFuncPtr>(this);
778 #endif // !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
783 } // namespace detail
785 ////////////////////////////////////////////////////////////////////////////////
786 // Fast Delegates, part 3:
788 // Wrapper classes to ensure type safety
790 ////////////////////////////////////////////////////////////////////////////////
793 // Once we have the member function conversion templates, it's easy to make the
794 // wrapper classes. So that they will work with as many compilers as possible,
795 // the classes are of the form
796 // FastDelegate3<int, char *, double>
797 // They can cope with any combination of parameters. The max number of parameters
798 // allowed is 8, but it is trivial to increase this limit.
799 // Note that we need to treat const member functions seperately.
800 // All this class does is to enforce type safety, and invoke the delegate with
801 // the correct list of parameters.
803 // Because of the weird rule about the class of derived member function pointers,
804 // you sometimes need to apply a downcast to the 'this' pointer.
805 // This is the reason for the use of "implicit_cast<X*>(pthis)" in the code below.
806 // If CDerivedClass is derived from CBaseClass, but doesn't override SimpleVirtualFunction,
807 // without this trick you'd need to write:
808 // MyDelegate(static_cast<CBaseClass *>(&d), &CDerivedClass::SimpleVirtualFunction);
809 // but with the trick you can write
810 // MyDelegate(&d, &CDerivedClass::SimpleVirtualFunction);
812 // RetType is the type the compiler uses in compiling the template. For VC6,
813 // it cannot be void. DesiredRetType is the real type which is returned from
814 // all of the functions. It can be void.
817 template<class RetType=detail::DefaultVoid>
818 class FastDelegate0 {
820 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
821 typedef DesiredRetType (*StaticFunctionPtr)();
822 typedef RetType (*UnvoidStaticFunctionPtr)();
823 typedef RetType (detail::GenericClass::*GenericMemFn)();
824 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
826 // Typedefs to aid generic programming
827 typedef FastDelegate0 type;
829 // Construction and comparison functions
830 FastDelegate0() { clear(); }
831 FastDelegate0(const FastDelegate0 &x) {
832 m_Closure.CopyFrom(this, x.m_Closure); }
833 void operator = (const FastDelegate0 &x) {
834 m_Closure.CopyFrom(this, x.m_Closure); }
835 bool operator ==(const FastDelegate0 &x) const {
836 return m_Closure.IsEqual(x.m_Closure); }
837 bool operator !=(const FastDelegate0 &x) const {
838 return !m_Closure.IsEqual(x.m_Closure); }
839 bool operator <(const FastDelegate0 &x) const {
840 return m_Closure.IsLess(x.m_Closure); }
841 bool operator >(const FastDelegate0 &x) const {
842 return x.m_Closure.IsLess(m_Closure); }
843 // Binding to non-const member functions
844 template < class X, class Y >
845 FastDelegate0(Y *pthis, DesiredRetType (X::* function_to_bind)() ) {
846 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
847 template < class X, class Y >
848 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)()) {
849 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
850 // Binding to const member functions.
851 template < class X, class Y >
852 FastDelegate0(const Y *pthis, DesiredRetType (X::* function_to_bind)() const) {
853 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
854 template < class X, class Y >
855 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)() const) {
856 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
857 // Static functions. We convert them into a member function call.
858 // Note that this also provides a conversion from static functions.
859 FastDelegate0(DesiredRetType (*function_to_bind)() ) {
860 bind(function_to_bind); }
861 inline void bind(DesiredRetType (*function_to_bind)()) {
862 m_Closure.bindstaticfunc(this, &FastDelegate0::InvokeStaticFunction,
864 RetType operator() () const { // Invoke the delegate
865 // this next line is the only one that violates the standard
866 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(); }
867 inline bool operator ! () const { // Is it bound to anything?
869 inline bool empty() const {
871 void clear() { m_Closure.clear();}
872 // Conversion to and from the DelegateMemento storage class
873 const DelegateMemento & GetMemento() { return m_Closure; }
874 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
876 private: // Invoker for static functions
877 RetType InvokeStaticFunction() const {
878 return (*(m_Closure.GetStaticFunction()))(); }
882 template<class Param1, class RetType=detail::DefaultVoid>
883 class FastDelegate1 {
885 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
886 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1);
887 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1);
888 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1);
889 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
891 // Typedefs to aid generic programming
892 typedef FastDelegate1 type;
894 // Construction and comparison functions
895 FastDelegate1() { clear(); }
896 FastDelegate1(const FastDelegate1 &x) {
897 m_Closure.CopyFrom(this, x.m_Closure); }
898 void operator = (const FastDelegate1 &x) {
899 m_Closure.CopyFrom(this, x.m_Closure); }
900 bool operator ==(const FastDelegate1 &x) const {
901 return m_Closure.IsEqual(x.m_Closure); }
902 bool operator !=(const FastDelegate1 &x) const {
903 return !m_Closure.IsEqual(x.m_Closure); }
904 bool operator <(const FastDelegate1 &x) const {
905 return m_Closure.IsLess(x.m_Closure); }
906 bool operator >(const FastDelegate1 &x) const {
907 return x.m_Closure.IsLess(m_Closure); }
908 // Binding to non-const member functions
909 template < class X, class Y >
910 FastDelegate1(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) ) {
911 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
912 template < class X, class Y >
913 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1)) {
914 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
915 // Binding to const member functions.
916 template < class X, class Y >
917 FastDelegate1(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) const) {
918 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
919 template < class X, class Y >
920 inline void bind(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 // Static functions. We convert them into a member function call.
923 // Note that this also provides a conversion from static functions.
924 FastDelegate1(DesiredRetType (*function_to_bind)(Param1 p1) ) {
925 bind(function_to_bind); }
926 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1)) {
927 m_Closure.bindstaticfunc(this, &FastDelegate1::InvokeStaticFunction,
929 RetType operator() (Param1 p1) const { // Invoke the delegate
930 // this next line is the only one that violates the standard
931 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1); }
932 inline bool operator ! () const { // Is it bound to anything?
934 inline bool empty() const {
936 void clear() { m_Closure.clear();}
937 // Conversion to and from the DelegateMemento storage class
938 const DelegateMemento & GetMemento() { return m_Closure; }
939 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
941 private: // Invoker for static functions
942 RetType InvokeStaticFunction(Param1 p1) const {
943 return (*(m_Closure.GetStaticFunction()))(p1); }
947 template<class Param1, class Param2, class RetType=detail::DefaultVoid>
948 class FastDelegate2 {
950 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
951 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2);
952 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2);
953 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2);
954 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
956 // Typedefs to aid generic programming
957 typedef FastDelegate2 type;
959 // Construction and comparison functions
960 FastDelegate2() { clear(); }
961 FastDelegate2(const FastDelegate2 &x) {
962 m_Closure.CopyFrom(this, x.m_Closure); }
963 void operator = (const FastDelegate2 &x) {
964 m_Closure.CopyFrom(this, x.m_Closure); }
965 bool operator ==(const FastDelegate2 &x) const {
966 return m_Closure.IsEqual(x.m_Closure); }
967 bool operator !=(const FastDelegate2 &x) const {
968 return !m_Closure.IsEqual(x.m_Closure); }
969 bool operator <(const FastDelegate2 &x) const {
970 return m_Closure.IsLess(x.m_Closure); }
971 bool operator >(const FastDelegate2 &x) const {
972 return x.m_Closure.IsLess(m_Closure); }
973 // Binding to non-const member functions
974 template < class X, class Y >
975 FastDelegate2(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) ) {
976 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
977 template < class X, class Y >
978 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2)) {
979 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
980 // Binding to const member functions.
981 template < class X, class Y >
982 FastDelegate2(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) const) {
983 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
984 template < class X, class Y >
985 inline void bind(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 // Static functions. We convert them into a member function call.
988 // Note that this also provides a conversion from static functions.
989 FastDelegate2(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2) ) {
990 bind(function_to_bind); }
991 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2)) {
992 m_Closure.bindstaticfunc(this, &FastDelegate2::InvokeStaticFunction,
994 RetType operator() (Param1 p1, Param2 p2) const { // Invoke the delegate
995 // this next line is the only one that violates the standard
996 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2); }
997 inline bool operator ! () const { // Is it bound to anything?
999 inline bool empty() const {
1000 return !m_Closure; }
1001 void clear() { m_Closure.clear();}
1002 // Conversion to and from the DelegateMemento storage class
1003 const DelegateMemento & GetMemento() { return m_Closure; }
1004 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1006 private: // Invoker for static functions
1007 RetType InvokeStaticFunction(Param1 p1, Param2 p2) const {
1008 return (*(m_Closure.GetStaticFunction()))(p1, p2); }
1012 template<class Param1, class Param2, class Param3, class RetType=detail::DefaultVoid>
1013 class FastDelegate3 {
1015 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1016 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
1017 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
1018 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3);
1019 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1021 // Typedefs to aid generic programming
1022 typedef FastDelegate3 type;
1024 // Construction and comparison functions
1025 FastDelegate3() { clear(); }
1026 FastDelegate3(const FastDelegate3 &x) {
1027 m_Closure.CopyFrom(this, x.m_Closure); }
1028 void operator = (const FastDelegate3 &x) {
1029 m_Closure.CopyFrom(this, x.m_Closure); }
1030 bool operator ==(const FastDelegate3 &x) const {
1031 return m_Closure.IsEqual(x.m_Closure); }
1032 bool operator !=(const FastDelegate3 &x) const {
1033 return !m_Closure.IsEqual(x.m_Closure); }
1034 bool operator <(const FastDelegate3 &x) const {
1035 return m_Closure.IsLess(x.m_Closure); }
1036 bool operator >(const FastDelegate3 &x) const {
1037 return x.m_Closure.IsLess(m_Closure); }
1038 // Binding to non-const member functions
1039 template < class X, class Y >
1040 FastDelegate3(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) {
1041 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1042 template < class X, class Y >
1043 inline void bind(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 // Binding to const member functions.
1046 template < class X, class Y >
1047 FastDelegate3(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const) {
1048 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1049 template < class X, class Y >
1050 inline void bind(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 // Static functions. We convert them into a member function call.
1053 // Note that this also provides a conversion from static functions.
1054 FastDelegate3(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) {
1055 bind(function_to_bind); }
1056 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
1057 m_Closure.bindstaticfunc(this, &FastDelegate3::InvokeStaticFunction,
1058 function_to_bind); }
1059 RetType operator() (Param1 p1, Param2 p2, Param3 p3) const { // Invoke the delegate
1060 // this next line is the only one that violates the standard
1061 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3); }
1062 inline bool operator ! () const { // Is it bound to anything?
1063 return !m_Closure; }
1064 inline bool empty() const {
1065 return !m_Closure; }
1066 void clear() { m_Closure.clear();}
1067 // Conversion to and from the DelegateMemento storage class
1068 const DelegateMemento & GetMemento() { return m_Closure; }
1069 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1071 private: // Invoker for static functions
1072 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3) const {
1073 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3); }
1077 template<class Param1, class Param2, class Param3, class Param4, class RetType=detail::DefaultVoid>
1078 class FastDelegate4 {
1080 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1081 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
1082 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
1083 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
1084 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1086 // Typedefs to aid generic programming
1087 typedef FastDelegate4 type;
1089 // Construction and comparison functions
1090 FastDelegate4() { clear(); }
1091 FastDelegate4(const FastDelegate4 &x) {
1092 m_Closure.CopyFrom(this, x.m_Closure); }
1093 void operator = (const FastDelegate4 &x) {
1094 m_Closure.CopyFrom(this, x.m_Closure); }
1095 bool operator ==(const FastDelegate4 &x) const {
1096 return m_Closure.IsEqual(x.m_Closure); }
1097 bool operator !=(const FastDelegate4 &x) const {
1098 return !m_Closure.IsEqual(x.m_Closure); }
1099 bool operator <(const FastDelegate4 &x) const {
1100 return m_Closure.IsLess(x.m_Closure); }
1101 bool operator >(const FastDelegate4 &x) const {
1102 return x.m_Closure.IsLess(m_Closure); }
1103 // Binding to non-const member functions
1104 template < class X, class Y >
1105 FastDelegate4(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) {
1106 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1107 template < class X, class Y >
1108 inline void bind(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 // Binding to const member functions.
1111 template < class X, class Y >
1112 FastDelegate4(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) {
1113 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1114 template < class X, class Y >
1115 inline void bind(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 // Static functions. We convert them into a member function call.
1118 // Note that this also provides a conversion from static functions.
1119 FastDelegate4(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) {
1120 bind(function_to_bind); }
1121 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
1122 m_Closure.bindstaticfunc(this, &FastDelegate4::InvokeStaticFunction,
1123 function_to_bind); }
1124 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4) const { // Invoke the delegate
1125 // this next line is the only one that violates the standard
1126 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4); }
1127 inline bool operator ! () const { // Is it bound to anything?
1128 return !m_Closure; }
1129 inline bool empty() const {
1130 return !m_Closure; }
1131 void clear() { m_Closure.clear();}
1132 // Conversion to and from the DelegateMemento storage class
1133 const DelegateMemento & GetMemento() { return m_Closure; }
1134 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1136 private: // Invoker for static functions
1137 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const {
1138 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4); }
1142 template<class Param1, class Param2, class Param3, class Param4, class Param5, class RetType=detail::DefaultVoid>
1143 class FastDelegate5 {
1145 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1146 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
1147 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
1148 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
1149 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1151 // Typedefs to aid generic programming
1152 typedef FastDelegate5 type;
1154 // Construction and comparison functions
1155 FastDelegate5() { clear(); }
1156 FastDelegate5(const FastDelegate5 &x) {
1157 m_Closure.CopyFrom(this, x.m_Closure); }
1158 void operator = (const FastDelegate5 &x) {
1159 m_Closure.CopyFrom(this, x.m_Closure); }
1160 bool operator ==(const FastDelegate5 &x) const {
1161 return m_Closure.IsEqual(x.m_Closure); }
1162 bool operator !=(const FastDelegate5 &x) const {
1163 return !m_Closure.IsEqual(x.m_Closure); }
1164 bool operator <(const FastDelegate5 &x) const {
1165 return m_Closure.IsLess(x.m_Closure); }
1166 bool operator >(const FastDelegate5 &x) const {
1167 return x.m_Closure.IsLess(m_Closure); }
1168 // Binding to non-const member functions
1169 template < class X, class Y >
1170 FastDelegate5(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) {
1171 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1172 template < class X, class Y >
1173 inline void bind(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 // Binding to const member functions.
1176 template < class X, class Y >
1177 FastDelegate5(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) {
1178 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1179 template < class X, class Y >
1180 inline void bind(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 // Static functions. We convert them into a member function call.
1183 // Note that this also provides a conversion from static functions.
1184 FastDelegate5(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) {
1185 bind(function_to_bind); }
1186 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
1187 m_Closure.bindstaticfunc(this, &FastDelegate5::InvokeStaticFunction,
1188 function_to_bind); }
1189 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const { // Invoke the delegate
1190 // this next line is the only one that violates the standard
1191 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5); }
1192 inline bool operator ! () const { // Is it bound to anything?
1193 return !m_Closure; }
1194 inline bool empty() const {
1195 return !m_Closure; }
1196 void clear() { m_Closure.clear();}
1197 // Conversion to and from the DelegateMemento storage class
1198 const DelegateMemento & GetMemento() { return m_Closure; }
1199 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1201 private: // Invoker for static functions
1202 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const {
1203 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5); }
1207 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType=detail::DefaultVoid>
1208 class FastDelegate6 {
1210 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1211 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
1212 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
1213 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
1214 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1216 // Typedefs to aid generic programming
1217 typedef FastDelegate6 type;
1219 // Construction and comparison functions
1220 FastDelegate6() { clear(); }
1221 FastDelegate6(const FastDelegate6 &x) {
1222 m_Closure.CopyFrom(this, x.m_Closure); }
1223 void operator = (const FastDelegate6 &x) {
1224 m_Closure.CopyFrom(this, x.m_Closure); }
1225 bool operator ==(const FastDelegate6 &x) const {
1226 return m_Closure.IsEqual(x.m_Closure); }
1227 bool operator !=(const FastDelegate6 &x) const {
1228 return !m_Closure.IsEqual(x.m_Closure); }
1229 bool operator <(const FastDelegate6 &x) const {
1230 return m_Closure.IsLess(x.m_Closure); }
1231 bool operator >(const FastDelegate6 &x) const {
1232 return x.m_Closure.IsLess(m_Closure); }
1233 // Binding to non-const member functions
1234 template < class X, class Y >
1235 FastDelegate6(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) {
1236 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1237 template < class X, class Y >
1238 inline void bind(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 // Binding to const member functions.
1241 template < class X, class Y >
1242 FastDelegate6(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) {
1243 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1244 template < class X, class Y >
1245 inline void bind(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 // Static functions. We convert them into a member function call.
1248 // Note that this also provides a conversion from static functions.
1249 FastDelegate6(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) {
1250 bind(function_to_bind); }
1251 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
1252 m_Closure.bindstaticfunc(this, &FastDelegate6::InvokeStaticFunction,
1253 function_to_bind); }
1254 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const { // Invoke the delegate
1255 // this next line is the only one that violates the standard
1256 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6); }
1257 inline bool operator ! () const { // Is it bound to anything?
1258 return !m_Closure; }
1259 inline bool empty() const {
1260 return !m_Closure; }
1261 void clear() { m_Closure.clear();}
1262 // Conversion to and from the DelegateMemento storage class
1263 const DelegateMemento & GetMemento() { return m_Closure; }
1264 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1266 private: // Invoker for static functions
1267 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const {
1268 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6); }
1272 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType=detail::DefaultVoid>
1273 class FastDelegate7 {
1275 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1276 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
1277 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
1278 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
1279 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1281 // Typedefs to aid generic programming
1282 typedef FastDelegate7 type;
1284 // Construction and comparison functions
1285 FastDelegate7() { clear(); }
1286 FastDelegate7(const FastDelegate7 &x) {
1287 m_Closure.CopyFrom(this, x.m_Closure); }
1288 void operator = (const FastDelegate7 &x) {
1289 m_Closure.CopyFrom(this, x.m_Closure); }
1290 bool operator ==(const FastDelegate7 &x) const {
1291 return m_Closure.IsEqual(x.m_Closure); }
1292 bool operator !=(const FastDelegate7 &x) const {
1293 return !m_Closure.IsEqual(x.m_Closure); }
1294 bool operator <(const FastDelegate7 &x) const {
1295 return m_Closure.IsLess(x.m_Closure); }
1296 bool operator >(const FastDelegate7 &x) const {
1297 return x.m_Closure.IsLess(m_Closure); }
1298 // Binding to non-const member functions
1299 template < class X, class Y >
1300 FastDelegate7(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) {
1301 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1302 template < class X, class Y >
1303 inline void bind(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 // Binding to const member functions.
1306 template < class X, class Y >
1307 FastDelegate7(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) {
1308 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1309 template < class X, class Y >
1310 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) {
1311 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1312 // Static functions. We convert them into a member function call.
1313 // Note that this also provides a conversion from static functions.
1314 FastDelegate7(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) {
1315 bind(function_to_bind); }
1316 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
1317 m_Closure.bindstaticfunc(this, &FastDelegate7::InvokeStaticFunction,
1318 function_to_bind); }
1319 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const { // Invoke the delegate
1320 // this next line is the only one that violates the standard
1321 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7); }
1322 inline bool operator ! () const { // Is it bound to anything?
1323 return !m_Closure; }
1324 inline bool empty() const {
1325 return !m_Closure; }
1326 void clear() { m_Closure.clear();}
1327 // Conversion to and from the DelegateMemento storage class
1328 const DelegateMemento & GetMemento() { return m_Closure; }
1329 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1331 private: // Invoker for static functions
1332 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const {
1333 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7); }
1337 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType=detail::DefaultVoid>
1338 class FastDelegate8 {
1340 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1341 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
1342 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
1343 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
1344 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1346 // Typedefs to aid generic programming
1347 typedef FastDelegate8 type;
1349 // Construction and comparison functions
1350 FastDelegate8() { clear(); }
1351 FastDelegate8(const FastDelegate8 &x) {
1352 m_Closure.CopyFrom(this, x.m_Closure); }
1353 void operator = (const FastDelegate8 &x) {
1354 m_Closure.CopyFrom(this, x.m_Closure); }
1355 bool operator ==(const FastDelegate8 &x) const {
1356 return m_Closure.IsEqual(x.m_Closure); }
1357 bool operator !=(const FastDelegate8 &x) const {
1358 return !m_Closure.IsEqual(x.m_Closure); }
1359 bool operator <(const FastDelegate8 &x) const {
1360 return m_Closure.IsLess(x.m_Closure); }
1361 bool operator >(const FastDelegate8 &x) const {
1362 return x.m_Closure.IsLess(m_Closure); }
1363 // Binding to non-const member functions
1364 template < class X, class Y >
1365 FastDelegate8(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) {
1366 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1367 template < class X, class Y >
1368 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)) {
1369 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1370 // Binding to const member functions.
1371 template < class X, class Y >
1372 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) {
1373 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1374 template < class X, class Y >
1375 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) {
1376 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1377 // Static functions. We convert them into a member function call.
1378 // Note that this also provides a conversion from static functions.
1379 FastDelegate8(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) {
1380 bind(function_to_bind); }
1381 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
1382 m_Closure.bindstaticfunc(this, &FastDelegate8::InvokeStaticFunction,
1383 function_to_bind); }
1384 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const { // Invoke the delegate
1385 // this next line is the only one that violates the standard
1386 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8); }
1387 inline bool operator ! () const { // Is it bound to anything?
1388 return !m_Closure; }
1389 inline bool empty() const {
1390 return !m_Closure; }
1391 void clear() { m_Closure.clear();}
1392 // Conversion to and from the DelegateMemento storage class
1393 const DelegateMemento & GetMemento() { return m_Closure; }
1394 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1396 private: // Invoker for static functions
1397 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const {
1398 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8); }
1402 template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class RetType=detail::DefaultVoid>
1403 class FastDelegate9 {
1405 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1406 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9);
1407 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9);
1408 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9);
1409 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1411 // Typedefs to aid generic programming
1412 typedef FastDelegate9 type;
1414 // Construction and comparison functions
1415 FastDelegate9() { clear(); }
1416 FastDelegate9(const FastDelegate9 &x) {
1417 m_Closure.CopyFrom(this, x.m_Closure); }
1418 void operator = (const FastDelegate9 &x) {
1419 m_Closure.CopyFrom(this, x.m_Closure); }
1420 bool operator ==(const FastDelegate9 &x) const {
1421 return m_Closure.IsEqual(x.m_Closure); }
1422 bool operator !=(const FastDelegate9 &x) const {
1423 return !m_Closure.IsEqual(x.m_Closure); }
1424 bool operator <(const FastDelegate9 &x) const {
1425 return m_Closure.IsLess(x.m_Closure); }
1426 bool operator >(const FastDelegate9 &x) const {
1427 return x.m_Closure.IsLess(m_Closure); }
1428 // Binding to non-const member functions
1429 template < class X, class Y >
1430 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) ) {
1431 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1432 template < class X, class Y >
1433 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)) {
1434 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1435 // Binding to const member functions.
1436 template < class X, class Y >
1437 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) {
1438 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1439 template < class X, class Y >
1440 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) {
1441 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1442 // Static functions. We convert them into a member function call.
1443 // Note that this also provides a conversion from static functions.
1444 FastDelegate9(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) ) {
1445 bind(function_to_bind); }
1446 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)) {
1447 m_Closure.bindstaticfunc(this, &FastDelegate9::InvokeStaticFunction,
1448 function_to_bind); }
1449 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) const { // Invoke the delegate
1450 // this next line is the only one that violates the standard
1451 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9); }
1452 inline bool operator ! () const { // Is it bound to anything?
1453 return !m_Closure; }
1454 inline bool empty() const {
1455 return !m_Closure; }
1456 void clear() { m_Closure.clear();}
1457 // Conversion to and from the DelegateMemento storage class
1458 const DelegateMemento & GetMemento() { return m_Closure; }
1459 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1461 private: // Invoker for static functions
1462 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) const {
1463 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9); }
1467 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>
1468 class FastDelegate10 {
1470 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1471 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10);
1472 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10);
1473 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);
1474 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1476 // Typedefs to aid generic programming
1477 typedef FastDelegate10 type;
1479 // Construction and comparison functions
1480 FastDelegate10() { clear(); }
1481 FastDelegate10(const FastDelegate10 &x) {
1482 m_Closure.CopyFrom(this, x.m_Closure); }
1483 void operator = (const FastDelegate10 &x) {
1484 m_Closure.CopyFrom(this, x.m_Closure); }
1485 bool operator ==(const FastDelegate10 &x) const {
1486 return m_Closure.IsEqual(x.m_Closure); }
1487 bool operator !=(const FastDelegate10 &x) const {
1488 return !m_Closure.IsEqual(x.m_Closure); }
1489 bool operator <(const FastDelegate10 &x) const {
1490 return m_Closure.IsLess(x.m_Closure); }
1491 bool operator >(const FastDelegate10 &x) const {
1492 return x.m_Closure.IsLess(m_Closure); }
1493 // Binding to non-const member functions
1494 template < class X, class Y >
1495 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) ) {
1496 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1497 template < class X, class Y >
1498 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)) {
1499 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1500 // Binding to const member functions.
1501 template < class X, class Y >
1502 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) {
1503 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1504 template < class X, class Y >
1505 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) {
1506 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1507 // Static functions. We convert them into a member function call.
1508 // Note that this also provides a conversion from static functions.
1509 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) ) {
1510 bind(function_to_bind); }
1511 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)) {
1512 m_Closure.bindstaticfunc(this, &FastDelegate10::InvokeStaticFunction,
1513 function_to_bind); }
1514 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
1515 // this next line is the only one that violates the standard
1516 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); }
1517 inline bool operator ! () const { // Is it bound to anything?
1518 return !m_Closure; }
1519 inline bool empty() const {
1520 return !m_Closure; }
1521 void clear() { m_Closure.clear();}
1522 // Conversion to and from the DelegateMemento storage class
1523 const DelegateMemento & GetMemento() { return m_Closure; }
1524 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1526 private: // Invoker for static functions
1527 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10) const {
1528 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); }
1532 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>
1533 class FastDelegate11 {
1535 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1536 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);
1537 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);
1538 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);
1539 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1541 // Typedefs to aid generic programming
1542 typedef FastDelegate11 type;
1544 // Construction and comparison functions
1545 FastDelegate11() { clear(); }
1546 FastDelegate11(const FastDelegate11 &x) {
1547 m_Closure.CopyFrom(this, x.m_Closure); }
1548 void operator = (const FastDelegate11 &x) {
1549 m_Closure.CopyFrom(this, x.m_Closure); }
1550 bool operator ==(const FastDelegate11 &x) const {
1551 return m_Closure.IsEqual(x.m_Closure); }
1552 bool operator !=(const FastDelegate11 &x) const {
1553 return !m_Closure.IsEqual(x.m_Closure); }
1554 bool operator <(const FastDelegate11 &x) const {
1555 return m_Closure.IsLess(x.m_Closure); }
1556 bool operator >(const FastDelegate11 &x) const {
1557 return x.m_Closure.IsLess(m_Closure); }
1558 // Binding to non-const member functions
1559 template < class X, class Y >
1560 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) ) {
1561 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1562 template < class X, class Y >
1563 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)) {
1564 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1565 // Binding to const member functions.
1566 template < class X, class Y >
1567 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) {
1568 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1569 template < class X, class Y >
1570 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) {
1571 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1572 // Static functions. We convert them into a member function call.
1573 // Note that this also provides a conversion from static functions.
1574 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) ) {
1575 bind(function_to_bind); }
1576 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)) {
1577 m_Closure.bindstaticfunc(this, &FastDelegate11::InvokeStaticFunction,
1578 function_to_bind); }
1579 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
1580 // this next line is the only one that violates the standard
1581 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); }
1582 inline bool operator ! () const { // Is it bound to anything?
1583 return !m_Closure; }
1584 inline bool empty() const {
1585 return !m_Closure; }
1586 void clear() { m_Closure.clear();}
1587 // Conversion to and from the DelegateMemento storage class
1588 const DelegateMemento & GetMemento() { return m_Closure; }
1589 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1591 private: // Invoker for static functions
1592 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 {
1593 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); }
1597 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>
1598 class FastDelegate12 {
1600 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1601 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);
1602 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);
1603 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);
1604 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1606 // Typedefs to aid generic programming
1607 typedef FastDelegate12 type;
1609 // Construction and comparison functions
1610 FastDelegate12() { clear(); }
1611 FastDelegate12(const FastDelegate12 &x) {
1612 m_Closure.CopyFrom(this, x.m_Closure); }
1613 void operator = (const FastDelegate12 &x) {
1614 m_Closure.CopyFrom(this, x.m_Closure); }
1615 bool operator ==(const FastDelegate12 &x) const {
1616 return m_Closure.IsEqual(x.m_Closure); }
1617 bool operator !=(const FastDelegate12 &x) const {
1618 return !m_Closure.IsEqual(x.m_Closure); }
1619 bool operator <(const FastDelegate12 &x) const {
1620 return m_Closure.IsLess(x.m_Closure); }
1621 bool operator >(const FastDelegate12 &x) const {
1622 return x.m_Closure.IsLess(m_Closure); }
1623 // Binding to non-const member functions
1624 template < class X, class Y >
1625 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) ) {
1626 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1627 template < class X, class Y >
1628 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)) {
1629 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1630 // Binding to const member functions.
1631 template < class X, class Y >
1632 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) {
1633 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1634 template < class X, class Y >
1635 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) {
1636 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1637 // Static functions. We convert them into a member function call.
1638 // Note that this also provides a conversion from static functions.
1639 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) ) {
1640 bind(function_to_bind); }
1641 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)) {
1642 m_Closure.bindstaticfunc(this, &FastDelegate12::InvokeStaticFunction,
1643 function_to_bind); }
1644 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
1645 // this next line is the only one that violates the standard
1646 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); }
1647 inline bool operator ! () const { // Is it bound to anything?
1648 return !m_Closure; }
1649 inline bool empty() const {
1650 return !m_Closure; }
1651 void clear() { m_Closure.clear();}
1652 // Conversion to and from the DelegateMemento storage class
1653 const DelegateMemento & GetMemento() { return m_Closure; }
1654 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1656 private: // Invoker for static functions
1657 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 {
1658 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); }
1662 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>
1663 class FastDelegate13 {
1665 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1666 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);
1667 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);
1668 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);
1669 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1671 // Typedefs to aid generic programming
1672 typedef FastDelegate13 type;
1674 // Construction and comparison functions
1675 FastDelegate13() { clear(); }
1676 FastDelegate13(const FastDelegate13 &x) {
1677 m_Closure.CopyFrom(this, x.m_Closure); }
1678 void operator = (const FastDelegate13 &x) {
1679 m_Closure.CopyFrom(this, x.m_Closure); }
1680 bool operator ==(const FastDelegate13 &x) const {
1681 return m_Closure.IsEqual(x.m_Closure); }
1682 bool operator !=(const FastDelegate13 &x) const {
1683 return !m_Closure.IsEqual(x.m_Closure); }
1684 bool operator <(const FastDelegate13 &x) const {
1685 return m_Closure.IsLess(x.m_Closure); }
1686 bool operator >(const FastDelegate13 &x) const {
1687 return x.m_Closure.IsLess(m_Closure); }
1688 // Binding to non-const member functions
1689 template < class X, class Y >
1690 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) ) {
1691 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1692 template < class X, class Y >
1693 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)) {
1694 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1695 // Binding to const member functions.
1696 template < class X, class Y >
1697 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) {
1698 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1699 template < class X, class Y >
1700 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) {
1701 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1702 // Static functions. We convert them into a member function call.
1703 // Note that this also provides a conversion from static functions.
1704 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) ) {
1705 bind(function_to_bind); }
1706 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)) {
1707 m_Closure.bindstaticfunc(this, &FastDelegate13::InvokeStaticFunction,
1708 function_to_bind); }
1709 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
1710 // this next line is the only one that violates the standard
1711 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); }
1712 inline bool operator ! () const { // Is it bound to anything?
1713 return !m_Closure; }
1714 inline bool empty() const {
1715 return !m_Closure; }
1716 void clear() { m_Closure.clear();}
1717 // Conversion to and from the DelegateMemento storage class
1718 const DelegateMemento & GetMemento() { return m_Closure; }
1719 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1721 private: // Invoker for static functions
1722 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 {
1723 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); }
1727 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>
1728 class FastDelegate14 {
1730 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1731 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);
1732 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);
1733 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);
1734 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1736 // Typedefs to aid generic programming
1737 typedef FastDelegate14 type;
1739 // Construction and comparison functions
1740 FastDelegate14() { clear(); }
1741 FastDelegate14(const FastDelegate14 &x) {
1742 m_Closure.CopyFrom(this, x.m_Closure); }
1743 void operator = (const FastDelegate14 &x) {
1744 m_Closure.CopyFrom(this, x.m_Closure); }
1745 bool operator ==(const FastDelegate14 &x) const {
1746 return m_Closure.IsEqual(x.m_Closure); }
1747 bool operator !=(const FastDelegate14 &x) const {
1748 return !m_Closure.IsEqual(x.m_Closure); }
1749 bool operator <(const FastDelegate14 &x) const {
1750 return m_Closure.IsLess(x.m_Closure); }
1751 bool operator >(const FastDelegate14 &x) const {
1752 return x.m_Closure.IsLess(m_Closure); }
1753 // Binding to non-const member functions
1754 template < class X, class Y >
1755 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) ) {
1756 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1757 template < class X, class Y >
1758 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)) {
1759 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1760 // Binding to const member functions.
1761 template < class X, class Y >
1762 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) {
1763 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1764 template < class X, class Y >
1765 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) {
1766 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1767 // Static functions. We convert them into a member function call.
1768 // Note that this also provides a conversion from static functions.
1769 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) ) {
1770 bind(function_to_bind); }
1771 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)) {
1772 m_Closure.bindstaticfunc(this, &FastDelegate14::InvokeStaticFunction,
1773 function_to_bind); }
1774 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
1775 // this next line is the only one that violates the standard
1776 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); }
1777 inline bool operator ! () const { // Is it bound to anything?
1778 return !m_Closure; }
1779 inline bool empty() const {
1780 return !m_Closure; }
1781 void clear() { m_Closure.clear();}
1782 // Conversion to and from the DelegateMemento storage class
1783 const DelegateMemento & GetMemento() { return m_Closure; }
1784 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1786 private: // Invoker for static functions
1787 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 {
1788 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); }
1792 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>
1793 class FastDelegate15 {
1795 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1796 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);
1797 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);
1798 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);
1799 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1801 // Typedefs to aid generic programming
1802 typedef FastDelegate15 type;
1804 // Construction and comparison functions
1805 FastDelegate15() { clear(); }
1806 FastDelegate15(const FastDelegate15 &x) {
1807 m_Closure.CopyFrom(this, x.m_Closure); }
1808 void operator = (const FastDelegate15 &x) {
1809 m_Closure.CopyFrom(this, x.m_Closure); }
1810 bool operator ==(const FastDelegate15 &x) const {
1811 return m_Closure.IsEqual(x.m_Closure); }
1812 bool operator !=(const FastDelegate15 &x) const {
1813 return !m_Closure.IsEqual(x.m_Closure); }
1814 bool operator <(const FastDelegate15 &x) const {
1815 return m_Closure.IsLess(x.m_Closure); }
1816 bool operator >(const FastDelegate15 &x) const {
1817 return x.m_Closure.IsLess(m_Closure); }
1818 // Binding to non-const member functions
1819 template < class X, class Y >
1820 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) ) {
1821 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1822 template < class X, class Y >
1823 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15)) {
1824 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1825 // Binding to const member functions.
1826 template < class X, class Y >
1827 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) {
1828 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1829 template < class X, class Y >
1830 inline void bind(const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15) const) {
1831 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1832 // Static functions. We convert them into a member function call.
1833 // Note that this also provides a conversion from static functions.
1834 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) ) {
1835 bind(function_to_bind); }
1836 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)) {
1837 m_Closure.bindstaticfunc(this, &FastDelegate15::InvokeStaticFunction,
1838 function_to_bind); }
1839 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
1840 // this next line is the only one that violates the standard
1841 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); }
1842 inline bool operator ! () const { // Is it bound to anything?
1843 return !m_Closure; }
1844 inline bool empty() const {
1845 return !m_Closure; }
1846 void clear() { m_Closure.clear();}
1847 // Conversion to and from the DelegateMemento storage class
1848 const DelegateMemento & GetMemento() { return m_Closure; }
1849 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1851 private: // Invoker for static functions
1852 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 {
1853 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); }
1857 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>
1858 class FastDelegate16 {
1860 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1861 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);
1862 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);
1863 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);
1864 detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> m_Closure;
1866 // Typedefs to aid generic programming
1867 typedef FastDelegate16 type;
1869 // Construction and comparison functions
1870 FastDelegate16() { clear(); }
1871 FastDelegate16(const FastDelegate16 &x) {
1872 m_Closure.CopyFrom(this, x.m_Closure); }
1873 void operator = (const FastDelegate16 &x) {
1874 m_Closure.CopyFrom(this, x.m_Closure); }
1875 bool operator ==(const FastDelegate16 &x) const {
1876 return m_Closure.IsEqual(x.m_Closure); }
1877 bool operator !=(const FastDelegate16 &x) const {
1878 return !m_Closure.IsEqual(x.m_Closure); }
1879 bool operator <(const FastDelegate16 &x) const {
1880 return m_Closure.IsLess(x.m_Closure); }
1881 bool operator >(const FastDelegate16 &x) const {
1882 return x.m_Closure.IsLess(m_Closure); }
1883 // Binding to non-const member functions
1884 template < class X, class Y >
1885 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) ) {
1886 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1887 template < class X, class Y >
1888 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)) {
1889 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1890 // Binding to const member functions.
1891 template < class X, class Y >
1892 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) {
1893 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1894 template < class X, class Y >
1895 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) {
1896 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1897 // Static functions. We convert them into a member function call.
1898 // Note that this also provides a conversion from static functions.
1899 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) ) {
1900 bind(function_to_bind); }
1901 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)) {
1902 m_Closure.bindstaticfunc(this, &FastDelegate16::InvokeStaticFunction,
1903 function_to_bind); }
1904 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
1905 // this next line is the only one that violates the standard
1906 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16); }
1907 inline bool operator ! () const { // Is it bound to anything?
1908 return !m_Closure; }
1909 inline bool empty() const {
1910 return !m_Closure; }
1911 void clear() { m_Closure.clear();}
1912 // Conversion to and from the DelegateMemento storage class
1913 const DelegateMemento & GetMemento() { return m_Closure; }
1914 void SetMemento(const DelegateMemento &any) { m_Closure.CopyFrom(this, any); }
1916 private: // Invoker for static functions
1917 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 {
1918 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16); }
1922 ////////////////////////////////////////////////////////////////////////////////
1923 // Fast Delegates, part 4:
1925 // FastDelegate<> class (Original author: Jody Hagins)
1926 // Allows boost::function style syntax like:
1927 // FastDelegate< double (int, long) >
1929 // FastDelegate2< int, long, double >
1931 ////////////////////////////////////////////////////////////////////////////////
1933 #ifdef FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
1935 // Declare FastDelegate as a class template. It will be specialized
1936 // later for all number of arguments.
1937 template <typename Signature>
1941 // Specialization to allow use of
1942 // FastDelegate< R ( ) >
1944 // FastDelegate0 < R >
1945 template<typename R>
1946 class FastDelegate< R ( ) >
1947 // Inherit from FastDelegate0 so that it can be treated just
1948 // like a FastDelegate0
1949 : public FastDelegate0 < R >
1952 // Make using the base type a bit easier via typedef.
1953 typedef FastDelegate0 < R > BaseType;
1955 // Allow users access to the specific type of this delegate.
1956 typedef FastDelegate SelfType;
1958 // Mimic the base class constructors.
1959 FastDelegate() : BaseType() { }
1961 template < class X, class Y >
1962 FastDelegate(Y * pthis,
1963 R (X::* function_to_bind)( ))
1964 : BaseType(pthis, function_to_bind) { }
1966 template < class X, class Y >
1967 FastDelegate(const Y *pthis,
1968 R (X::* function_to_bind)( ) const)
1969 : BaseType(pthis, function_to_bind)
1972 FastDelegate(R (*function_to_bind)( ))
1973 : BaseType(function_to_bind) { }
1974 void operator = (const BaseType &x) {
1975 *static_cast<BaseType*>(this) = x; }
1979 // Specialization to allow use of
1980 // FastDelegate< R ( Param1 ) >
1982 // FastDelegate1 < Param1, R >
1983 template<typename R, class Param1>
1984 class FastDelegate< R ( Param1 ) >
1985 // Inherit from FastDelegate1 so that it can be treated just
1986 // like a FastDelegate1
1987 : public FastDelegate1 < Param1, R >
1990 // Make using the base type a bit easier via typedef.
1991 typedef FastDelegate1 < Param1, R > BaseType;
1993 // Allow users access to the specific type of this delegate.
1994 typedef FastDelegate SelfType;
1996 // Mimic the base class constructors.
1997 FastDelegate() : BaseType() { }
1999 template < class X, class Y >
2000 FastDelegate(Y * pthis,
2001 R (X::* function_to_bind)( Param1 p1 ))
2002 : BaseType(pthis, function_to_bind) { }
2004 template < class X, class Y >
2005 FastDelegate(const Y *pthis,
2006 R (X::* function_to_bind)( Param1 p1 ) const)
2007 : BaseType(pthis, function_to_bind)
2010 FastDelegate(R (*function_to_bind)( Param1 p1 ))
2011 : BaseType(function_to_bind) { }
2012 void operator = (const BaseType &x) {
2013 *static_cast<BaseType*>(this) = x; }
2017 // Specialization to allow use of
2018 // FastDelegate< R ( Param1, Param2 ) >
2020 // FastDelegate2 < Param1, Param2, R >
2021 template<typename R, class Param1, class Param2>
2022 class FastDelegate< R ( Param1, Param2 ) >
2023 // Inherit from FastDelegate2 so that it can be treated just
2024 // like a FastDelegate2
2025 : public FastDelegate2 < Param1, Param2, R >
2028 // Make using the base type a bit easier via typedef.
2029 typedef FastDelegate2 < Param1, Param2, R > BaseType;
2031 // Allow users access to the specific type of this delegate.
2032 typedef FastDelegate SelfType;
2034 // Mimic the base class constructors.
2035 FastDelegate() : BaseType() { }
2037 template < class X, class Y >
2038 FastDelegate(Y * pthis,
2039 R (X::* function_to_bind)( Param1 p1, Param2 p2 ))
2040 : BaseType(pthis, function_to_bind) { }
2042 template < class X, class Y >
2043 FastDelegate(const Y *pthis,
2044 R (X::* function_to_bind)( Param1 p1, Param2 p2 ) const)
2045 : BaseType(pthis, function_to_bind)
2048 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2 ))
2049 : BaseType(function_to_bind) { }
2050 void operator = (const BaseType &x) {
2051 *static_cast<BaseType*>(this) = x; }
2055 // Specialization to allow use of
2056 // FastDelegate< R ( Param1, Param2, Param3 ) >
2058 // FastDelegate3 < Param1, Param2, Param3, R >
2059 template<typename R, class Param1, class Param2, class Param3>
2060 class FastDelegate< R ( Param1, Param2, Param3 ) >
2061 // Inherit from FastDelegate3 so that it can be treated just
2062 // like a FastDelegate3
2063 : public FastDelegate3 < Param1, Param2, Param3, R >
2066 // Make using the base type a bit easier via typedef.
2067 typedef FastDelegate3 < Param1, Param2, Param3, R > BaseType;
2069 // Allow users access to the specific type of this delegate.
2070 typedef FastDelegate SelfType;
2072 // Mimic the base class constructors.
2073 FastDelegate() : BaseType() { }
2075 template < class X, class Y >
2076 FastDelegate(Y * pthis,
2077 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ))
2078 : BaseType(pthis, function_to_bind) { }
2080 template < class X, class Y >
2081 FastDelegate(const Y *pthis,
2082 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ) const)
2083 : BaseType(pthis, function_to_bind)
2086 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ))
2087 : BaseType(function_to_bind) { }
2088 void operator = (const BaseType &x) {
2089 *static_cast<BaseType*>(this) = x; }
2093 // Specialization to allow use of
2094 // FastDelegate< R ( Param1, Param2, Param3, Param4 ) >
2096 // FastDelegate4 < Param1, Param2, Param3, Param4, R >
2097 template<typename R, class Param1, class Param2, class Param3, class Param4>
2098 class FastDelegate< R ( Param1, Param2, Param3, Param4 ) >
2099 // Inherit from FastDelegate4 so that it can be treated just
2100 // like a FastDelegate4
2101 : public FastDelegate4 < Param1, Param2, Param3, Param4, R >
2104 // Make using the base type a bit easier via typedef.
2105 typedef FastDelegate4 < Param1, Param2, Param3, Param4, R > BaseType;
2107 // Allow users access to the specific type of this delegate.
2108 typedef FastDelegate SelfType;
2110 // Mimic the base class constructors.
2111 FastDelegate() : BaseType() { }
2113 template < class X, class Y >
2114 FastDelegate(Y * pthis,
2115 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ))
2116 : BaseType(pthis, function_to_bind) { }
2118 template < class X, class Y >
2119 FastDelegate(const Y *pthis,
2120 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const)
2121 : BaseType(pthis, function_to_bind)
2124 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ))
2125 : BaseType(function_to_bind) { }
2126 void operator = (const BaseType &x) {
2127 *static_cast<BaseType*>(this) = x; }
2131 // Specialization to allow use of
2132 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) >
2134 // FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R >
2135 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5>
2136 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) >
2137 // Inherit from FastDelegate5 so that it can be treated just
2138 // like a FastDelegate5
2139 : public FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R >
2142 // Make using the base type a bit easier via typedef.
2143 typedef FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R > BaseType;
2145 // Allow users access to the specific type of this delegate.
2146 typedef FastDelegate SelfType;
2148 // Mimic the base class constructors.
2149 FastDelegate() : BaseType() { }
2151 template < class X, class Y >
2152 FastDelegate(Y * pthis,
2153 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ))
2154 : BaseType(pthis, function_to_bind) { }
2156 template < class X, class Y >
2157 FastDelegate(const Y *pthis,
2158 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const)
2159 : BaseType(pthis, function_to_bind)
2162 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ))
2163 : BaseType(function_to_bind) { }
2164 void operator = (const BaseType &x) {
2165 *static_cast<BaseType*>(this) = x; }
2169 // Specialization to allow use of
2170 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) >
2172 // FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R >
2173 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6>
2174 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) >
2175 // Inherit from FastDelegate6 so that it can be treated just
2176 // like a FastDelegate6
2177 : public FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R >
2180 // Make using the base type a bit easier via typedef.
2181 typedef FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R > BaseType;
2183 // Allow users access to the specific type of this delegate.
2184 typedef FastDelegate SelfType;
2186 // Mimic the base class constructors.
2187 FastDelegate() : BaseType() { }
2189 template < class X, class Y >
2190 FastDelegate(Y * pthis,
2191 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ))
2192 : BaseType(pthis, function_to_bind) { }
2194 template < class X, class Y >
2195 FastDelegate(const Y *pthis,
2196 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const)
2197 : BaseType(pthis, function_to_bind)
2200 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ))
2201 : BaseType(function_to_bind) { }
2202 void operator = (const BaseType &x) {
2203 *static_cast<BaseType*>(this) = x; }
2207 // Specialization to allow use of
2208 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) >
2210 // FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R >
2211 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7>
2212 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) >
2213 // Inherit from FastDelegate7 so that it can be treated just
2214 // like a FastDelegate7
2215 : public FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R >
2218 // Make using the base type a bit easier via typedef.
2219 typedef FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R > BaseType;
2221 // Allow users access to the specific type of this delegate.
2222 typedef FastDelegate SelfType;
2224 // Mimic the base class constructors.
2225 FastDelegate() : BaseType() { }
2227 template < class X, class Y >
2228 FastDelegate(Y * pthis,
2229 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ))
2230 : BaseType(pthis, function_to_bind) { }
2232 template < class X, class Y >
2233 FastDelegate(const Y *pthis,
2234 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const)
2235 : BaseType(pthis, function_to_bind)
2238 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ))
2239 : BaseType(function_to_bind) { }
2240 void operator = (const BaseType &x) {
2241 *static_cast<BaseType*>(this) = x; }
2245 // Specialization to allow use of
2246 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) >
2248 // FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R >
2249 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8>
2250 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) >
2251 // Inherit from FastDelegate8 so that it can be treated just
2252 // like a FastDelegate8
2253 : public FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R >
2256 // Make using the base type a bit easier via typedef.
2257 typedef FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R > BaseType;
2259 // Allow users access to the specific type of this delegate.
2260 typedef FastDelegate SelfType;
2262 // Mimic the base class constructors.
2263 FastDelegate() : BaseType() { }
2265 template < class X, class Y >
2266 FastDelegate(Y * pthis,
2267 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ))
2268 : BaseType(pthis, function_to_bind) { }
2270 template < class X, class Y >
2271 FastDelegate(const Y *pthis,
2272 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const)
2273 : BaseType(pthis, function_to_bind)
2276 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ))
2277 : BaseType(function_to_bind) { }
2278 void operator = (const BaseType &x) {
2279 *static_cast<BaseType*>(this) = x; }
2283 // Specialization to allow use of
2284 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9 ) >
2286 // FastDelegate9 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, R >
2287 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9>
2288 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9 ) >
2289 // Inherit from FastDelegate9 so that it can be treated just
2290 // like a FastDelegate9
2291 : public FastDelegate9 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, R >
2294 // Make using the base type a bit easier via typedef.
2295 typedef FastDelegate9 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, R > BaseType;
2297 // Allow users access to the specific type of this delegate.
2298 typedef FastDelegate SelfType;
2300 // Mimic the base class constructors.
2301 FastDelegate() : BaseType() { }
2303 template < class X, class Y >
2304 FastDelegate(Y * pthis,
2305 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9 ))
2306 : BaseType(pthis, function_to_bind) { }
2308 template < class X, class Y >
2309 FastDelegate(const Y *pthis,
2310 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9 ) const)
2311 : BaseType(pthis, function_to_bind)
2314 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9 ))
2315 : BaseType(function_to_bind) { }
2316 void operator = (const BaseType &x) {
2317 *static_cast<BaseType*>(this) = x; }
2321 // Specialization to allow use of
2322 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10 ) >
2324 // FastDelegate10 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, R >
2325 template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10>
2326 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10 ) >
2327 // Inherit from FastDelegate10 so that it can be treated just
2328 // like a FastDelegate10
2329 : public FastDelegate10 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, R >
2332 // Make using the base type a bit easier via typedef.
2333 typedef FastDelegate10 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, R > BaseType;
2335 // Allow users access to the specific type of this delegate.
2336 typedef FastDelegate SelfType;
2338 // Mimic the base class constructors.
2339 FastDelegate() : BaseType() { }
2341 template < class X, class Y >
2342 FastDelegate(Y * pthis,
2343 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 ))
2344 : BaseType(pthis, function_to_bind) { }
2346 template < class X, class Y >
2347 FastDelegate(const Y *pthis,
2348 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)
2349 : BaseType(pthis, function_to_bind)
2352 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 ))
2353 : BaseType(function_to_bind) { }
2354 void operator = (const BaseType &x) {
2355 *static_cast<BaseType*>(this) = x; }
2359 // Specialization to allow use of
2360 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11 ) >
2362 // FastDelegate11 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, R >
2363 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>
2364 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11 ) >
2365 // Inherit from FastDelegate11 so that it can be treated just
2366 // like a FastDelegate11
2367 : public FastDelegate11 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, R >
2370 // Make using the base type a bit easier via typedef.
2371 typedef FastDelegate11 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, R > BaseType;
2373 // Allow users access to the specific type of this delegate.
2374 typedef FastDelegate SelfType;
2376 // Mimic the base class constructors.
2377 FastDelegate() : BaseType() { }
2379 template < class X, class Y >
2380 FastDelegate(Y * pthis,
2381 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 ))
2382 : BaseType(pthis, function_to_bind) { }
2384 template < class X, class Y >
2385 FastDelegate(const Y *pthis,
2386 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)
2387 : BaseType(pthis, function_to_bind)
2390 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 ))
2391 : BaseType(function_to_bind) { }
2392 void operator = (const BaseType &x) {
2393 *static_cast<BaseType*>(this) = x; }
2397 // Specialization to allow use of
2398 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12 ) >
2400 // FastDelegate12 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, R >
2401 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>
2402 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12 ) >
2403 // Inherit from FastDelegate12 so that it can be treated just
2404 // like a FastDelegate12
2405 : public FastDelegate12 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, R >
2408 // Make using the base type a bit easier via typedef.
2409 typedef FastDelegate12 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, R > BaseType;
2411 // Allow users access to the specific type of this delegate.
2412 typedef FastDelegate SelfType;
2414 // Mimic the base class constructors.
2415 FastDelegate() : BaseType() { }
2417 template < class X, class Y >
2418 FastDelegate(Y * pthis,
2419 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 ))
2420 : BaseType(pthis, function_to_bind) { }
2422 template < class X, class Y >
2423 FastDelegate(const Y *pthis,
2424 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)
2425 : BaseType(pthis, function_to_bind)
2428 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 ))
2429 : BaseType(function_to_bind) { }
2430 void operator = (const BaseType &x) {
2431 *static_cast<BaseType*>(this) = x; }
2435 // Specialization to allow use of
2436 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13 ) >
2438 // FastDelegate13 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, R >
2439 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>
2440 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13 ) >
2441 // Inherit from FastDelegate13 so that it can be treated just
2442 // like a FastDelegate13
2443 : public FastDelegate13 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, R >
2446 // Make using the base type a bit easier via typedef.
2447 typedef FastDelegate13 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, R > BaseType;
2449 // Allow users access to the specific type of this delegate.
2450 typedef FastDelegate SelfType;
2452 // Mimic the base class constructors.
2453 FastDelegate() : BaseType() { }
2455 template < class X, class Y >
2456 FastDelegate(Y * pthis,
2457 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 ))
2458 : BaseType(pthis, function_to_bind) { }
2460 template < class X, class Y >
2461 FastDelegate(const Y *pthis,
2462 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)
2463 : BaseType(pthis, function_to_bind)
2466 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 ))
2467 : BaseType(function_to_bind) { }
2468 void operator = (const BaseType &x) {
2469 *static_cast<BaseType*>(this) = x; }
2473 // Specialization to allow use of
2474 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14 ) >
2476 // FastDelegate14 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, R >
2477 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>
2478 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14 ) >
2479 // Inherit from FastDelegate14 so that it can be treated just
2480 // like a FastDelegate14
2481 : public FastDelegate14 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, R >
2484 // Make using the base type a bit easier via typedef.
2485 typedef FastDelegate14 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, R > BaseType;
2487 // Allow users access to the specific type of this delegate.
2488 typedef FastDelegate SelfType;
2490 // Mimic the base class constructors.
2491 FastDelegate() : BaseType() { }
2493 template < class X, class Y >
2494 FastDelegate(Y * pthis,
2495 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 ))
2496 : BaseType(pthis, function_to_bind) { }
2498 template < class X, class Y >
2499 FastDelegate(const Y *pthis,
2500 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)
2501 : BaseType(pthis, function_to_bind)
2504 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 ))
2505 : BaseType(function_to_bind) { }
2506 void operator = (const BaseType &x) {
2507 *static_cast<BaseType*>(this) = x; }
2511 // Specialization to allow use of
2512 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15 ) >
2514 // FastDelegate15 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, R >
2515 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>
2516 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15 ) >
2517 // Inherit from FastDelegate15 so that it can be treated just
2518 // like a FastDelegate15
2519 : public FastDelegate15 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, R >
2522 // Make using the base type a bit easier via typedef.
2523 typedef FastDelegate15 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, R > BaseType;
2525 // Allow users access to the specific type of this delegate.
2526 typedef FastDelegate SelfType;
2528 // Mimic the base class constructors.
2529 FastDelegate() : BaseType() { }
2531 template < class X, class Y >
2532 FastDelegate(Y * pthis,
2533 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 ))
2534 : BaseType(pthis, function_to_bind) { }
2536 template < class X, class Y >
2537 FastDelegate(const Y *pthis,
2538 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)
2539 : BaseType(pthis, function_to_bind)
2542 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 ))
2543 : BaseType(function_to_bind) { }
2544 void operator = (const BaseType &x) {
2545 *static_cast<BaseType*>(this) = x; }
2549 // Specialization to allow use of
2550 // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16 ) >
2552 // FastDelegate16 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, R >
2553 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>
2554 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16 ) >
2555 // Inherit from FastDelegate16 so that it can be treated just
2556 // like a FastDelegate16
2557 : public FastDelegate16 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, R >
2560 // Make using the base type a bit easier via typedef.
2561 typedef FastDelegate16 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, R > BaseType;
2563 // Allow users access to the specific type of this delegate.
2564 typedef FastDelegate SelfType;
2566 // Mimic the base class constructors.
2567 FastDelegate() : BaseType() { }
2569 template < class X, class Y >
2570 FastDelegate(Y * pthis,
2571 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 ))
2572 : BaseType(pthis, function_to_bind) { }
2574 template < class X, class Y >
2575 FastDelegate(const Y *pthis,
2576 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)
2577 : BaseType(pthis, function_to_bind)
2580 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 ))
2581 : BaseType(function_to_bind) { }
2582 void operator = (const BaseType &x) {
2583 *static_cast<BaseType*>(this) = x; }
2587 #endif //FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
2589 ////////////////////////////////////////////////////////////////////////////////
2590 // Fast Delegates, part 5:
2592 // MakeDelegate() helper function
2594 // MakeDelegate(&x, &X::func) returns a fastdelegate of the type
2595 // necessary for calling x.func() with the correct number of arguments.
2596 // This makes it possible to eliminate many typedefs from user code.
2598 ////////////////////////////////////////////////////////////////////////////////
2600 // Also declare overloads of a MakeDelegate() global function to
2601 // reduce the need for typedefs.
2602 // We need seperate overloads for const and non-const member functions.
2603 // Also, because of the weird rule about the class of derived member function pointers,
2604 // implicit downcasts may need to be applied later to the 'this' pointer.
2605 // That's why two classes (X and Y) appear in the definitions. Y must be implicitly
2608 // Workaround for VC6. VC6 needs void return types converted into DefaultVoid.
2609 // GCC 3.2 and later won't compile this unless it's preceded by 'typename',
2610 // but VC6 doesn't allow 'typename' in this context.
2611 // So, I have to use a macro.
2614 #define FASTDLGT_RETTYPE detail::VoidToDefaultVoid<RetType>::type
2616 #define FASTDLGT_RETTYPE RetType
2620 template <class X, class Y, class RetType>
2621 FastDelegate0<FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)()) {
2622 return FastDelegate0<FASTDLGT_RETTYPE>(x, func);
2625 template <class X, class Y, class RetType>
2626 FastDelegate0<FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)() const) {
2627 return FastDelegate0<FASTDLGT_RETTYPE>(x, func);
2631 template <class X, class Y, class Param1, class RetType>
2632 FastDelegate1<Param1, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1)) {
2633 return FastDelegate1<Param1, FASTDLGT_RETTYPE>(x, func);
2636 template <class X, class Y, class Param1, class RetType>
2637 FastDelegate1<Param1, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1) const) {
2638 return FastDelegate1<Param1, FASTDLGT_RETTYPE>(x, func);
2642 template <class X, class Y, class Param1, class Param2, class RetType>
2643 FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2)) {
2644 return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(x, func);
2647 template <class X, class Y, class Param1, class Param2, class RetType>
2648 FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2) const) {
2649 return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(x, func);
2653 template <class X, class Y, class Param1, class Param2, class Param3, class RetType>
2654 FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3)) {
2655 return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(x, func);
2658 template <class X, class Y, class Param1, class Param2, class Param3, class RetType>
2659 FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3) const) {
2660 return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(x, func);
2664 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class RetType>
2665 FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
2666 return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(x, func);
2669 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class RetType>
2670 FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) {
2671 return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(x, func);
2675 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class RetType>
2676 FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
2677 return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(x, func);
2680 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class RetType>
2681 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) {
2682 return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(x, func);
2686 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType>
2687 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)) {
2688 return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(x, func);
2691 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType>
2692 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) {
2693 return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(x, func);
2697 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType>
2698 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)) {
2699 return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(x, func);
2702 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType>
2703 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) {
2704 return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(x, func);
2708 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType>
2709 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)) {
2710 return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(x, func);
2713 template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType>
2714 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) {
2715 return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(x, func);
2719 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>
2720 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)) {
2721 return FastDelegate9<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, FASTDLGT_RETTYPE>(x, func);
2724 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>
2725 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) {
2726 return FastDelegate9<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, FASTDLGT_RETTYPE>(x, func);
2730 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>
2731 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)) {
2732 return FastDelegate10<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, FASTDLGT_RETTYPE>(x, func);
2735 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>
2736 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) {
2737 return FastDelegate10<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, FASTDLGT_RETTYPE>(x, func);
2741 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>
2742 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)) {
2743 return FastDelegate11<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, FASTDLGT_RETTYPE>(x, func);
2746 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>
2747 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) {
2748 return FastDelegate11<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, FASTDLGT_RETTYPE>(x, func);
2752 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>
2753 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)) {
2754 return FastDelegate12<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, FASTDLGT_RETTYPE>(x, func);
2757 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>
2758 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) {
2759 return FastDelegate12<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, FASTDLGT_RETTYPE>(x, func);
2763 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>
2764 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)) {
2765 return FastDelegate13<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, FASTDLGT_RETTYPE>(x, func);
2768 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>
2769 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) {
2770 return FastDelegate13<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, FASTDLGT_RETTYPE>(x, func);
2774 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>
2775 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)) {
2776 return FastDelegate14<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, FASTDLGT_RETTYPE>(x, func);
2779 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>
2780 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) {
2781 return FastDelegate14<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, FASTDLGT_RETTYPE>(x, func);
2785 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>
2786 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)) {
2787 return FastDelegate15<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, FASTDLGT_RETTYPE>(x, func);
2790 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>
2791 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) {
2792 return FastDelegate15<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, FASTDLGT_RETTYPE>(x, func);
2796 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>
2797 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)) {
2798 return FastDelegate16<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, FASTDLGT_RETTYPE>(x, func);
2801 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>
2802 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) {
2803 return FastDelegate16<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, FASTDLGT_RETTYPE>(x, func);
2807 // clean up after ourselves...
2808 #undef FASTDLGT_RETTYPE
2810 } // namespace fastdelegate
2812 #endif // !defined(FASTDELEGATE_H)