Torque 3D 3.7
ClosurePtr::CopyFrom Method
template < class DerivedClass > inline void CopyFrom(DerivedClass * pParent, const DelegateMemento & right);

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.

Copyright (c) 2015. All rights reserved.
What do you think about this topic? Send feedback!