Subject: Re: [boost] [shared_array] Why not in C++11 ?
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2013-07-08 08:50:50
Jonathan Wakely wrote:
> On 8 July 2013 09:22, Sid Sacek wrote:
>>> If you want a container, use one. Containers with shared storage would be a nice addition
>>> to Boost, IMHO, but these should not abuse shared_ptr interface.
>> According to what you just wrote 'shared_ptr<T>' has already abused 'shared_ptr<>' and
>> all of the array features should be rolled back, or be put into another class altogether.
> I disagree with your implication that shared_ptr<T> abuses anything,
> maybe your view is skewed by thinking it's trying to be something it
> isn't. shared_ptr<T> and shared_ptr<T> are similar to T* pointing
> to a single object, and a T* pointing to an array, with the same
> limitation that the size is not part of the pointer but with the
> advantage that you don't have to remember whether to use delete or
> Now you could argue that using pointers to refer to arrays abuses
> pointers, but that's how C++ works, and it does have many advantages.
And correct me if I'm wrong but as with using operator-> with a pointer
to array, there is also possible to use operator with a pointer to
T *a = new T;
T *v = new T;
Boost's smart pointers implements a reasonable subset of those
operations which reflects:
v->m = 0;
a.m = 0;
There are no additional methods in pointers, indicating the size of
allocated storage. Smart pointers should probably be as close as
possible to the raw ones because they are pointers not containers or
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk