48 #ifndef FASTDELEGATE_H
49 #define FASTDELEGATE_H
52 #endif // _MSC_VER > 1000
67 #define FASTDELEGATE_USESTATICFUNCTIONHACK
80 #if defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__VECTOR_C) && !defined(__ICL) && !defined(__BORLANDC__)
81 #define FASTDLGT_ISMSVC
83 #if (_MSC_VER <1300) // Many workarounds are required for VC6.
85 #pragma warning(disable:4786) // disable this ridiculous warning
94 #if defined(_MSC_VER) && !defined(__MWERKS__)
95 #define FASTDLGT_MICROSOFT_MFP
97 #if !defined(__VECTOR_C)
99 #define FASTDLGT_HASINHERITANCE_KEYWORDS
104 #if defined(FASTDLGT_ISMSVC) && (_MSC_VER >=1310) // VC 7.1
105 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
109 #if defined (__DMC__) || defined(__GNUC__) || defined(__ICL) || defined(__COMO__)
110 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
114 #if defined (__MWERKS__)
115 #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
118 #ifdef __GNUC__ // Workaround GCC bug #8271
120 #define FASTDELEGATE_GCC_BUG_8271
151 template <
class OutputClass,
class InputClass>
166 template <
class OutputClass,
class InputClass>
172 template <
class OutputClass,
class InputClass>
178 typedef int ERROR_CantUseHorrible_cast[
sizeof(InputClass)==
sizeof(u)
179 &&
sizeof(InputClass)==
sizeof(OutputClass) ? 1 : -1];
191 #define FASTDELEGATEDECLARE(CLASSNAME) class CLASSNAME;
195 #undef FASTDELEGATE_USESTATICFUNCTIONHACK
254 #ifdef FASTDLGT_MICROSOFT_MFP
256 #ifdef FASTDLGT_HASINHERITANCE_KEYWORDS
260 class __single_inheritance GenericClass;
268 class GenericClass {};
290 template <
class X,
class XFuncType,
class GenericMemFuncType>
291 inline static GenericClass *
Convert(X *pthis, XFuncType function_to_bind,
292 GenericMemFuncType &bound_func) {
295 typedef char ERROR_Unsupported_member_function_pointer_on_this_compiler[N-100];
304 template <
class X,
class XFuncType,
class GenericMemFuncType>
305 inline static GenericClass *
Convert(X *pthis, XFuncType function_to_bind,
306 GenericMemFuncType &bound_func) {
311 bound_func =
horrible_cast<GenericMemFuncType>(function_to_bind);
313 bound_func =
reinterpret_cast<GenericMemFuncType
>(function_to_bind);
315 return reinterpret_cast<GenericClass *
>(pthis);
329 #ifdef FASTDLGT_MICROSOFT_MFP
338 struct SimplifyMemFunc< SINGLE_MEMFUNCPTR_SIZE + sizeof(int) > {
339 template <
class X,
class XFuncType,
class GenericMemFuncType>
340 inline static GenericClass *
Convert(X *pthis, XFuncType function_to_bind,
341 GenericMemFuncType &bound_func) {
347 GenericMemFuncType funcaddress;
352 typedef int ERROR_CantUsehorrible_cast[
sizeof(function_to_bind)==
sizeof(u.s)? 1 : -1];
353 u.func = function_to_bind;
354 bound_func = u.s.funcaddress;
355 return reinterpret_cast<GenericClass *
>(
reinterpret_cast<char *
>(pthis) + u.s.delta);
369 struct MicrosoftVirtualMFP {
370 void (GenericClass::*codeptr)();
383 struct GenericVirtualClass :
virtual public GenericClass
385 typedef GenericVirtualClass * (GenericVirtualClass::*ProbePtrType)();
386 GenericVirtualClass * GetThis() {
return this; }
391 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 2*
sizeof(int) >
394 template <
class X,
class XFuncType,
class GenericMemFuncType>
395 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
396 GenericMemFuncType &bound_func) {
399 GenericClass* (X::*ProbeFunc)();
400 MicrosoftVirtualMFP s;
402 u.func = function_to_bind;
403 bound_func =
reinterpret_cast<GenericMemFuncType
>(u.s.codeptr);
405 GenericVirtualClass::ProbePtrType virtfunc;
406 MicrosoftVirtualMFP s;
409 typedef int ERROR_CantUsehorrible_cast[
sizeof(function_to_bind)==
sizeof(u.s)
410 &&
sizeof(function_to_bind)==
sizeof(u.ProbeFunc)
411 &&
sizeof(u2.virtfunc)==
sizeof(u2.s) ? 1 : -1];
414 u2.virtfunc = &GenericVirtualClass::GetThis;
415 u.s.codeptr = u2.s.codeptr;
416 return (pthis->*u.ProbeFunc)();
426 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*
sizeof(int) >
428 template <
class X,
class XFuncType,
class GenericMemFuncType>
429 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
430 GenericMemFuncType &bound_func) {
455 typedef char ERROR_VC6CompilerBug[-100];
468 struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3*
sizeof(int) >
470 template <
class X,
class XFuncType,
class GenericMemFuncType>
471 inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind,
472 GenericMemFuncType &bound_func) {
480 GenericMemFuncType m_funcaddress;
487 typedef int ERROR_CantUsehorrible_cast[
sizeof(XFuncType)==
sizeof(u.s)? 1 : -1];
488 u.func = function_to_bind;
489 bound_func = u.s.funcaddress;
490 int virtual_delta = 0;
491 if (u.s.vtable_index) {
494 const int * vtable = *
reinterpret_cast<const int *const*
>(
495 reinterpret_cast<const char *
>(pthis) + u.s.vtordisp );
498 virtual_delta = u.s.vtordisp + *
reinterpret_cast<const int *
>(
499 reinterpret_cast<const char *
>(vtable) + u.s.vtable_index);
503 return reinterpret_cast<GenericClass *
>(
504 reinterpret_cast<char *
>(pthis) + u.s.delta + virtual_delta);
507 #endif // MSVC 7 and greater
509 #endif // MS/Intel hacks
567 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
568 typedef void (*GenericFuncPtr)();
569 GenericFuncPtr m_pStaticFunction;
573 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
574 DelegateMemento() : m_pthis(0), m_pFunction(0), m_pStaticFunction(0) {};
576 m_pthis=0; m_pFunction=0; m_pStaticFunction=0;
580 void clear() { m_pthis=0; m_pFunction=0; }
583 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
588 if (m_pStaticFunction!=x.m_pStaticFunction)
return false;
589 if (m_pStaticFunction!=0)
return m_pthis==x.
m_pthis;
600 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
601 if (m_pStaticFunction !=0 || right.m_pStaticFunction!=0)
602 return m_pStaticFunction < right.m_pStaticFunction;
608 return memcmp(&m_pFunction, &right.
m_pFunction,
sizeof(m_pFunction)) < 0;
615 {
return m_pthis==0 && m_pFunction==0; }
617 {
return m_pthis==0 && m_pFunction==0; }
627 return right.
IsLess(*
this);
630 m_pFunction(right.m_pFunction), m_pthis(right.m_pthis)
632 , m_pStaticFunction (right.m_pStaticFunction)
639 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
640 m_pStaticFunction = right.m_pStaticFunction;
663 template <
class GenericMemFunc,
class StaticFuncPtr,
class Un
voidStaticFuncPtr>
671 template <
class X,
class XMemFunc >
674 ::Convert(pthis, function_to_bind, m_pFunction);
675 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
676 m_pStaticFunction = 0;
683 template <
class X,
class XMemFunc>
686 ::Convert(const_cast<X*>(pthis), function_to_bind, m_pFunction);
687 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
688 m_pStaticFunction = 0;
691 #ifdef FASTDELEGATE_GCC_BUG_8271 // At present, GCC doesn't recognize constness of MFPs in templates
692 template <
class X,
class XMemFunc>
693 inline void bindmemfunc(
const X *pthis, XMemFunc function_to_bind) {
695 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
696 m_pStaticFunction = 0;
710 #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
722 template<
class DerivedClass >
725 if (m_pStaticFunction!=0) {
727 m_pthis=
reinterpret_cast<GenericClass *
>(pParent);
733 template <
class DerivedClass,
class ParentInvokerSig >
734 inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker,
735 StaticFuncPtr function_to_bind ) {
736 if (function_to_bind==0) {
741 m_pStaticFunction=
reinterpret_cast<GenericFuncPtr
>(function_to_bind);
744 return reinterpret_cast<UnvoidStaticFuncPtr
>(m_pStaticFunction);
758 template<
class DerivedClass >
766 template <
class DerivedClass,
class ParentInvokerSig>
767 inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker,
768 StaticFuncPtr function_to_bind) {
769 if (function_to_bind==0) {
781 typedef int ERROR_CantUseEvilMethod[
sizeof(GenericClass *)==
sizeof(function_to_bind) ? 1 : -1];
796 typedef int ERROR_CantUseEvilMethod[
sizeof(UnvoidStaticFuncPtr)==
sizeof(
this) ? 1 : -1];
799 #endif // !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
803 if (funcptr==0)
return empty();
853 template<
class RetType=detail::DefaultVo
id>
857 typedef DesiredRetType (*StaticFunctionPtr)();
858 typedef RetType (*UnvoidStaticFunctionPtr)();
859 typedef RetType (detail::GenericClass::*GenericMemFn)();
861 ClosureType m_Closure;
869 m_Closure.
CopyFrom(
this, x.m_Closure); }
871 m_Closure.
CopyFrom(
this, x.m_Closure); }
873 return m_Closure.
IsEqual(x.m_Closure); }
875 return !m_Closure.
IsEqual(x.m_Closure); }
877 return m_Closure.
IsLess(x.m_Closure); }
879 return x.m_Closure.
IsLess(m_Closure); }
881 template <
class X,
class Y >
883 m_Closure.
bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
884 template <
class X,
class Y >
885 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)()) {
886 m_Closure.
bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
888 template <
class X,
class Y >
889 FastDelegate0(
const Y *pthis, DesiredRetType (X::* function_to_bind)()
const) {
890 m_Closure.
bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
891 template <
class X,
class Y >
892 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)()
const) {
893 m_Closure.
bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
897 bind(function_to_bind); }
900 bind(function_to_bind); }
901 inline void bind(DesiredRetType (*function_to_bind)()) {
902 m_Closure.
bindstaticfunc(
this, &FastDelegate0::InvokeStaticFunction,
909 typedef struct SafeBoolStruct {
910 int a_data_pointer_to_this_is_0_on_buggy_compilers;
911 StaticFunctionPtr m_nonzero;
913 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
915 operator unspecified_bool_type()
const {
916 return empty()? 0: &SafeBoolStruct::m_nonzero;
933 RetType InvokeStaticFunction()
const {
938 template<
class Param1,
class RetType=detail::DefaultVo
id>
942 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1);
943 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1);
944 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1);
946 ClosureType m_Closure;
954 m_Closure.
CopyFrom(
this, x.m_Closure); }
956 m_Closure.
CopyFrom(
this, x.m_Closure); }
958 return m_Closure.
IsEqual(x.m_Closure); }
960 return !m_Closure.
IsEqual(x.m_Closure); }
962 return m_Closure.
IsLess(x.m_Closure); }
964 return x.m_Closure.
IsLess(m_Closure); }
966 template <
class X,
class Y >
967 FastDelegate1(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1) ) {
968 m_Closure.
bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
969 template <
class X,
class Y >
970 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1)) {
971 m_Closure.
bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
973 template <
class X,
class Y >
974 FastDelegate1(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1)
const) {
975 m_Closure.
bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
976 template <
class X,
class Y >
977 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1)
const) {
978 m_Closure.
bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
982 bind(function_to_bind); }
984 void operator = (DesiredRetType (*function_to_bind)(Param1 p1) ) {
985 bind(function_to_bind); }
986 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1)) {
987 m_Closure.
bindstaticfunc(
this, &FastDelegate1::InvokeStaticFunction,
994 typedef struct SafeBoolStruct {
995 int a_data_pointer_to_this_is_0_on_buggy_compilers;
996 StaticFunctionPtr m_nonzero;
998 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1000 operator unspecified_bool_type()
const {
1001 return empty()? 0: &SafeBoolStruct::m_nonzero;
1009 return !m_Closure; }
1011 return !m_Closure; }
1018 RetType InvokeStaticFunction(Param1 p1)
const {
1023 template<
class Param1,
class Param2,
class RetType=detail::DefaultVo
id>
1027 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2);
1028 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2);
1029 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2);
1031 ClosureType m_Closure;
1039 m_Closure.
CopyFrom(
this, x.m_Closure); }
1041 m_Closure.
CopyFrom(
this, x.m_Closure); }
1043 return m_Closure.
IsEqual(x.m_Closure); }
1045 return !m_Closure.
IsEqual(x.m_Closure); }
1047 return m_Closure.
IsLess(x.m_Closure); }
1049 return x.m_Closure.
IsLess(m_Closure); }
1051 template <
class X,
class Y >
1052 FastDelegate2(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2) ) {
1053 m_Closure.
bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1054 template <
class X,
class Y >
1055 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2)) {
1056 m_Closure.
bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1058 template <
class X,
class Y >
1059 FastDelegate2(
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); }
1061 template <
class X,
class Y >
1062 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2)
const) {
1063 m_Closure.
bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1067 bind(function_to_bind); }
1069 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2) ) {
1070 bind(function_to_bind); }
1071 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2)) {
1072 m_Closure.
bindstaticfunc(
this, &FastDelegate2::InvokeStaticFunction,
1073 function_to_bind); }
1079 typedef struct SafeBoolStruct {
1080 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1081 StaticFunctionPtr m_nonzero;
1083 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1085 operator unspecified_bool_type()
const {
1086 return empty()? 0: &SafeBoolStruct::m_nonzero;
1094 return !m_Closure; }
1096 return !m_Closure; }
1103 RetType InvokeStaticFunction(Param1 p1, Param2 p2)
const {
1108 template<
class Param1,
class Param2,
class Param3,
class RetType=detail::DefaultVo
id>
1112 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
1113 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
1114 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3);
1116 ClosureType m_Closure;
1124 m_Closure.
CopyFrom(
this, x.m_Closure); }
1126 m_Closure.
CopyFrom(
this, x.m_Closure); }
1128 return m_Closure.
IsEqual(x.m_Closure); }
1130 return !m_Closure.
IsEqual(x.m_Closure); }
1132 return m_Closure.
IsLess(x.m_Closure); }
1134 return x.m_Closure.
IsLess(m_Closure); }
1136 template <
class X,
class Y >
1137 FastDelegate3(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); }
1139 template <
class X,
class Y >
1140 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
1141 m_Closure.
bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1143 template <
class X,
class Y >
1144 FastDelegate3(
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); }
1146 template <
class X,
class Y >
1147 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3)
const) {
1148 m_Closure.
bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1151 FastDelegate3(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) {
1152 bind(function_to_bind); }
1154 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) {
1155 bind(function_to_bind); }
1156 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
1157 m_Closure.
bindstaticfunc(
this, &FastDelegate3::InvokeStaticFunction,
1158 function_to_bind); }
1164 typedef struct SafeBoolStruct {
1165 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1166 StaticFunctionPtr m_nonzero;
1168 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1170 operator unspecified_bool_type()
const {
1171 return empty()? 0: &SafeBoolStruct::m_nonzero;
1179 return !m_Closure; }
1181 return !m_Closure; }
1188 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3)
const {
1193 template<
class Param1,
class Param2,
class Param3,
class Param4,
class RetType=detail::DefaultVo
id>
1197 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
1198 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
1199 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
1201 ClosureType m_Closure;
1209 m_Closure.
CopyFrom(
this, x.m_Closure); }
1211 m_Closure.
CopyFrom(
this, x.m_Closure); }
1213 return m_Closure.
IsEqual(x.m_Closure); }
1215 return !m_Closure.
IsEqual(x.m_Closure); }
1217 return m_Closure.
IsLess(x.m_Closure); }
1219 return x.m_Closure.
IsLess(m_Closure); }
1221 template <
class X,
class Y >
1222 FastDelegate4(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); }
1224 template <
class X,
class Y >
1225 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
1226 m_Closure.
bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1228 template <
class X,
class Y >
1229 FastDelegate4(
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); }
1231 template <
class X,
class Y >
1232 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)
const) {
1233 m_Closure.
bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1236 FastDelegate4(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) {
1237 bind(function_to_bind); }
1239 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) {
1240 bind(function_to_bind); }
1241 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
1242 m_Closure.
bindstaticfunc(
this, &FastDelegate4::InvokeStaticFunction,
1243 function_to_bind); }
1245 RetType
operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4)
const {
1249 typedef struct SafeBoolStruct {
1250 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1251 StaticFunctionPtr m_nonzero;
1253 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1255 operator unspecified_bool_type()
const {
1256 return empty()? 0: &SafeBoolStruct::m_nonzero;
1264 return !m_Closure; }
1266 return !m_Closure; }
1273 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4)
const {
1278 template<
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class RetType=detail::DefaultVo
id>
1282 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
1283 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
1284 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
1286 ClosureType m_Closure;
1294 m_Closure.
CopyFrom(
this, x.m_Closure); }
1296 m_Closure.
CopyFrom(
this, x.m_Closure); }
1298 return m_Closure.
IsEqual(x.m_Closure); }
1300 return !m_Closure.
IsEqual(x.m_Closure); }
1302 return m_Closure.
IsLess(x.m_Closure); }
1304 return x.m_Closure.
IsLess(m_Closure); }
1306 template <
class X,
class Y >
1307 FastDelegate5(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); }
1309 template <
class X,
class Y >
1310 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
1311 m_Closure.
bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1313 template <
class X,
class Y >
1314 FastDelegate5(
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); }
1316 template <
class X,
class Y >
1317 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
const) {
1318 m_Closure.
bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1321 FastDelegate5(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) {
1322 bind(function_to_bind); }
1324 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) {
1325 bind(function_to_bind); }
1326 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
1327 m_Closure.
bindstaticfunc(
this, &FastDelegate5::InvokeStaticFunction,
1328 function_to_bind); }
1330 RetType
operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
const {
1334 typedef struct SafeBoolStruct {
1335 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1336 StaticFunctionPtr m_nonzero;
1338 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1340 operator unspecified_bool_type()
const {
1341 return empty()? 0: &SafeBoolStruct::m_nonzero;
1349 return !m_Closure; }
1351 return !m_Closure; }
1358 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)
const {
1363 template<
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class RetType=detail::DefaultVo
id>
1367 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
1368 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
1369 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
1371 ClosureType m_Closure;
1379 m_Closure.
CopyFrom(
this, x.m_Closure); }
1381 m_Closure.
CopyFrom(
this, x.m_Closure); }
1383 return m_Closure.
IsEqual(x.m_Closure); }
1385 return !m_Closure.
IsEqual(x.m_Closure); }
1387 return m_Closure.
IsLess(x.m_Closure); }
1389 return x.m_Closure.
IsLess(m_Closure); }
1391 template <
class X,
class Y >
1392 FastDelegate6(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); }
1394 template <
class X,
class Y >
1395 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
1396 m_Closure.
bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1398 template <
class X,
class Y >
1399 FastDelegate6(
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); }
1401 template <
class X,
class Y >
1402 inline void bind(
const Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
const) {
1403 m_Closure.
bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1406 FastDelegate6(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) {
1407 bind(function_to_bind); }
1409 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) {
1410 bind(function_to_bind); }
1411 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
1412 m_Closure.
bindstaticfunc(
this, &FastDelegate6::InvokeStaticFunction,
1413 function_to_bind); }
1415 RetType
operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
const {
1419 typedef struct SafeBoolStruct {
1420 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1421 StaticFunctionPtr m_nonzero;
1423 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1425 operator unspecified_bool_type()
const {
1426 return empty()? 0: &SafeBoolStruct::m_nonzero;
1434 return !m_Closure; }
1436 return !m_Closure; }
1443 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)
const {
1448 template<
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class RetType=detail::DefaultVo
id>
1452 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
1453 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
1454 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
1456 ClosureType m_Closure;
1464 m_Closure.
CopyFrom(
this, x.m_Closure); }
1466 m_Closure.
CopyFrom(
this, x.m_Closure); }
1468 return m_Closure.
IsEqual(x.m_Closure); }
1470 return !m_Closure.
IsEqual(x.m_Closure); }
1472 return m_Closure.
IsLess(x.m_Closure); }
1474 return x.m_Closure.
IsLess(m_Closure); }
1476 template <
class X,
class Y >
1477 FastDelegate7(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); }
1479 template <
class X,
class Y >
1480 inline void bind(Y *pthis, DesiredRetType (X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
1481 m_Closure.
bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1483 template <
class X,
class Y >
1484 FastDelegate7(
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); }
1486 template <
class X,
class Y >
1487 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) {
1488 m_Closure.
bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1491 FastDelegate7(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) {
1492 bind(function_to_bind); }
1494 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) {
1495 bind(function_to_bind); }
1496 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
1497 m_Closure.
bindstaticfunc(
this, &FastDelegate7::InvokeStaticFunction,
1498 function_to_bind); }
1500 RetType
operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)
const {
1504 typedef struct SafeBoolStruct {
1505 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1506 StaticFunctionPtr m_nonzero;
1508 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1510 operator unspecified_bool_type()
const {
1511 return empty()? 0: &SafeBoolStruct::m_nonzero;
1519 return !m_Closure; }
1521 return !m_Closure; }
1528 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)
const {
1533 template<
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class Param8,
class RetType=detail::DefaultVo
id>
1537 typedef DesiredRetType (*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
1538 typedef RetType (*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
1539 typedef RetType (detail::GenericClass::*GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
1541 ClosureType m_Closure;
1549 m_Closure.
CopyFrom(
this, x.m_Closure); }
1551 m_Closure.
CopyFrom(
this, x.m_Closure); }
1553 return m_Closure.
IsEqual(x.m_Closure); }
1555 return !m_Closure.
IsEqual(x.m_Closure); }
1557 return m_Closure.
IsLess(x.m_Closure); }
1559 return x.m_Closure.
IsLess(m_Closure); }
1561 template <
class X,
class Y >
1562 FastDelegate8(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); }
1564 template <
class X,
class Y >
1565 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)) {
1566 m_Closure.
bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind); }
1568 template <
class X,
class Y >
1569 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) {
1570 m_Closure.
bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind); }
1571 template <
class X,
class Y >
1572 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) {
1573 m_Closure.
bindconstmemfunc(detail::implicit_cast<const X *>(pthis), function_to_bind); }
1576 FastDelegate8(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); }
1579 void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) {
1580 bind(function_to_bind); }
1581 inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
1582 m_Closure.
bindstaticfunc(
this, &FastDelegate8::InvokeStaticFunction,
1583 function_to_bind); }
1585 RetType
operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)
const {
1589 typedef struct SafeBoolStruct {
1590 int a_data_pointer_to_this_is_0_on_buggy_compilers;
1591 StaticFunctionPtr m_nonzero;
1593 typedef StaticFunctionPtr SafeBoolStruct::*unspecified_bool_type;
1595 operator unspecified_bool_type()
const {
1596 return empty()? 0: &SafeBoolStruct::m_nonzero;
1604 return !m_Closure; }
1606 return !m_Closure; }
1613 RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)
const {
1629 #ifdef FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
1633 template <
typename Signature>
1641 template<
typename R>
1642 class FastDelegate< R ( ) >
1644 :
public FastDelegate0 < R >
1648 typedef FastDelegate0 < R > BaseType;
1651 typedef FastDelegate SelfType;
1654 FastDelegate() : BaseType() { }
1656 template <
class X,
class Y >
1657 FastDelegate(Y * pthis,
1658 R (X::* function_to_bind)( ))
1659 : BaseType(pthis, function_to_bind) { }
1661 template <
class X,
class Y >
1662 FastDelegate(
const Y *pthis,
1663 R (X::* function_to_bind)( )
const)
1664 : BaseType(pthis, function_to_bind)
1667 FastDelegate(R (*function_to_bind)( ))
1668 : BaseType(function_to_bind) { }
1669 void operator = (
const BaseType &x) {
1670 *
static_cast<BaseType*
>(
this) = x; }
1678 template<
typename R,
class Param1>
1679 class FastDelegate< R ( Param1 ) >
1681 :
public FastDelegate1 < Param1, R >
1685 typedef FastDelegate1 < Param1, R > BaseType;
1688 typedef FastDelegate SelfType;
1691 FastDelegate() : BaseType() { }
1693 template <
class X,
class Y >
1694 FastDelegate(Y * pthis,
1695 R (X::* function_to_bind)( Param1 p1 ))
1696 : BaseType(pthis, function_to_bind) { }
1698 template <
class X,
class Y >
1699 FastDelegate(
const Y *pthis,
1700 R (X::* function_to_bind)( Param1 p1 )
const)
1701 : BaseType(pthis, function_to_bind)
1704 FastDelegate(R (*function_to_bind)( Param1 p1 ))
1705 : BaseType(function_to_bind) { }
1706 void operator = (
const BaseType &x) {
1707 *
static_cast<BaseType*
>(
this) = x; }
1715 template<
typename R,
class Param1,
class Param2>
1716 class FastDelegate< R ( Param1, Param2 ) >
1718 :
public FastDelegate2 < Param1, Param2, R >
1722 typedef FastDelegate2 < Param1, Param2, R > BaseType;
1725 typedef FastDelegate SelfType;
1728 FastDelegate() : BaseType() { }
1730 template <
class X,
class Y >
1731 FastDelegate(Y * pthis,
1732 R (X::* function_to_bind)( Param1 p1, Param2 p2 ))
1733 : BaseType(pthis, function_to_bind) { }
1735 template <
class X,
class Y >
1736 FastDelegate(
const Y *pthis,
1737 R (X::* function_to_bind)( Param1 p1, Param2 p2 )
const)
1738 : BaseType(pthis, function_to_bind)
1741 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2 ))
1742 : BaseType(function_to_bind) { }
1743 void operator = (
const BaseType &x) {
1744 *
static_cast<BaseType*
>(
this) = x; }
1752 template<
typename R,
class Param1,
class Param2,
class Param3>
1753 class FastDelegate< R ( Param1, Param2, Param3 ) >
1755 :
public FastDelegate3 < Param1, Param2, Param3, R >
1759 typedef FastDelegate3 < Param1, Param2, Param3, R > BaseType;
1762 typedef FastDelegate SelfType;
1765 FastDelegate() : BaseType() { }
1767 template <
class X,
class Y >
1768 FastDelegate(Y * pthis,
1769 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ))
1770 : BaseType(pthis, function_to_bind) { }
1772 template <
class X,
class Y >
1773 FastDelegate(
const Y *pthis,
1774 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 )
const)
1775 : BaseType(pthis, function_to_bind)
1778 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3 ))
1779 : BaseType(function_to_bind) { }
1780 void operator = (
const BaseType &x) {
1781 *
static_cast<BaseType*
>(
this) = x; }
1789 template<
typename R,
class Param1,
class Param2,
class Param3,
class Param4>
1790 class FastDelegate< R ( Param1, Param2, Param3, Param4 ) >
1792 :
public FastDelegate4 < Param1, Param2, Param3, Param4, R >
1796 typedef FastDelegate4 < Param1, Param2, Param3, Param4, R > BaseType;
1799 typedef FastDelegate SelfType;
1802 FastDelegate() : BaseType() { }
1804 template <
class X,
class Y >
1805 FastDelegate(Y * pthis,
1806 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ))
1807 : BaseType(pthis, function_to_bind) { }
1809 template <
class X,
class Y >
1810 FastDelegate(
const Y *pthis,
1811 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 )
const)
1812 : BaseType(pthis, function_to_bind)
1815 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ))
1816 : BaseType(function_to_bind) { }
1817 void operator = (
const BaseType &x) {
1818 *
static_cast<BaseType*
>(
this) = x; }
1826 template<
typename R,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5>
1827 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) >
1829 :
public FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R >
1833 typedef FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R > BaseType;
1836 typedef FastDelegate SelfType;
1839 FastDelegate() : BaseType() { }
1841 template <
class X,
class Y >
1842 FastDelegate(Y * pthis,
1843 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ))
1844 : BaseType(pthis, function_to_bind) { }
1846 template <
class X,
class Y >
1847 FastDelegate(
const Y *pthis,
1848 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 )
const)
1849 : BaseType(pthis, function_to_bind)
1852 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ))
1853 : BaseType(function_to_bind) { }
1854 void operator = (
const BaseType &x) {
1855 *
static_cast<BaseType*
>(
this) = x; }
1863 template<
typename R,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6>
1864 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) >
1866 :
public FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R >
1870 typedef FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R > BaseType;
1873 typedef FastDelegate SelfType;
1876 FastDelegate() : BaseType() { }
1878 template <
class X,
class Y >
1879 FastDelegate(Y * pthis,
1880 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ))
1881 : BaseType(pthis, function_to_bind) { }
1883 template <
class X,
class Y >
1884 FastDelegate(
const Y *pthis,
1885 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 )
const)
1886 : BaseType(pthis, function_to_bind)
1889 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ))
1890 : BaseType(function_to_bind) { }
1891 void operator = (
const BaseType &x) {
1892 *
static_cast<BaseType*
>(
this) = x; }
1900 template<
typename R,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7>
1901 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) >
1903 :
public FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R >
1907 typedef FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R > BaseType;
1910 typedef FastDelegate SelfType;
1913 FastDelegate() : BaseType() { }
1915 template <
class X,
class Y >
1916 FastDelegate(Y * pthis,
1917 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ))
1918 : BaseType(pthis, function_to_bind) { }
1920 template <
class X,
class Y >
1921 FastDelegate(
const Y *pthis,
1922 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 )
const)
1923 : BaseType(pthis, function_to_bind)
1926 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ))
1927 : BaseType(function_to_bind) { }
1928 void operator = (
const BaseType &x) {
1929 *
static_cast<BaseType*
>(
this) = x; }
1937 template<
typename R,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class Param8>
1938 class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) >
1940 :
public FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R >
1944 typedef FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R > BaseType;
1947 typedef FastDelegate SelfType;
1950 FastDelegate() : BaseType() { }
1952 template <
class X,
class Y >
1953 FastDelegate(Y * pthis,
1954 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ))
1955 : BaseType(pthis, function_to_bind) { }
1957 template <
class X,
class Y >
1958 FastDelegate(
const Y *pthis,
1959 R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 )
const)
1960 : BaseType(pthis, function_to_bind)
1963 FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ))
1964 : BaseType(function_to_bind) { }
1965 void operator = (
const BaseType &x) {
1966 *
static_cast<BaseType*
>(
this) = x; }
1970 #endif //FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
1997 #define FASTDLGT_RETTYPE detail::VoidToDefaultVoid<RetType>::type
1999 #define FASTDLGT_RETTYPE RetType
2003 template <
class X,
class Y,
class RetType>
2008 template <
class X,
class Y,
class RetType>
2009 FastDelegate0<FASTDLGT_RETTYPE>
MakeDelegate(Y* x, RetType (X::*func)()
const) {
2010 return FastDelegate0<FASTDLGT_RETTYPE>(x, func);
2014 template <
class X,
class Y,
class Param1,
class RetType>
2019 template <
class X,
class Y,
class Param1,
class RetType>
2020 FastDelegate1<Param1, FASTDLGT_RETTYPE>
MakeDelegate(Y* x, RetType (X::*func)(Param1 p1)
const) {
2021 return FastDelegate1<Param1, FASTDLGT_RETTYPE>(x, func);
2025 template <
class X,
class Y,
class Param1,
class Param2,
class RetType>
2030 template <
class X,
class Y,
class Param1,
class Param2,
class RetType>
2031 FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>
MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2)
const) {
2032 return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(x, func);
2036 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class RetType>
2041 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class RetType>
2042 FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>
MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3)
const) {
2043 return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(x, func);
2047 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class RetType>
2052 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class RetType>
2053 FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>
MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)
const) {
2054 return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(x, func);
2058 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class RetType>
2059 FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
2063 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class RetType>
2064 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) {
2065 return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(x, func);
2069 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class RetType>
2070 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)) {
2074 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class RetType>
2075 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) {
2076 return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(x, func);
2080 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class RetType>
2081 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)) {
2085 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class RetType>
2086 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) {
2087 return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(x, func);
2091 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class Param8,
class RetType>
2092 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)) {
2096 template <
class X,
class Y,
class Param1,
class Param2,
class Param3,
class Param4,
class Param5,
class Param6,
class Param7,
class Param8,
class RetType>
2097 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) {
2098 return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(x, func);
2103 #undef FASTDLGT_RETTYPE
2107 #endif // !defined(FASTDELEGATE_H)
bool operator>(const FastDelegate0 &x) const
void bind(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5))
void SetMemento(const DelegateMemento &any)
void SetMemento(const DelegateMemento &any)
RetType operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const
RetType operator()(Param1 p1, Param2 p2) const
void SetMementoFrom(const DelegateMemento &right)
void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker, StaticFuncPtr function_to_bind)
bool operator!=(StaticFunctionPtr funcptr)
FastDelegate7(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7))
void bind(const Y *pthis, DesiredRetType(X::*function_to_bind)() const)
bool operator==(const FastDelegate8 &x) const
bool operator>(const FastDelegate5 &x) const
bool operator==(const FastDelegate2 &x) const
bool operator!=(StaticFunctionPtr funcptr)
void operator=(const FastDelegate4 &x)
bool operator==(StaticFunctionPtr funcptr)
FastDelegate4(const FastDelegate4 &x)
const DelegateMemento & GetMemento()
void SetMemento(const DelegateMemento &any)
void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5))
bool operator>(const FastDelegate4 &x) const
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)
FastDelegate3(const FastDelegate3 &x)
bool operator<(const FastDelegate2 &x) const
void bind(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6))
void SetMemento(const DelegateMemento &any)
void bind(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1))
bool operator>(const FastDelegate1 &x) const
bool operator>(const FastDelegate6 &x) const
OutputClass implicit_cast(InputClass input)
bool operator<(const FastDelegate6 &x) const
bool operator==(StaticFunctionPtr funcptr)
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))
void bind(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2))
bool operator!=(StaticFunctionPtr funcptr)
const DelegateMemento & GetMemento()
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)
bool operator<(const FastDelegate0 &x) const
void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6))
void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4))
bool IsEqual(const DelegateMemento &x) const
FastDelegate1(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1) const)
bool operator>(const FastDelegate7 &x) const
bool operator!=(const FastDelegate4 &x) const
bool operator==(const FastDelegate6 &x) const
const DelegateMemento & GetMemento()
FastDelegate6(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6))
bool operator<(const FastDelegate3 &x) const
void bind(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const)
bool operator!=(const FastDelegate3 &x) const
GenericMemFunc GetClosureMemPtr() const
FastDelegate3(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3))
FastDelegate8(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8))
const DelegateMemento & GetMemento()
void operator=(const FastDelegate0 &x)
bool operator==(const FastDelegate5 &x) const
FastDelegate6(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const)
void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8))
void bind(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const)
FastDelegate0(const Y *pthis, DesiredRetType(X::*function_to_bind)() const)
bool operator==(StaticFunctionPtr funcptr)
void bind(Y *pthis, DesiredRetType(X::*function_to_bind)())
void operator=(const FastDelegate3 &x)
FastDelegate2(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2))
bool operator!=(const FastDelegate1 &x) const
void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2))
FastDelegate5(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const)
bool operator!=(StaticFunctionPtr funcptr)
detail::GenericClass * m_pthis
void operator=(const FastDelegate1 &x)
FastDelegate0< FASTDLGT_RETTYPE > MakeDelegate(Y *x, RetType(X::*func)())
static GenericClass * Convert(X *pthis, XFuncType function_to_bind, GenericMemFuncType &bound_func)
const DelegateMemento & GetMemento()
bool operator==(StaticFunctionPtr funcptr)
RetType operator()(Param1 p1) const
OutputClass horrible_cast(const InputClass input)
bool operator==(const FastDelegate7 &x) const
bool operator!=(const FastDelegate7 &x) const
FastDelegate8(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8))
bool IsEqualToStaticFuncPtr(StaticFuncPtr funcptr)
void CopyFrom(DerivedClass *pParent, const DelegateMemento &right)
void operator=(const FastDelegate6 &x)
void SetMemento(const DelegateMemento &any)
const DelegateMemento & GetMemento()
void bind(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4))
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)
bool operator!=(const FastDelegate5 &x) const
bool operator==(StaticFunctionPtr funcptr)
void operator=(const FastDelegate5 &x)
void bindmemfunc(X *pthis, XMemFunc function_to_bind)
FastDelegate0(DesiredRetType(*function_to_bind)())
bool operator!=(StaticFunctionPtr funcptr)
FastDelegate6(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6))
const DelegateMemento & GetMemento()
bool operator>(const DelegateMemento &right)
bool operator!=(const FastDelegate2 &x) const
void bind(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1) const)
void SetMemento(const DelegateMemento &any)
bool operator<(const DelegateMemento &right)
void bind(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const)
void bind(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3))
void operator=(const FastDelegate2 &x)
void operator=(const FastDelegate7 &x)
void operator=(const FastDelegate8 &x)
FastDelegate7(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7))
FastDelegate1(const FastDelegate1 &x)
bool operator==(StaticFunctionPtr funcptr)
void bind(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2) const)
FastDelegate7(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const)
void bind(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7))
bool operator==(StaticFunctionPtr funcptr)
bool IsLess(const DelegateMemento &right) const
bool operator==(const FastDelegate3 &x) const
void bind(DesiredRetType(*function_to_bind)(Param1 p1))
FastDelegate3(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const)
RetType operator()(Param1 p1, Param2 p2, Param3 p3) const
void SetMemento(const DelegateMemento &any)
bool operator<(const FastDelegate5 &x) const
void SetMemento(const DelegateMemento &any)
FastDelegate8(const FastDelegate8 &x)
FastDelegate7(const FastDelegate7 &x)
UnvoidStaticFuncPtr GetStaticFunction() const
DelegateMemento(const DelegateMemento &right)
bool operator==(StaticFunctionPtr funcptr)
FastDelegate0(Y *pthis, DesiredRetType(X::*function_to_bind)())
void(detail::GenericClass::* GenericMemFuncType)()
DelegateMemento & operator=(const DelegateMemento &right)
bool operator==(StaticFunctionPtr funcptr)
bool operator>(const FastDelegate2 &x) const
bool operator==(const FastDelegate0 &x) const
GenericMemFuncType m_pFunction
#define FASTDELEGATE_USESTATICFUNCTIONHACK
const DelegateMemento & GetMemento()
FastDelegate4(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const)
bool operator!=(StaticFunctionPtr funcptr)
RetType operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const
FastDelegate5(const FastDelegate5 &x)
const int SINGLE_MEMFUNCPTR_SIZE
bool operator<(const FastDelegate1 &x) const
FastDelegate3(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3))
bool operator==(const FastDelegate4 &x) const
FastDelegate2(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2))
GenericClass * GetClosureThis() const
static GenericClass * Convert(X *pthis, XFuncType function_to_bind, GenericMemFuncType &bound_func)
bool operator!=(StaticFunctionPtr funcptr)
FastDelegate4(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4))
void bind(DesiredRetType(*function_to_bind)())
bool operator<(const FastDelegate7 &x) const
bool operator==(const FastDelegate1 &x) const
bool operator!=(const FastDelegate8 &x) const
void SetMemento(const DelegateMemento &any)
void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3))
void bind(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const)
FastDelegate1(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1))
RetType operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const
RetType operator()() const
FastDelegate4(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4))
FastDelegate5(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5))
RetType operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const
FastDelegate2(const Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2) const)
bool operator!=(StaticFunctionPtr funcptr)
bool operator!=(const FastDelegate6 &x) const
bool operator!=(StaticFunctionPtr funcptr)
const DelegateMemento & GetMemento()
FastDelegate6(const FastDelegate6 &x)
bool operator<(const FastDelegate4 &x) const
RetType operator()(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const
FastDelegate5(Y *pthis, DesiredRetType(X::*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5))
FastDelegate0(const FastDelegate0 &x)
bool operator>(const FastDelegate3 &x) const
FastDelegate1(DesiredRetType(*function_to_bind)(Param1 p1))
void bindconstmemfunc(const X *pthis, XMemFunc function_to_bind)
bool operator!=(const FastDelegate0 &x) const
bool operator>(const FastDelegate8 &x) const
bool operator<(const FastDelegate8 &x) const
FastDelegate2(const FastDelegate2 &x)
void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7))