Boost logo

Boost :

From: Joe Gottman (joegottman_at_[hidden])
Date: 2002-01-15 20:58:33


----- Original Message -----
From: "Gustavo Guerra" <gustavobt_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, January 15, 2002 6:04 PM
Subject: Re: [boost] Loki SmartPtr questions

>
> I had this idea.
>
> Why don't we drop get and release and instead put something like this:
>
> template<T>
> class shared_ptr
> {
> private:
> T* ptr;
> public:
> template<class F>
> void call_legacy_function(F callback)
> {
> callback(ptr);
> }
> };
>
> Of course the callback could still do something bad with the pointer, but
> it's more localized.

    This only works if the function you are calling is of the form
void callback(F *p);

If the function takes several parameters or returns a value that you need
then call_legacy_function will not work.

Joe Gottman


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