Flutterby™! : C++ delegates

Next unread comment / Catchup all unread comments User Account Info | Logout | XML/Pilot/etc versions | Long version (with comments) | Weblog archives | Site Map | | Browse Topics

C++ delegates

2006-01-09 16:08:00.735072+01 by Dan Lyke 4 comments

C++ trick of the day: The Impossibly Fast C++ Delegates By Sergey Ryazanov. Summary: Use templates to create a static function which does a static_cast on a void * and then dispatches a method on it, and pass around the void * and a pointer to this function. Gives a pointer to a member function that does all the right things, including dispatching virtually, and even from a pure virtual.

[ related topics: Software Engineering Cool Technology ]

comments in ascending chronological order (reverse):

#Comment Re: made: 2006-01-12 22:28:13.127122+01 by: baylink

"If a programmer can simulate a construct faster than the compiler can implement it, then the compiler writer has blown it *badly*."

Guy L Steele, I think.

#Comment Re: made: 2006-01-12 22:52:58.862044+01 by: Dan Lyke

Yeah, the problem with C++ is that it sucks slightly less than all of the other solutions. And it's not really a language, it's a language construction kit.

But it gives you so much more than C, and has performance that Python[Wiki] and Perl[Wiki] don't match (and Java[Wiki] and C# aren't in the running, so don't even bother mentioning them), that... well... sometimes you gotta dance with the devil.

#Comment Re: [Entry #8533] Re: made: 2006-01-13 03:06:03.125704+01 by: Unknown, from NNTP

FWIW, the Feb issue of Linux Journal had a nice article about embedding the Python interpreter in a C/C++ program, and how you go about actually using it once it's embedded.

#Comment Re: made: 2006-01-13 05:05:47.341847+01 by: DaveP

I've been seeing good things from a combination of Obj-C++ and Lua around the office, too.

Comment policy

We will not edit your comments. However, we may delete your comments, or cause them to be hidden behind another link, if we feel they detract from the conversation. Commercial plugs are fine, if they are relevant to the conversation, and if you don't try to pretend to be a consumer. Annoying endorsements will be deleted if you're lucky, if you're not a whole bunch of people smarter and more articulate than you will ridicule you, and we will leave such ridicule in place.


Flutterby™ is a trademark claimed by

Dan Lyke
for the web publications at www.flutterby.com and www.flutterby.net.