From SourceForge and codeproject
The Running Method of sigslot is easy to understand. It is to save the object pointer and function pointer to the connection table, and then obtain and execute it when calling it.
Fastdelegate was confused by reading his documents. After reading the documents, he didn't figure out why the author said it was so fast and fast, but the memory consumption actually reduced.
Because he performs complex operations on the this pointer of all the virtual functions and multi-inheritance functions to obtain the actual address, it takes only 8 bytes for his bind at a time.
However, in addition to the memory, it is not found to be faster than sigslot.
Http://sigslot.sourceforge.net/
Http://www.codeproject.com/KB/cpp/FastDelegate.aspx
It is really a headache to use more templates, and debugging will be very tiring.
FastdelegateAlgorithmThe exception is complicated. He encapsulates common functions and static functions into a class through a horrible_cast, which makes him dizzy.
I have done a lot of work in pursuit of such memory.
Forced type conversion can be performed based on different types of function pointers. The begin_message_map method of MFC also adopts this method. With this kill tool, fastdelegate can be implemented.
Float test3 (int n, char * P)
{
Return N;
}
Typedef float (* myfuncptr) (INT, char *);
Myfuncptr my_func_ptr = & test3;
Float n = my_func_ptr (1, 0 );
Typedef float (* myfuncptr2) (INT );
Myfuncptr2 PTS = (myfuncptr2) my_func_ptr;
N = PTS (21 );