Subject: Re: [boost] [smart_ptr] scoped_array / shared_array (size_t) constructor
From: Richard Hadsell (hadsell_at_[hidden])
Date: 2011-10-26 17:28:56
On 10/26/2011 05:14 PM, Olaf van der Spek wrote:
> On Wed, Oct 26, 2011 at 11:02 PM, Ivan Sorokin<vanyacpp_at_[hidden]> wrote:
>> Maybe off-topic, but why should one prefer scoped_array to vector? Just
>> curious, I never used it myself.
> Me neither, but scoped_array can take ownership of an existing array.
> And it can be used when construction of elements (like int) is
> unwanted. I expected it to also support release(), but it seems it
It's lightweight -- its memory footprint is only the pointer. It uses reset() instead of release(). It's just the same as a simple array, but it will always be deleted.
The extra features of std::vector (appending, inserting, removing elements; iterators; size; etc.) make it nothing like scoped_array.
-- Dick Hadsell 203-992-6320 Fax: 203-992-6001 Reply-to: hadsell_at_[hidden] Blue Sky Studioshttp://www.blueskystudios.com 1 American Lane, Greenwich, CT 06831-2560 Follow Blue Sky Studios on Facebook <http://www.facebook.com/BlueSkyStudios> and Twitter <http://twitter.com/#%21/blueskystudios>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk