|
Boost : |
From: Greg Colvin (greg_at_[hidden])
Date: 2001-01-06 15:07:00
I like this, but who dares propose it to the committee? Not me.
In the meantime, can a similar trick be used to be rid of the
array variants of the boost smart pointers?
----- Original Message -----
From: David Abrahams <abrahams_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, January 06, 2001 11:28 AM
Subject: Re: [boost] Smart pointers and array types
>
> ----- Original Message -----
> From: "Howard Hinnant" <hinnant_at_[hidden]>
>
> > I'm up to requiring this in the primary:
> >
> > private:
> > X* ptr_;
> > template<class Y> auto_ptr(auto_ptr<Y[]>& a) throw();
> > template<class Y> operator auto_ptr<Y[]>() throw();
> > template<class Y> auto_ptr& operator=(auto_ptr<Y[]>&) throw();
> > template<class Y> operator auto_ptr_ref<Y[]>() throw();
> >
> > And at the risk of being too clever, I renamed auto_ptr_array_ref to:
> >
> > template <class Y>
> > struct auto_ptr_ref<Y[]>
> > {
> > Y* ptr_;
> > };
> >
> > And have the specialization refer to auto_ptr_ref<X[]> instead of
> > auto_ptr_ref<X>. I believe it has the same effect.
>
> Looks right to me. I think if you weren't being so clever , the last
> declaration in the primary wouldn't be needed, but the difference between 3
> and 4 is practically 0 ;-)
>
> -Dave
>
>
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk