Boost logo

Boost :

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


On Jan 23, 2004, at 7:21 PM, Jonathan Turkanis wrote:

> Unfortunately, is_array and remove_bounds don't seem to work on array
> types of unknown bounds, so I don't think the above will work as is.

That sounds like a bug in is_array and remove_bounds.

> Also, I'm a little nervous about relying on is_convertible, because of
> problems like:
>
> is_convertible<noncopyable,noncopyable>

<nod> has me worried too. This is a bigger problem than just move_ptr.
  It is effecting other projects too. I'm not sure of the answer.

> I'm pretty sure is_array_convertible can be implemented, though.

Can do! :-)

>> As long as we're on the subject, make sure you restrict
> move_ptr<U[]>
>> conversions to move_ptr<T>, even if is_convertible<U*, T*>:
>>
>> move_ptr<int> p(move_ptr<int[]>()); // should not compile
>>
>
> I've already taken care of this (I think.)

Great! And I should've mentioned the op= too:

struct B {};
struct D : B {};

move_ptr<D> p;
...
p = move_ptr<D[]>(); // should fail to compile
...
move_ptr<const B[]> pc;
pc = move_ptr<B[]>(); // ok
pc = move_ptr<D[]>(); // fail
pc = move_ptr<B>(); // fail
pc = move_ptr<D>(); // fail

-Howard


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