Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2000-11-22 17:56:12


From: Kevlin Henney <kevlin_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, November 22, 2000 3:15 PM
Subject: Re: [boost] New New Callbacks Uploaded

> In message <00cd01c054c6$62b4d590$37781990_at_[hidden]>, Greg Colvin
> <gcolvin_at_[hidden]> writes
> >I'm certainly amenable to these improvements to shared_ptr, but are they
> >truly necessary? It seems that for a pointer or a shared_ptr to a
> >function or to a functor that (*f)() is a legitimate way to make a call.
>
> In reflecting the look and feel of a pointer in a smart pointer there
> are a number of decisions that need to be taken. A number of them relate
> to the dereferencing operators available, and in the case of pointers,
> depending on their type, this comes down to *, ->, [], () and ->*.
> Assuming a templated smart pointer, all except [] can be constrained wrt
> usage, ie if a target does not support () expressions that use it will
> simply not compile (ditto for ->, etc).
>
> Although (*f)() is a legitimate way to make a call, this is defined to
> be equivalent to f() (not vice-versa), which we cannot currently write.
> Even more compelling than consistency with the built-ins is the fact
> that generic algorithms expect to write f() and not (*f)().
>
> I think all that suggests that it is truly necessary (for some
> appropriate definition of 'truly' :->), and I for one would certainly
> welcome its addition to current and future smart pointers.

Sold. If we need this for callbacks then let's do it soon.

For that matter, I'm thinking callbacks might be useful to
let a shared_ptr notify others of its object's immanent
demise.


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