Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2004-02-27 22:07:10

On 02/27/2004 04:52 PM, Brian McNamara wrote:
>>On Thu, Feb 26, 2004 at 12:04:19PM -0600, Larry Evans wrote:

> If class "C" wants to delegate method "f" to class B, then below is
> code to do it. I used boost::{lambda,function} rather than FC++ in
> the example. The basic idea is to get rid of member functions (a
> recurring motif) in favor of function objects. Annoyingly, you have
> to pass a pointer-to-the-current-object as an extra argument, which
> I can't seem to get rid of right now. (Ideas?)

[code snipped]

I'm having a hard time understanding what the code does except what
amounts to using function pointers (or boost::function objects)
instead of methods. The code is dynamic because the function pointers
can be updated at any time. Am I missing something?

I was wanting something more like section 12.7 of _Design&Evolution of
C++_. At first, I guessed that maybe that's what you were doing, but
then I wondered why C inherits from B instead of C just contains a B*,
as in section 12.7.

Boost list run by bdawes at, gregod at, cpdaniel at, john at