48 #ifndef FASTDELEGATE_H
49 #define FASTDELEGATE_H
64 #define FASTDELEGATE_USESTATICFUNCTIONHACK
77 #if defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__VECTOR_C) && !defined(__ICL) && !defined(__BORLANDC__)
78 #define FASTDLGT_ISMSVC
80 #if (_MSC_VER <1300) // Many workarounds are required for VC6.
82 #pragma warning(disable:4786) // disable this ridiculous warning
91 #if defined(_MSC_VER) && !defined(__MWERKS__)
92 #define FASTDLGT_MICROSOFT_MFP
94 #if !defined(__VECTOR_C)
96 #define FASTDLGT_HASINHERITANCE_KEYWORDS
101 #if defined(FASTDLGT_ISMSVC) && (_MSC_VER >=1310) // VC 7.1
102 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
106 #if defined (__DMC__) || defined(__GNUC__) || defined(__ICL) || defined(__COMO__)
107 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
111 #if defined (__MWERKS__)
112 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
115 #ifdef __GNUC__ // Workaround GCC bug #8271
117 #define FASTDELEGATE_GCC_BUG_8271
139 namespace fastdelegate {
148 template <
class OutputClass,
class InputClass>
149 inline OutputClass implicit_cast(InputClass input){
163 template <
class OutputClass,
class InputClass>
169 template <
class OutputClass,
class InputClass>
170 inline OutputClass horrible_cast(
const InputClass input){
175 typedef int ERROR_CantUseHorrible_cast[
sizeof(InputClass)==
sizeof(u)
176 &&
sizeof(InputClass)==
sizeof(OutputClass) ? 1 : -1];
188 #define FASTDELEGATEDECLARE(CLASSNAME) class CLASSNAME;
192 #undef FASTDELEGATE_USESTATICFUNCTIONHACK
214 typedef const void * DefaultVoid;
217 typedef void DefaultVoid;
251 #ifdef FASTDLGT_MICROSOFT_MFP
253 #ifdef FASTDLGT_HASINHERITANCE_KEYWORDS
257 class __single_inheritance GenericClass;
265 class GenericClass {};
271 const int SINGLE_MEMFUNCPTR_SIZE =
sizeof(void (GenericClass::*)());
287 template <
class X,
class XFuncType,
class GenericMemFuncType>
288 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
289 GenericMemFuncType &bound_func) {
292 typedef char ERROR_Unsupported_member_function_pointer_on_this_compiler[N-100];
301 template <
class X,
class XFuncType,
class GenericMemFuncType>
302 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
303 GenericMemFuncType &bound_func) {
308 bound_func = horrible_cast<GenericMemFuncType>(function_to_bind);
310 bound_func =
reinterpret_cast<GenericMemFuncType
>(function_to_bind);
312 return reinterpret_cast<GenericClass *
>(pthis);
326 #ifdef FASTDLGT_MICROSOFT_MFP
336 template <
class X,
class XFuncType,
class GenericMemFuncType>
337 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
338 GenericMemFuncType &bound_func) {
344 GenericMemFuncType funcaddress;
349 typedef int ERROR_CantUsehorrible_cast[
sizeof(function_to_bind)==
sizeof(u.s)? 1 : -1];
350 u.func = function_to_bind;
351 bound_func = u.s.funcaddress;
352 return reinterpret_cast<GenericClass *
>(
reinterpret_cast<char *
>(pthis) + u.s.delta);
366 struct MicrosoftVirtualMFP {
367 void (GenericClass::*codeptr)();
380 struct GenericVirtualClass :
virtual public GenericClass
382 typedef GenericVirtualClass * (GenericVirtualClass::*ProbePtrType)();
383 GenericVirtualClass * GetThis() {
return this; }
388 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 2*
sizeof(int) >
391 template <
class X,
class XFuncType,
class GenericMemFuncType>
392 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
393 GenericMemFuncType &bound_func) {
396 GenericClass* (X::*ProbeFunc)();
397 MicrosoftVirtualMFP s;
399 u.func = function_to_bind;
400 bound_func =
reinterpret_cast<GenericMemFuncType
>(u.s.codeptr);
402 GenericVirtualClass::ProbePtrType virtfunc;
403 MicrosoftVirtualMFP s;
406 typedef int ERROR_CantUsehorrible_cast[
sizeof(function_to_bind)==
sizeof(u.s)
407 &&
sizeof(function_to_bind)==
sizeof(u.ProbeFunc)
408 &&
sizeof(u2.virtfunc)==
sizeof(u2.s) ? 1 : -1];
411 u2.virtfunc = &GenericVirtualClass::GetThis;
412 u.s.codeptr = u2.s.codeptr;
413 return (pthis->*u.ProbeFunc)();
423 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*
sizeof(int) >
425 template <
class X,
class XFuncType,
class GenericMemFuncType>
426 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
427 GenericMemFuncType &bound_func) {
452 typedef char ERROR_VC6CompilerBug[-100];
465 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*
sizeof(int) >
467 template <
class X,
class XFuncType,
class GenericMemFuncType>
468 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
469 GenericMemFuncType &bound_func) {
477 GenericMemFuncType m_funcaddress;
484 typedef int ERROR_CantUsehorrible_cast[
sizeof(XFuncType)==
sizeof(u.s)? 1 : -1];
485 u.func = function_to_bind;
486 bound_func = u.s.funcaddress;
487 int virtual_delta = 0;
488 if (u.s.vtable_index) {
491 const int * vtable = *
reinterpret_cast<const int *const*
>(
492 reinterpret_cast<const char *
>(pthis) + u.s.vtordisp );
495 virtual_delta = u.s.vtordisp + *
reinterpret_cast<const int *
>(
496 reinterpret_cast<const char *
>(vtable) + u.s.vtable_index);
500 return reinterpret_cast<GenericClass *
>(
501 reinterpret_cast<char *
>(pthis) + u.s.delta + virtual_delta);
504 #endif // MSVC 7 and greater
506 #endif // MS/Intel hacks
560 typedef void (detail::GenericClass::*GenericMemFuncType)();
561 detail::GenericClass *m_pthis;
562 GenericMemFuncType m_pFunction;
564 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
565 typedef void (*GenericFuncPtr)();
566 GenericFuncPtr m_pStaticFunction;
570 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
571 DelegateMemento() : m_pthis(0), m_pFunction(0), m_pStaticFunction(0) {};
573 m_pthis=0; m_pFunction=0; m_pStaticFunction=0;
577 void clear() { m_pthis=0; m_pFunction=0; }
580 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
583 if (m_pFunction!=x.m_pFunction)
return false;
585 if (m_pStaticFunction!=x.m_pStaticFunction)
return false;
586 if (m_pStaticFunction!=0)
return m_pthis==x.m_pthis;
591 return m_pthis==x.m_pthis && m_pFunction==x.m_pFunction;
597 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
598 if (m_pStaticFunction !=0 || right.m_pStaticFunction!=0)
599 return m_pStaticFunction < right.m_pStaticFunction;
601 if (m_pthis !=right.m_pthis)
return m_pthis < right.m_pthis;
605 return memcmp(&m_pFunction, &right.m_pFunction,
sizeof(m_pFunction)) < 0;
611 inline bool operator ! ()
const
612 {
return m_pthis==0 && m_pFunction==0; }
613 inline bool empty()
const
614 {
return m_pthis==0 && m_pFunction==0; }
617 SetMementoFrom(right);
621 return IsLess(right);
624 return right.IsLess(*
this);
627 m_pFunction(right.m_pFunction), m_pthis(right.m_pthis)
628 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
629 , m_pStaticFunction (right.m_pStaticFunction)
634 m_pFunction = right.m_pFunction;
635 m_pthis = right.m_pthis;
636 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
637 m_pStaticFunction = right.m_pStaticFunction;
660 template <
class GenericMemFunc,
class StaticFuncPtr,
class Un
voidStaticFuncPtr>
668 template <
class X,
class XMemFunc >
669 inline void bindmemfunc(X *pthis, XMemFunc function_to_bind ) {
671 ::Convert(pthis, function_to_bind, m_pFunction);
672 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
673 m_pStaticFunction = 0;
680 template <
class X,
class XMemFunc>
681 inline void bindconstmemfunc(
const X *pthis, XMemFunc function_to_bind) {
683 ::Convert(const_cast<X*>(pthis), function_to_bind, m_pFunction);
684 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
685 m_pStaticFunction = 0;
688 #ifdef FASTDELEGATE_GCC_BUG_8271 // At present, GCC doesn't recognize constness of MFPs in templates
689 template <
class X,
class XMemFunc>
690 inline void bindmemfunc(
const X *pthis, XMemFunc function_to_bind) {
691 bindconstmemfunc(pthis, function_to_bind);
692 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
693 m_pStaticFunction = 0;
698 inline GenericClass *GetClosureThis()
const {
return m_pthis; }
699 inline GenericMemFunc GetClosureMemPtr()
const {
return reinterpret_cast<GenericMemFunc
>(m_pFunction); }
707 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
719 template<
class DerivedClass >
720 inline void CopyFrom (DerivedClass *pParent,
const DelegateMemento &x) {
722 if (m_pStaticFunction!=0) {
724 m_pthis=
reinterpret_cast<GenericClass *
>(pParent);
730 template <
class DerivedClass,
class ParentInvokerSig >
731 inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker,
732 StaticFuncPtr function_to_bind ) {
733 if (function_to_bind==0) {
736 bindmemfunc(pParent, static_function_invoker);
738 m_pStaticFunction=
reinterpret_cast<GenericFuncPtr
>(function_to_bind);
740 inline UnvoidStaticFuncPtr GetStaticFunction()
const {
741 return reinterpret_cast<UnvoidStaticFuncPtr
>(m_pStaticFunction);
755 template<
class DerivedClass >
756 inline void CopyFrom (DerivedClass *pParent,
const DelegateMemento &right) {
757 SetMementoFrom(right);
763 template <
class DerivedClass,
class ParentInvokerSig>
764 inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker,
765 StaticFuncPtr function_to_bind) {
766 if (function_to_bind==0) {
771 bindmemfunc(pParent, static_function_invoker);
778 typedef int ERROR_CantUseEvilMethod[
sizeof(GenericClass *)==
sizeof(function_to_bind) ? 1 : -1];
779 m_pthis = horrible_cast<GenericClass *>(function_to_bind);
789 inline UnvoidStaticFuncPtr GetStaticFunction()
const {
793 typedef int ERROR_CantUseEvilMethod[
sizeof(UnvoidStaticFuncPtr)==
sizeof(
this) ? 1 : -1];
794 return horrible_cast<UnvoidStaticFuncPtr>(
this);
796 #endif // !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
799 inline bool IsEqualToStaticFuncPtr(StaticFuncPtr funcptr){
800 if (funcptr==0)
return empty();
803 else return funcptr==
reinterpret_cast<StaticFuncPtr
>(GetStaticFunction());
850 template<
class RetType=detail::DefaultVo
id>
853 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
854 typedef DesiredRetType (*StaticFunctionPtr)();
855 typedef RetType (*UnvoidStaticFunctionPtr)();
856 typedef RetType (detail::GenericClass::*GenericMemFn)();
866 m_Closure.CopyFrom(
this, x.m_Closure); }
868 m_Closure.CopyFrom(
this, x.m_Closure); }
870 return m_Closure.IsEqual(x.m_Closure); }
872 return !m_Closure.IsEqual(x.m_Closure); }
874 return m_Closure.IsLess(x.m_Closure); }
876 return x.m_Closure.IsLess(m_Closure); }
878 template <
class X,
class Y >
879 FastDelegate0(Y *pthis, DesiredRetType (X::* function_to_bind)() ) {
880 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
881 template <
class X,
class Y >
882 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)()) {
883 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
885 template <
class X,
class Y >
886 FastDelegate0(
const Y *pthis, DesiredRetType (X::* function_to_bind)()
const) {
887 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
888 template <
class X,
class Y >
889 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)()
const) {
890 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
894 bind(function_to_bind); }
896 void operator = (DesiredRetType (*function_to_bind)() ) {
897 bind(function_to_bind); }
898 inline void bind(DesiredRetType (*function_to_bind)()) {
899 m_Closure.bindstaticfunc(
this, &FastDelegate0::InvokeStaticFunction,
902 RetType operator() ()
const {
903 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(); }
906 typedef struct SafeBoolStruct {
907 int a_data_pointer_to_this_is_0_on_buggy_compilers;
908 StaticFunctionPtr m_nonzero;
910 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
912 operator unspecified_bool_type()
const {
913 return empty()? 0: &SafeBoolStruct::m_nonzero;
916 inline bool operator==(StaticFunctionPtr funcptr) {
917 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
918 inline bool operator!=(StaticFunctionPtr funcptr) {
919 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
920 inline bool operator ! ()
const {
922 inline bool empty()
const {
924 void clear() { m_Closure.clear();}
927 void SetMemento(
const DelegateMemento &any) { m_Closure.CopyFrom(
this, any); }
930 RetType InvokeStaticFunction()
const {
931 return (*(m_Closure.GetStaticFunction()))(); }
935 template<
class Param1,
class RetType=detail::DefaultVo
id>
938 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
939 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1);
940 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1);
941 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1);
951 m_Closure.CopyFrom(
this, x.m_Closure); }
953 m_Closure.CopyFrom(
this, x.m_Closure); }
955 return m_Closure.IsEqual(x.m_Closure); }
957 return !m_Closure.IsEqual(x.m_Closure); }
959 return m_Closure.IsLess(x.m_Closure); }
961 return x.m_Closure.IsLess(m_Closure); }
963 template <
class X,
class Y >
964 FastDelegate1(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) ) {
965 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
966 template <
class X,
class Y >
967 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1)) {
968 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
970 template <
class X,
class Y >
971 FastDelegate1(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1)
const) {
972 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
973 template <
class X,
class Y >
974 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1)
const) {
975 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
978 FastDelegate1(DesiredRetType (*function_to_bind)(Param1 p1) ) {
979 bind(function_to_bind); }
981 void operator = (DesiredRetType (*function_to_bind)(Param1 p1) ) {
982 bind(function_to_bind); }
983 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1)) {
984 m_Closure.bindstaticfunc(
this, &FastDelegate1::InvokeStaticFunction,
987 RetType operator() (Param1 p1)
const {
988 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1); }
991 typedef struct SafeBoolStruct {
992 int a_data_pointer_to_this_is_0_on_buggy_compilers;
993 StaticFunctionPtr m_nonzero;
995 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
997 operator unspecified_bool_type()
const {
998 return empty()? 0: &SafeBoolStruct::m_nonzero;
1001 inline bool operator==(StaticFunctionPtr funcptr) {
1002 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1003 inline bool operator!=(StaticFunctionPtr funcptr) {
1004 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1005 inline bool operator ! ()
const {
1006 return !m_Closure; }
1007 inline bool empty()
const {
1008 return !m_Closure; }
1009 void clear() { m_Closure.clear();}
1012 void SetMemento(
const DelegateMemento &any) { m_Closure.CopyFrom(
this, any); }
1015 RetType InvokeStaticFunction(Param1 p1)
const {
1016 return (*(m_Closure.GetStaticFunction()))(p1); }
1020 template<
class Param1,
class Param2,
class RetType=detail::DefaultVo
id>
1023 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1024 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2);
1025 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2);
1026 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2);
1036 m_Closure.CopyFrom(
this, x.m_Closure); }
1038 m_Closure.CopyFrom(
this, x.m_Closure); }
1040 return m_Closure.IsEqual(x.m_Closure); }
1042 return !m_Closure.IsEqual(x.m_Closure); }
1044 return m_Closure.IsLess(x.m_Closure); }
1046 return x.m_Closure.IsLess(m_Closure); }
1048 template <
class X,
class Y >
1049 FastDelegate2(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) ) {
1050 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1051 template <
class X,
class Y >
1052 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2)) {
1053 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1055 template <
class X,
class Y >
1056 FastDelegate2(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2)
const) {
1057 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1058 template <
class X,
class Y >
1059 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2)
const) {
1060 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1063 FastDelegate2(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2) ) {
1064 bind(function_to_bind); }
1066 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2) ) {
1067 bind(function_to_bind); }
1068 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2)) {
1069 m_Closure.bindstaticfunc(
this, &FastDelegate2::InvokeStaticFunction,
1070 function_to_bind); }
1072 RetType operator() (Param1 p1, Param2 p2)
const {
1073 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2); }
1076 typedef struct SafeBoolStruct {
1077 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1078 StaticFunctionPtr m_nonzero;
1080 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1082 operator unspecified_bool_type()
const {
1083 return empty()? 0: &SafeBoolStruct::m_nonzero;
1086 inline bool operator==(StaticFunctionPtr funcptr) {
1087 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1088 inline bool operator!=(StaticFunctionPtr funcptr) {
1089 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1090 inline bool operator ! ()
const {
1091 return !m_Closure; }
1092 inline bool empty()
const {
1093 return !m_Closure; }
1094 void clear() { m_Closure.clear();}
1097 void SetMemento(
const DelegateMemento &any) { m_Closure.CopyFrom(
this, any); }
1100 RetType InvokeStaticFunction(Param1 p1, Param2 p2)
const {
1101 return (*(m_Closure.GetStaticFunction()))(p1, p2); }
1105 template<
class Param1,
class Param2,
class Param3,
class RetType=detail::DefaultVo
id>
1108 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1109 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
1110 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
1111 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3);
1121 m_Closure.CopyFrom(
this, x.m_Closure); }
1123 m_Closure.CopyFrom(
this, x.m_Closure); }
1125 return m_Closure.IsEqual(x.m_Closure); }
1127 return !m_Closure.IsEqual(x.m_Closure); }
1129 return m_Closure.IsLess(x.m_Closure); }
1131 return x.m_Closure.IsLess(m_Closure); }
1133 template <
class X,
class Y >
1134 FastDelegate3(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) {
1135 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1136 template <
class X,
class Y >
1137 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
1138 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1140 template <
class X,
class Y >
1141 FastDelegate3(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3)
const) {
1142 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1143 template <
class X,
class Y >
1144 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3)
const) {
1145 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1148 FastDelegate3(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) {
1149 bind(function_to_bind); }
1151 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) {
1152 bind(function_to_bind); }
1153 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
1154 m_Closure.bindstaticfunc(
this, &FastDelegate3::InvokeStaticFunction,
1155 function_to_bind); }
1157 RetType operator() (Param1 p1, Param2 p2, Param3 p3)
const {
1158 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3); }
1161 typedef struct SafeBoolStruct {
1162 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1163 StaticFunctionPtr m_nonzero;
1165 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1167 operator unspecified_bool_type()
const {
1168 return empty()? 0: &SafeBoolStruct::m_nonzero;
1171 inline bool operator==(StaticFunctionPtr funcptr) {
1172 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1173 inline bool operator!=(StaticFunctionPtr funcptr) {
1174 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1175 inline bool operator ! ()
const {
1176 return !m_Closure; }
1177 inline bool empty()
const {
1178 return !m_Closure; }
1179 void clear() { m_Closure.clear();}
1182 void SetMemento(
const DelegateMemento &any) { m_Closure.CopyFrom(
this, any); }
1185 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3)
const {
1186 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3); }
1190 template<
class Param1,
class Param2,
class Param3,
class Param4,
class RetType=detail::DefaultVo
id>
1193 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1194 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
1195 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
1196 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
1206 m_Closure.CopyFrom(
this, x.m_Closure); }
1208 m_Closure.CopyFrom(
this, x.m_Closure); }
1210 return m_Closure.IsEqual(x.m_Closure); }
1212 return !m_Closure.IsEqual(x.m_Closure); }
1214 return m_Closure.IsLess(x.m_Closure); }
1216 return x.m_Closure.IsLess(m_Closure); }
1218 template <
class X,
class Y >
1219 FastDelegate4(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) {
1220 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1221 template <
class X,
class Y >
1222 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
1223 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1225 template <
class X,
class Y >
1226 FastDelegate4(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)
const) {
1227 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1228 template <
class X,
class Y >
1229 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)
const) {
1230 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1233 FastDelegate4(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) {
1234 bind(function_to_bind); }
1236 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) {
1237 bind(function_to_bind); }
1238 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
1239 m_Closure.bindstaticfunc(
this, &FastDelegate4::InvokeStaticFunction,
1240 function_to_bind); }
1242 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4)
const {
1243 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4); }
1246 typedef struct SafeBoolStruct {
1247 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1248 StaticFunctionPtr m_nonzero;
1250 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1252 operator unspecified_bool_type()
const {
1253 return empty()? 0: &SafeBoolStruct::m_nonzero;
1256 inline bool operator==(StaticFunctionPtr funcptr) {
1257 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1258 inline bool operator!=(StaticFunctionPtr funcptr) {
1259 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1260 inline bool operator ! ()
const {
1261 return !m_Closure; }
1262 inline bool empty()
const {
1263 return !m_Closure; }
1264 void clear() { m_Closure.clear();}
1267 void SetMemento(
const DelegateMemento &any) { m_Closure.CopyFrom(
this, any); }
1270 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4)
const {
1271 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4); }
1275 template<
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class RetType=detail::DefaultVo
id>
1278 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1279 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
1280 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
1281 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
1291 m_Closure.CopyFrom(
this, x.m_Closure); }
1293 m_Closure.CopyFrom(
this, x.m_Closure); }
1295 return m_Closure.IsEqual(x.m_Closure); }
1297 return !m_Closure.IsEqual(x.m_Closure); }
1299 return m_Closure.IsLess(x.m_Closure); }
1301 return x.m_Closure.IsLess(m_Closure); }
1303 template <
class X,
class Y >
1304 FastDelegate5(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) {
1305 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1306 template <
class X,
class Y >
1307 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
1308 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1310 template <
class X,
class Y >
1311 FastDelegate5(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
const) {
1312 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1313 template <
class X,
class Y >
1314 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
const) {
1315 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1318 FastDelegate5(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) {
1319 bind(function_to_bind); }
1321 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) {
1322 bind(function_to_bind); }
1323 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
1324 m_Closure.bindstaticfunc(
this, &FastDelegate5::InvokeStaticFunction,
1325 function_to_bind); }
1327 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
const {
1328 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5); }
1331 typedef struct SafeBoolStruct {
1332 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1333 StaticFunctionPtr m_nonzero;
1335 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1337 operator unspecified_bool_type()
const {
1338 return empty()? 0: &SafeBoolStruct::m_nonzero;
1341 inline bool operator==(StaticFunctionPtr funcptr) {
1342 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1343 inline bool operator!=(StaticFunctionPtr funcptr) {
1344 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1345 inline bool operator ! ()
const {
1346 return !m_Closure; }
1347 inline bool empty()
const {
1348 return !m_Closure; }
1349 void clear() { m_Closure.clear();}
1352 void SetMemento(
const DelegateMemento &any) { m_Closure.CopyFrom(
this, any); }
1355 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
const {
1356 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5); }
1360 template<
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class RetType=detail::DefaultVo
id>
1363 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1364 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
1365 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
1366 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
1376 m_Closure.CopyFrom(
this, x.m_Closure); }
1378 m_Closure.CopyFrom(
this, x.m_Closure); }
1380 return m_Closure.IsEqual(x.m_Closure); }
1382 return !m_Closure.IsEqual(x.m_Closure); }
1384 return m_Closure.IsLess(x.m_Closure); }
1386 return x.m_Closure.IsLess(m_Closure); }
1388 template <
class X,
class Y >
1389 FastDelegate6(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) {
1390 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1391 template <
class X,
class Y >
1392 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
1393 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1395 template <
class X,
class Y >
1396 FastDelegate6(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
const) {
1397 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1398 template <
class X,
class Y >
1399 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
const) {
1400 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1403 FastDelegate6(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) {
1404 bind(function_to_bind); }
1406 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) {
1407 bind(function_to_bind); }
1408 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
1409 m_Closure.bindstaticfunc(
this, &FastDelegate6::InvokeStaticFunction,
1410 function_to_bind); }
1412 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
const {
1413 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6); }
1416 typedef struct SafeBoolStruct {
1417 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1418 StaticFunctionPtr m_nonzero;
1420 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1422 operator unspecified_bool_type()
const {
1423 return empty()? 0: &SafeBoolStruct::m_nonzero;
1426 inline bool operator==(StaticFunctionPtr funcptr) {
1427 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1428 inline bool operator!=(StaticFunctionPtr funcptr) {
1429 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1430 inline bool operator ! ()
const {
1431 return !m_Closure; }
1432 inline bool empty()
const {
1433 return !m_Closure; }
1434 void clear() { m_Closure.clear();}
1437 void SetMemento(
const DelegateMemento &any) { m_Closure.CopyFrom(
this, any); }
1440 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
const {
1441 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6); }
1445 template<
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class RetType=detail::DefaultVo
id>
1448 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1449 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
1450 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
1451 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
1461 m_Closure.CopyFrom(
this, x.m_Closure); }
1463 m_Closure.CopyFrom(
this, x.m_Closure); }
1465 return m_Closure.IsEqual(x.m_Closure); }
1467 return !m_Closure.IsEqual(x.m_Closure); }
1469 return m_Closure.IsLess(x.m_Closure); }
1471 return x.m_Closure.IsLess(m_Closure); }
1473 template <
class X,
class Y >
1474 FastDelegate7(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) {
1475 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1476 template <
class X,
class Y >
1477 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
1478 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1480 template <
class X,
class Y >
1481 FastDelegate7(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)
const) {
1482 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1483 template <
class X,
class Y >
1484 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) {
1485 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1488 FastDelegate7(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) {
1489 bind(function_to_bind); }
1491 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) {
1492 bind(function_to_bind); }
1493 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
1494 m_Closure.bindstaticfunc(
this, &FastDelegate7::InvokeStaticFunction,
1495 function_to_bind); }
1497 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)
const {
1498 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7); }
1501 typedef struct SafeBoolStruct {
1502 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1503 StaticFunctionPtr m_nonzero;
1505 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1507 operator unspecified_bool_type()
const {
1508 return empty()? 0: &SafeBoolStruct::m_nonzero;
1511 inline bool operator==(StaticFunctionPtr funcptr) {
1512 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1513 inline bool operator!=(StaticFunctionPtr funcptr) {
1514 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1515 inline bool operator ! ()
const {
1516 return !m_Closure; }
1517 inline bool empty()
const {
1518 return !m_Closure; }
1519 void clear() { m_Closure.clear();}
1522 void SetMemento(
const DelegateMemento &any) { m_Closure.CopyFrom(
this, any); }
1525 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)
const {
1526 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7); }
1530 template<
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class Param8,
class RetType=detail::DefaultVo
id>
1533 typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
1534 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
1535 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
1536 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
1546 m_Closure.CopyFrom(
this, x.m_Closure); }
1548 m_Closure.CopyFrom(
this, x.m_Closure); }
1550 return m_Closure.IsEqual(x.m_Closure); }
1552 return !m_Closure.IsEqual(x.m_Closure); }
1554 return m_Closure.IsLess(x.m_Closure); }
1556 return x.m_Closure.IsLess(m_Closure); }
1558 template <
class X,
class Y >
1559 FastDelegate8(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) {
1560 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1561 template <
class X,
class Y >
1562 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)) {
1563 m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1565 template <
class X,
class Y >
1566 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) {
1567 m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1568 template <
class X,
class Y >
1569 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) {
1570 m_Closure.bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1573 FastDelegate8(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) {
1574 bind(function_to_bind); }
1576 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) {
1577 bind(function_to_bind); }
1578 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
1579 m_Closure.bindstaticfunc(
this, &FastDelegate8::InvokeStaticFunction,
1580 function_to_bind); }
1582 RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)
const {
1583 return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8); }
1586 typedef struct SafeBoolStruct {
1587 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1588 StaticFunctionPtr m_nonzero;
1590 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1592 operator unspecified_bool_type()
const {
1593 return empty()? 0: &SafeBoolStruct::m_nonzero;
1596 inline bool operator==(StaticFunctionPtr funcptr) {
1597 return m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1598 inline bool operator!=(StaticFunctionPtr funcptr) {
1599 return !m_Closure.IsEqualToStaticFuncPtr(funcptr); }
1600 inline bool operator ! ()
const {
1601 return !m_Closure; }
1602 inline bool empty()
const {
1603 return !m_Closure; }
1604 void clear() { m_Closure.clear();}
1607 void SetMemento(
const DelegateMemento &any) { m_Closure.CopyFrom(
this, any); }
1610 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)
const {
1611 return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8); }
1626 #ifdef FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
1630 template <
typename Signature>
1638 template<
typename R>
1639 class FastDelegate< R ( ) >
1648 typedef FastDelegate SelfType;
1651 FastDelegate() : BaseType() { }
1653 template <
class X,
class Y >
1654 FastDelegate(Y * pthis,
1655 R (X::* function_to_bind)( ))
1656 : BaseType(pthis, function_to_bind) { }
1658 template <
class X,
class Y >
1659 FastDelegate(
const Y *pthis,
1660 R (X::* function_to_bind)( )
const)
1661 : BaseType(pthis, function_to_bind)
1664 FastDelegate(R (*function_to_bind)( ))
1665 : BaseType(function_to_bind) { }
1666 void operator = (
const BaseType &x) {
1667 *
static_cast<BaseType*
>(
this) = x; }
1675 template<
typename R,
class Param1>
1676 class FastDelegate< R ( Param1 ) >
1678 :
public FastDelegate1 < Param1, R >
1682 typedef FastDelegate1 < Param1, R > BaseType;
1685 typedef FastDelegate SelfType;
1688 FastDelegate() : BaseType() { }
1690 template <
class X,
class Y >
1691 FastDelegate(Y * pthis,
1692 R (X::* function_to_bind)( Param1 p1 ))
1693 : BaseType(pthis, function_to_bind) { }
1695 template <
class X,
class Y >
1696 FastDelegate(
const Y *pthis,
1697 R (X::* function_to_bind)( Param1 p1 )
const)
1698 : BaseType(pthis, function_to_bind)
1701 FastDelegate(R (*function_to_bind)( Param1 p1 ))
1702 : BaseType(function_to_bind) { }
1703 void operator = (
const BaseType &x) {
1704 *
static_cast<BaseType*
>(
this) = x; }
1712 template<
typename R,
class Param1,
class Param2>
1713 class FastDelegate< R ( Param1, Param2 ) >
1715 :
public FastDelegate2 < Param1, Param2, R >
1719 typedef FastDelegate2 < Param1, Param2, R > BaseType;
1722 typedef FastDelegate SelfType;
1725 FastDelegate() : BaseType() { }
1727 template <
class X,
class Y >
1728 FastDelegate(Y * pthis,
1729 R (X::* function_to_bind)( Param1 p1, Param2 p2 ))
1730 : BaseType(pthis, function_to_bind) { }
1732 template <
class X,
class Y >
1733 FastDelegate(
const Y *pthis,
1734 R (X::* function_to_bind)( Param1 p1, Param2 p2 )
const)
1735 : BaseType(pthis, function_to_bind)
1738 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2 ))
1739 : BaseType(function_to_bind) { }
1740 void operator = (
const BaseType &x) {
1741 *
static_cast<BaseType*
>(
this) = x; }
1749 template<
typename R,
class Param1,
class Param2,
class Param3>
1750 class FastDelegate< R ( Param1, Param2, Param3 ) >
1752 :
public FastDelegate3 < Param1, Param2, Param3, R >
1756 typedef FastDelegate3 < Param1, Param2, Param3, R > BaseType;
1759 typedef FastDelegate SelfType;
1762 FastDelegate() : BaseType() { }
1764 template <
class X,
class Y >
1765 FastDelegate(Y * pthis,
1766 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ))
1767 : BaseType(pthis, function_to_bind) { }
1769 template <
class X,
class Y >
1770 FastDelegate(
const Y *pthis,
1771 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 )
const)
1772 : BaseType(pthis, function_to_bind)
1775 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ))
1776 : BaseType(function_to_bind) { }
1777 void operator = (
const BaseType &x) {
1778 *
static_cast<BaseType*
>(
this) = x; }
1786 template<
typename R,
class Param1,
class Param2,
class Param3,
class Param4>
1787 class FastDelegate< R ( Param1, Param2, Param3, Param4 ) >
1789 :
public FastDelegate4 < Param1, Param2, Param3, Param4, R >
1793 typedef FastDelegate4 < Param1, Param2, Param3, Param4, R > BaseType;
1796 typedef FastDelegate SelfType;
1799 FastDelegate() : BaseType() { }
1801 template <
class X,
class Y >
1802 FastDelegate(Y * pthis,
1803 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ))
1804 : BaseType(pthis, function_to_bind) { }
1806 template <
class X,
class Y >
1807 FastDelegate(
const Y *pthis,
1808 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 )
const)
1809 : BaseType(pthis, function_to_bind)
1812 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ))
1813 : BaseType(function_to_bind) { }
1814 void operator = (
const BaseType &x) {
1815 *
static_cast<BaseType*
>(
this) = x; }
1823 template<
typename R,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5>
1824 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) >
1826 :
public FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R >
1830 typedef FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R > BaseType;
1833 typedef FastDelegate SelfType;
1836 FastDelegate() : BaseType() { }
1838 template <
class X,
class Y >
1839 FastDelegate(Y * pthis,
1840 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ))
1841 : BaseType(pthis, function_to_bind) { }
1843 template <
class X,
class Y >
1844 FastDelegate(
const Y *pthis,
1845 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 )
const)
1846 : BaseType(pthis, function_to_bind)
1849 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ))
1850 : BaseType(function_to_bind) { }
1851 void operator = (
const BaseType &x) {
1852 *
static_cast<BaseType*
>(
this) = x; }
1860 template<
typename R,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6>
1861 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) >
1863 :
public FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R >
1867 typedef FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R > BaseType;
1870 typedef FastDelegate SelfType;
1873 FastDelegate() : BaseType() { }
1875 template <
class X,
class Y >
1876 FastDelegate(Y * pthis,
1877 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ))
1878 : BaseType(pthis, function_to_bind) { }
1880 template <
class X,
class Y >
1881 FastDelegate(
const Y *pthis,
1882 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 )
const)
1883 : BaseType(pthis, function_to_bind)
1886 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ))
1887 : BaseType(function_to_bind) { }
1888 void operator = (
const BaseType &x) {
1889 *
static_cast<BaseType*
>(
this) = x; }
1897 template<
typename R,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7>
1898 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) >
1900 :
public FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R >
1904 typedef FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R > BaseType;
1907 typedef FastDelegate SelfType;
1910 FastDelegate() : BaseType() { }
1912 template <
class X,
class Y >
1913 FastDelegate(Y * pthis,
1914 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ))
1915 : BaseType(pthis, function_to_bind) { }
1917 template <
class X,
class Y >
1918 FastDelegate(
const Y *pthis,
1919 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 )
const)
1920 : BaseType(pthis, function_to_bind)
1923 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ))
1924 : BaseType(function_to_bind) { }
1925 void operator = (
const BaseType &x) {
1926 *
static_cast<BaseType*
>(
this) = x; }
1934 template<
typename R,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class Param8>
1935 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) >
1937 :
public FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R >
1941 typedef FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R > BaseType;
1944 typedef FastDelegate SelfType;
1947 FastDelegate() : BaseType() { }
1949 template <
class X,
class Y >
1950 FastDelegate(Y * pthis,
1951 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ))
1952 : BaseType(pthis, function_to_bind) { }
1954 template <
class X,
class Y >
1955 FastDelegate(
const Y *pthis,
1956 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 )
const)
1957 : BaseType(pthis, function_to_bind)
1960 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ))
1961 : BaseType(function_to_bind) { }
1962 void operator = (
const BaseType &x) {
1963 *
static_cast<BaseType*
>(
this) = x; }
1967 #endif //FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
1994 #define FASTDLGT_RETTYPE detail::VoidToDefaultVoid<RetType>::type
1996 #define FASTDLGT_RETTYPE RetType
2000 template <
class X,
class Y,
class RetType>
2001 FastDelegate0<FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)()) {
2002 return FastDelegate0<FASTDLGT_RETTYPE>(x, func);
2005 template <
class X,
class Y,
class RetType>
2006 FastDelegate0<FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)()
const) {
2007 return FastDelegate0<FASTDLGT_RETTYPE>(x, func);
2011 template <
class X,
class Y,
class Param1,
class RetType>
2012 FastDelegate1<Param1, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1)) {
2013 return FastDelegate1<Param1, FASTDLGT_RETTYPE>(x, func);
2016 template <
class X,
class Y,
class Param1,
class RetType>
2017 FastDelegate1<Param1, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1)
const) {
2018 return FastDelegate1<Param1, FASTDLGT_RETTYPE>(x, func);
2022 template <
class X,
class Y,
class Param1,
class Param2,
class RetType>
2023 FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2)) {
2024 return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(x, func);
2027 template <
class X,
class Y,
class Param1,
class Param2,
class RetType>
2028 FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2)
const) {
2029 return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(x, func);
2033 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class RetType>
2034 FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3)) {
2035 return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(x, func);
2038 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class RetType>
2039 FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3)
const) {
2040 return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(x, func);
2044 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class RetType>
2045 FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
2046 return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(x, func);
2049 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class RetType>
2050 FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)
const) {
2051 return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(x, func);
2055 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class RetType>
2056 FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
2057 return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(x, func);
2060 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class RetType>
2061 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) {
2062 return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(x, func);
2066 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class RetType>
2067 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)) {
2068 return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(x, func);
2071 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class RetType>
2072 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) {
2073 return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(x, func);
2077 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class RetType>
2078 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)) {
2079 return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(x, func);
2082 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class RetType>
2083 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) {
2084 return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(x, func);
2088 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class Param8,
class RetType>
2089 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)) {
2090 return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(x, func);
2093 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class Param8,
class RetType>
2094 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) {
2095 return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(x, func);
2100 #undef FASTDLGT_RETTYPE
2104 #endif // !defined(FASTDELEGATE_H)
Definition: Fastdelegate.h:286
Definition: Fastdelegate.h:661
Definition: Fastdelegate.h:1531
Definition: Fastdelegate.h:1191
Definition: Fastdelegate.h:231
Definition: Fastdelegate.h:1446
Definition: Fastdelegate.h:1021
Definition: Fastdelegate.h:223
Definition: Fastdelegate.h:1106
Definition: Fastdelegate.h:556
Definition: Fastdelegate.h:936
Definition: Fastdelegate.h:1361
Definition: Fastdelegate.h:851
Definition: Fastdelegate.h:164
Definition: Fastdelegate.h:1276