17 template<
class R,
class ...A>
21 using InvokerPtr = R(*)(
void*, A && ...);
30 template <R(*TFunction)(A...)>
33 return{ functionInvoker<TFunction> };
36 template <
class C, R(C::*TMethod)(A...)>
39 return{ pObject, methodInvoker<C, TMethod> };
42 template <
class C, R(C::*TMethod)(A...)>
45 return{ &obj, methodInvoker<C, TMethod> };
48 template <
class C, R(C::*TMethod)(A...)
const>
51 return{
const_cast<C*
>(pObject), constMethodInvoker<C, TMethod> };
54 template <
class C, R(C::*TMethod)(A...)
const>
57 return{
const_cast<C*
>(&obj), constMethodInvoker<C, TMethod> };
63 if (this->is_static())
65 return this->pInvoker == rhs.pInvoker;
68 return (this->pInstance == rhs.pInstance) && (this->pInvoker == rhs.pInvoker);
81 if (this->is_static())
83 return this->pInvoker ==
nullptr;
86 return this->pInstance ==
nullptr || this->pInvoker ==
nullptr;
91 return !(*
this ==
nullptr);
94 explicit operator bool()
const noexcept
96 return *
this !=
nullptr;
100 R operator()(A... args)
const
102 return pInvoker(this->pInstance, std::forward<A>(args)...);
107 : pInstance(
this), pInvoker(invokerPtr)
112 : pInstance(pObject), pInvoker(invokerPtr)
116 bool is_static(
void)
const
118 return this->pInstance ==
this;
122 template <R(*TFunction)(A...)>
123 static R functionInvoker(
void*
const, A&& ... args)
125 return TFunction(std::move(args)...);
128 template <
class C, R(C::*TMethod)(A...)>
129 static R methodInvoker(
void* pObject, A&& ... args)
131 return (
static_cast<C*
>(pObject)->*TMethod)(std::move(args)...);
134 template <
class C, R(C::*TMethod)(A...)
const>
135 static R constMethodInvoker(
void* pObject, A&& ... args)
137 return (
static_cast<const C*
>(pObject)->*TMethod)(std::move(args)...);
Definition: slim_delegate.hxx:12
bool operator!=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string on inequality.
Definition: BasicString.hxx:1912
bool operator==(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string on equality.
Definition: BasicString.hxx:1876
Root namespace for the PLCnext API