Boost logo

Boost :

Subject: Re: [boost] Rationale for shared_ptr/array including both ptr to control and ptr to data in class
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2011-09-26 22:26:01


> > From: Olaf van der Spek
> > Not having size() and others like begin, end, etc, is a serious
> > drawback IMO.
>
> Then why not simply use either shared_ptr<array<T, N>> or
> shared_ptr<vector<T>>?
>
> Best regards,
> Robert

shared_ptr<array<T, N>> limits you to cases where you know
the size of the array at compile time

shared_ptr<vector<T>> results in two dynamic allocations: one
for the vector object itself, and one for its internal array

Regards,
Nate
                                               


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