Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2004-01-23 17:29:37


On Jan 23, 2004, at 4:57 PM, Peter Dimov wrote:

>> I see no problem with:
>>
>> move_ptr<T> p;
>> move_ptr<const T> pc(move(p));
>>
>> but not vice-versa (just like raw pointers).
>
> The question is, I suspect, about the array case:
>
> move_ptr<T[]> p;
> move_ptr<T const []> pc( move(p) );
>
> since the one above is already covered by the "usual" converting
> constructor.

<nod>

#include <iostream>

struct B
{
        virtual ~B() {std::cout << "~B()\n";}
};

struct D
        : B
{
        virtual ~D() {std::cout << "~D()\n";}
};

int main()
{
        D* dp = new D[3];
        const D* dpc = dp;
        delete [] dpc;
}

I'm not seeing any problems. But if there are any, it wouldn't be the
first time I've missed something important.

-Howard


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