Boost logo

Boost :

From: Schoenborn, Oliver (Oliver.Schoenborn_at_[hidden])
Date: 2002-10-04 08:00:20


> -----Original Message-----
> From: Larry Evans [mailto:jcampbell3_at_[hidden]]
> Sent: Thursday, October 03, 2002 6:49 PM
> To: Boost mailing list
> Subject: Re: [boost] Re: [smart_ptr] const-correctness as function
> argument
>
>
> David B. Held wrote:
> [snip]
>
> >template <typename T>
> >class ptr;
> >
> >template <typename T>
> >class ptr<T const>
> >{
> >public:
> > ptr() { }
> > T const* operator->() const { return p_; }
> >private:
> > ptr(ptr const&);
> > T* p_;
> >};
> >
> >template <typename T>
> >class ptr : public ptr<T const>
> >{
> >
> >
> [snip]
>
> >and thereby modify p. However, this is true in general, and
> I don't think
> >it presents a significant risk. This is an interesting
> idiom, and I would
> >like to hear other people's comments on it. Not worth the
> complexity?
> >Hidden problems/risks?
> >
> >
> >
> I think its close to perfect if not perfect! This is better than
> Meyer's solution. Maybe Meyers didn't have
> a compiler that could specialize on `const T` and `T`.

Yes, but not quite, but please take a look at my comments in other post.
Oliver
 


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