Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2000-11-22 12:09:39


On Tue, 21 Nov 2000 21:19:25 -0800
Jesse Jones <jejones_at_[hidden]> wrote:

> I've uploaded a new version of my callback classes (see the Callbacks2
> directory in the vault). Like Doug Gregor's this version has the nice
> property of not requiring clients to encode the number of arguments in the
> callback class name.

Here are a few questions/comments (beyond what has already been discussed):

1) Why are all of the callback operator() overloads const? I can see reason in offering both a const_callback and a callback class, but I don't see how these operators are always const.

2) The usage of template metaprogramming (mostly SWITCH/CASE) makes me wonder about portability... Has anyone tried to compile this on MSVC++?

3) We have three different sets of semantics for callback copying - explicit reference counting (which your implementation uses), shared_ptr reference counting (which I use), and cloning (Peter Dimov's function_ptr). Cloning is safest (but inefficient), whereas shared_ptr is currently not thread-safe and explicit reference counting could easily be made safe. What is the goal of the Boost callback library regarding thread safety vs. efficiency?

4) Making callback an AdaptableBinaryFunction is a good idea, though it is incorrect because not all callback's will be adaptable binary functions, and the typedefs will be incorrect in those cases (e.g., callback<int, int> will be missing the "argument_type" typedef).

        Doug Gregor


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