Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-09-23 07:27:25


From: "Peter Dimov" <pdimov_at_[hidden]>

> From: "David Abrahams" <dave_at_[hidden]>
> > The smart pointers docs say:
> >
> > The requirement that the copy constructor of D does not throw is too
> > strong. It will be removed when some core language issues are resolved
> > (cv-qualified function types, partial ordering clarifications.)]
> >
> > Can you explain where that requirement comes from?
>
> The requirement comes from the pass by value. If the copy constructor
> throws, the pointer is leaked. Removing the requirement requires a pass
by
> (const) reference. The problems are that (1) pass by value conveniently
> changes functions (function references) to function pointers (this has to
be
> performed manually otherwise and some compilers may not be able to do it)
> and (2) const references don't currently (per the standard) bind to
> functions. This can be solved (I think) but it requires an overload set
that
> breaks on many compilers due to 14.5.5.2 problems (and of course it will
> break on compilers that don't do partial ordering at all.)

Thanks! Could you please stick that text, verbatim, into your [...] section
so that it acts as more than just a "note-to-self"?

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com


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