Torque 3D 3.7
ClosurePtr Members

The following tables list the members exposed by ClosurePtr.

This is m_pFunction, a member of class DelegateMemento. 
This is m_pStaticFunction, a member of class DelegateMemento. 
arbitrary MFP. 
This is SetMementoFrom, a member of class DelegateMemento. 
For const member functions, we only need a const class pointer. Since we know that the member function is const, it's safe to remove the const qualifier from the 'this' pointer with a const_cast. VC6 has problems if we just overload 'bindmemfunc', so we give it a different name. 
At present, GCC doesn't recognize constness of MFPs in templates 
For static functions, the 'static_function_invoker' class in the parent will be called. The parent then needs to call GetStaticFunction() to find out the actual function to invoke. 
This is clear, a member of class DelegateMemento. 
ClosurePtr<> - Evil version
For compilers where data pointers are at least as big as code pointers, it is possible to store the function pointer in the this pointer, using another horrible_cast. Invocation isn't any faster, but it saves 4 bytes, and speeds up comparison and assignment. If C++ provided direct language support for delegates, they would produce asm code that was almost identical to this. Note that the Sun C++ and MSVC documentation explicitly state that they support static_cast between void * and function pointers. 
This is the overview for the DelegateMemento constructor overload. 
This is empty, a member of class DelegateMemento. 
This is GetClosureMemPtr, a member of class ClosurePtr. 
These functions are required for invoking the stored function 
Evil Method 
Does the closure contain this static function? 
Provide a strict weak ordering for DelegateMementos. 
arbitrary code pointer 
BUGFIX (Mar 2005): We can't just compare m_pFunction because on Metrowerks, m_pFunction can be zero even if the delegate is not empty
This is <, a member of class DelegateMemento. 
This is =, a member of class DelegateMemento. 
This is >, a member of class DelegateMemento. 
Copyright (c) 2015. All rights reserved.
What do you think about this topic? Send feedback!