
5 Nov
2012
5 Nov
'12
1:37 p.m.
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].