Boost logo

Boost :

Subject: Re: [boost] unique_ptr for C++03
From: Andrew Ho (helloworld922_at_[hidden])
Date: 2013-08-04 01:02:27


> Looking at "unique_ptr/boost/default_delete.hpp" as of SHA
6d294095747525ddb3a7481e374642156f5825ec:
>
> * If you're in an environment where the workaround for C++11 smart
pointers are in play, then you probably
> don't have sibling-constructor (delegating) calls either.

Oops, I removed the delegated constructor calls and used a call to a
function which may not exist if the type is not convertible. However, the
compiler error message this generates is less intuitive than usually (which
is saying something for template compiler messages :P).

>
> * When pointers are used for array new-ing, then cross-version conversions
probably shouldn't be done,
> since U IS-A T doesn't mean that array-of-U IS-A array-of-T. (The spacing
won't work right if the sizes of U
> and T differ. Neither will deletes unless a properly set custom deleter
is used.)
>

I made the change such that U[] must be convertible to T[], though I'm not
entirely sure this is the best solution.

Is there any case where U[] is convertible to T[] where U != T? If this is
the case I think the templated "copy" constructor could be removed
completely for the array partial specialization.

Check SHA 3f66052d35ce80c8df0abeb4a9b265e555de8f7f for patched
default_delete.hpp

thanks for the comments/suggestions.


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