Publish an efficient practical C delegation
Download address http://upload.programfan.com/upfile/200548160qevent.rar
A simple and efficient C delegate, support the general function, imitation function, and the delegation of the class member function, and declare an arbitrary commission of 0-9 parameters in the same way.
A support compiler and performance support VC6.0 and VC7.1 performance are the same as Boost :: Function library. Use [] (...) to call a single function to delegate performance.
The second declaration is currently supporting 0 to 9 parameters QLIB :: Event
Trifixed function Qlib :: Event
Four function binding supports normal functions, imitation functions, class member functions, the same type entrustment and element EV1.BIND (& Test1); Ev1.bind (Hello ()); Ev1.bind (& H, & Hello :: test1) ; // Compatible form EV1 = & test1; EV1 = Hello (); ev1 qlib :: Event
5 Judgment Binding Functions Number i = Ev1.hasbind (& Test1); i = ev1.hasbind (Hello ()); i = ev1.hasbind (& H, & Hello :: Test1);
Six Function Solutions Ev1.unbind (& Test1); ev1.unbind (Hello ()); Ev1.unbind (& H, & Hello :: Test1); // Compatible Form EV1 - = & test1; ev1 - = hello (); ev1 - = Qlib :: Event
Seven judging whether the equal EV1 == EV2; EV1! = EV2 [0]; // For a single function of the delegation EV1 == & Tes1; EV1 == Hello (); ev1 == Qlib :: Event
Eight removal elements ev1.removesame ();
Nine-auxiliary function parameters number INT i = ev1.Param; whether it is empty BOOL B = ev1.empty (); element number int size = ev1.size (); exchange EV1.SWAP (EV2);
Ten function call form // Direct calls EV1 (10); // single member mode call for (int i = 0; i