Boost logo

Boost :

Subject: Re: [boost] [shared_array] Why not in C++11 ?
From: Sid Sacek (ssacek_at_[hidden])
Date: 2013-07-08 02:01:17


Andrey Semashev wrote:

> > Why not simply use vector or shared_ptr< vector<...> >?
>
>...or even shared_ptr< array<...> >?

vector<> v is not shared

shared_ptr< vector<> > spv has strange syntax ( *spv )[ 123 ] = blah;

shared_ptr< array< 44 > > spa has a fixed size and also strange syntax ( *spa )[ 123 ] = blah;

Now watch this:

        int my_buffer_size = 1234;

        auto buffer = boost::make_shared< unsigned char[] >( my_buffer_size );

        buffer[ index ] = something;

        int cap = buffer.capacity();

Doesn't that feel the most natural ?
-Sid


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