From: SG <s.gesem...@gmail.com>
Date: Sun, 15 Apr 2012 12:37:29 -0700 (PDT)
Local: Sun, Apr 15 2012 3:37 pm
Subject: Re: Different syntax for shared arrays between unique_ptr and shared_ptr
On 15 Apr., 08:29, Edward Diener wrote:
> As I understand it specifying a non-shared array with unique_ptr isThe short and easy answer: because nobody proposed to add a T
> done using the syntax:
> std::unique_ptr<T> up(new T[n]);
> The unique_ptr has a partial specialization to handle this.
> The syntax for handling shared arrays with shared_ptr is different:
> std::shared_ptr<T> sp(new T[n],std::default_delete<T>());
> Why is the syntax for working with arrays in unique_ptr and shared_ptr
specialization to shared_ptr (not to my knowledge).
I just want to point out that shared_ptr needs more book keeping
auto sv = make_shared<vector<T>>(n);
on any decent implementation that would allocate the sizeof(vector<T>)
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.