Boost logo

Boost Users :

Subject: Re: [Boost-users] shared_ptr custom deleter implementation
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-18 00:32:07


AMDG

Zachary Turner wrote:
> My problem is how to store / access the fetch function in a type safe
> way. The reason I titled this message how I did is because I see that
> shared_ptr does almost exactly the same thing with its deleter. But
> I'm still kind of new to the whole metaprogramming thing and having a
> little difficulty really getting my head around how it works. I guess
> there is some general "pattern" that applies in both of these cases as
> well as any other case where you want to store some value, the type of
> which is deduced by the constructor, and then later accessing that
> value in a type safe way. This message could probably have been
> equally well fitting in a general C++ forum, but since this is a
> problem that seems to arise really frequently in boost and other code
> using heavy templates, I guess I'm in pretty good company here as well.
>
> <snip>
>
> Can anyone offer some guidance here? Maybe a quick high level
> overview of how shared_ptr and other boost libraries solve this
> problem, or even an implementation of lazy that works :P

Just use Boost.Function.
www.boost.org/libs/function

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net