Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2002-07-09 00:59:33


> It looks to me like boost::function makes this difficult, because it
> encodes the types of the arguments in different template parameters,
> instead of as one parameter like you have done. Perhaps an
> actual independent closure library is appropriate here. It is certainly
> useful in several different contexts. You gonna finish what you started,
> Paul; or are you going to make me struggle with it? ;)
>
> Dave

Well, the mechanism that I sent won't compile without partial specialization.
Of course, the mechanism could be implemented externally, in terms of p->get().

Now that I look at it however, I don't know that using any type-traits
metaprogramming is necessary except on the reference-to-reference problem in the
support for pointers-to-data-members. Otherwise, I think it is a "trust the
programmer" case as far as the argument types are concerned--they are the same
as the pointer-to-member.

One concern however.... should the closure facility disallow normal copying if
it is working in concert with a shared_ptr?

Attached is a sample implementation and a test file. I'm sure it can be
integrated into shared_ptr better than this. :)

Paul Mensonides





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