8 Jul
2013
8 Jul
'13
6:01 a.m.
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