Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-09-05 14:20:41

Stephan Tolksdorf wrote:
> Hi
> why doesn't shared_array allow the same conversions as shared_ptr, so
> that
> boost::shared_ptr<int> ip;
> boost::shared_ptr<const int> ip2(ip);
> is allowed, but not
> boost::shared_array<int> ip;
> boost::shared_array<const int> ip2(ip);

shared_array doesn't support conversions since shared_array<Derived> should
not be convertible to shared_array<Base>, even though Derived* is
convertible to Base*. We might be able to add the limited cv-conversions
using enable_if tricks.

> Is it safe to use shared_ptr's with arrays if one supplies an array
> deleter as a constructor argument?

Yes, it is safe, but the above caveat still applies.

Boost list run by bdawes at, gregod at, cpdaniel at, john at