Boost logo

Boost :

Subject: Re: [boost] RFC: A better shared_array
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-10-19 14:18:38


On Wed, Oct 19, 2011 at 8:00 PM, Rhys Ulerich <rhys.ulerich_at_[hidden]> wrote:
>>>>> The current shared_array doesn't keep track of size. This greatly
>>>>> decreases it's usefulness. So I wrote a variant that does:
>>>>> http://pastebin.com/wkdLVqM1
>
>> If one thinks of the class as a resource-owning iterator_range, I
>> think a three member (shared_ptr/iterator_range) implementation gives
>> more flexibility (e.g. sub range instances could track resource
>> ownership against the same shared_ptr).
>
> I extended the spirit of Olaf's shared_array2 implementation quite a
> bit so that it really is a smart resource-managing iterator_range
> called shared_range.  The implementation (with documentation) and

Hmm, I thought mine was really smart already. :p
Where did the (size_t) and (..., shared_ptr<void>) constructors go?

> tests are up at https://github.com/RhysU/shared_range.  I've opted to
> move resource allocating operation's like Olaf's shared_array2(size_t)
> constructor into free functions in the spirit of make_shared and
> allocate_shared.

Ah. Why? shared_array<char> v(10) (like vector) would be neater.

> Olaf, I've added your name to the implementation header in
> shared_range.hpp.  Please let me know if that's not okay with you.

That's fine.

> typedef T element_type;
> advance_begin()

Doesn't iterator_range take care of that?
Where did data() go?

Olaf

-- 
Olaf

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