|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-01-23 15:13:17
"Howard Hinnant" <hinnant_at_[hidden]> wrote in message
news:C7A97BAE-4DB5-11D8-9184-003065D18932_at_twcny.rr.com...
> On Jan 22, 2004, at 11:09 PM, Jonathan Turkanis wrote:
>
> > Here are some test cases. The ones marked error are cases I
believe
> > should not compile.
> >
> > struct Base { virtual ~Base() { } };
> > struct Derived : Base { };
> >
> > inline void const_sink(const move_ptr<Base> p)
> > {
> > /*[1]*/ move_ptr<Base> p2 = p; // ???
> > }
> >
> > VC7.1, GCC 3.2 and como 4.3.3 reject 1, while Codewarrior accepts
it.
> > I think it should fail to compile. Correct? It seems to be the
only
> > case where the cant_move_from_const makes any difference.
>
> I agree that [1] should not compile. You don't want to move from an
> lvalue with copy syntax, especially a const lvalue.
>
Thank.
By the way, your comments on the difference between smart pointers to
objects and smart pointers to arrays were very helpful. I find the
notation smart_ptr< T[] > very appealing, and disabling
base-to-derived conversions seemes appropriate and easy to implement.
What is your view on conversions which add cv-qualification?
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk