I recently reached the point in a framework’s development where I required a solution for delegates. I could have turned to Don Clugston’s delegates on codeproject.com but I paused for thought. You see – while I do subscribe to the mentality of more typing for the sake of clarity, I must confess that I find C++’s template syntax unwieldy and wordy.
The thought I had was this; can you have a delegates solution in C++ that does not require any template syntax to use?
// Example delegate using "void MyObj::Method(int, int)" Delegate delegate = createDelegate(&myObj, &MyObj::Method); delegate(1, 2);
Well, you can. What follows is an explanation and some source code of how so.












