C++ delegates
2006-01-09 15:08:00.735072+00 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 21:28:13.127122+00 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 21:52:58.862044+00 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 and Perl don't match (and Java 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 02:06:03.125704+00 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 04:05:47.341847+00 by:
DaveP
I've been seeing good things from a combination of Obj-C++ and Lua around the office, too.