Date: 2002-10-02 07:35:56
> -----Original Message-----
> From: Larry Evans [mailto:jcampbell3_at_[hidden]]
> I haven't looked real close, but doesn't the subsection titled
> "Smart Pointers and const" in Item 28 of Scott Meyers
> _More Effective C++_ contain a solution to this problem?
> Basically, it describes SmartPtr<T> derived from
> SmartPtrToConst<T> and SmartPtrToConst<T> containing
> a union of const and non-const pointers to T. Unfortunately,
> this would require changing shared_ptr.
That item is concerned with allowing a conversion of smart_ptr<T> to
smart_ptr<const T>. Scott does this by redefining SmartPtr<const T> to be
SmartPtrToConst<T>. The Standard solves the same problem in auto_ptr by the
use of templated constructors/assignment. Boost solves that problem in
shared_ptr in essentially the same way as the Standard. That problem does
not exist with scoped_ptr, since copy construction/assignment do not exist.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk