Boost logo

Boost :

From: William Kempf (sirwillard_at_[hidden])
Date: 2000-11-17 16:57:52


--- In boost_at_[hidden], Jens Maurer <Jens.Maurer_at_g...> wrote:
> William Kempf wrote:
> > 1. Need to allow traditional functor types as the callback so
that
> > function pointers, standard functors, hand coded functors and
Lambda
> > Library style functors can all be used with relative ease.
>
> Any lamda library should be able to deal with all these.

Obviously, but the ones I'm familiar with don't result in objects
that can be stored, reassigned "polymorphically" and later be called,
possibly numerous times. A callback is just an adapter used to
reference a functor. Again, I worded this in this way to insure
completeness, not because the minute details are much to deal with.

> This, I believe, will cut down in code-size for the callback stuff.
> Except that there is the variation in the number of parameters
> which C++ cannot express in a general way.

The implementation, as shown by the numerous libraries that exist and
the code posted here so far, is not difficult or lengthy (beyond the
boilerplate code needed for varying parameters). The difficulty is
in defining the interface. Many existing implementations are either
too simplistic or too far reaching. I'm hoping we can reach a middle
ground that covers everything truly needed. From there the more
complex concepts, such as Signals/Slots, can be built on top.
 
> One implementation issue: If you use a smart-pointer approach for
> your callbacks, please write (or re-use) a generic smart pointer and
> wrap your stuff in it. For example, if you want to use an intrusive
> smart pointer (because you have full control of all classes ever
> controlled by the smart pointer), please define the concept and its
> interface separately.

The code I posted hand coded an intrusive ref counting idiom only
because I wrote it specifically for the Thread library so it needed
to be thread safe. I've since revised boost::shared_ptr to be thread
safe and reimplemented the callback code to use it. At some point in
the future I'll post this revised code to the Files section for the
Win32_threads. Until then the ideas are more important than the
implementation.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk