Boost logo

Boost :

Subject: [boost] shared_ptr<X[5]>
From: Peter Dimov (lists_at_[hidden])
Date: 2012-11-05 08:37:40

Now that we (are going to) have shared_ptr<X[]>, what should
shared_ptr<X[5]> do?

>From user point of view, it seems obvious that this is as good a pointer to
an array as shared_ptr<X[]> is, so it should behave similarly, having op[]
and an element_type of X.

>From a generic point of view, this could potentially break code that assumes
that shared_ptr<T>::get() always returns a T*, even when T is X[5]. But how
common is such a scenario?

On the other hand, it will actually _fix_ generic code of the form

    shared_ptr<T> p( new T );

when T is X[5].

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