Boost logo

Boost :

Subject: Re: [boost] [utility] auto_buffer v2
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-03-08 06:46:04


John Bytheway skrev:
> Thorsten Ottosen wrote:
>> Hereby an updated class. Thanks to all who contributed with comments to
>> the first try.
>
> Thanks for persisting :).

No problem.

>> I have made the following changes:
>>
>> 2. added swap() (boy, was this nasty to implement).
>
> I see what you mean! I hadn't quite understood your implementation; I
> had assumed that you continued to use the stack space when extending to
> the heap. The fact that you don't makes swapping more complex.

Interesting idea. It won't work though, as it breaks T* iterators and a
bunch of other functions in the interface.

> Your current implementation assumes default-constructibility of T (when
> T is not trivially assignable). For example, the following won't compile:

[snip]

> Changes such as the diff below should fix it (I also had to add a couple
> of #includes to make it compile).

Thanks.

-Thorsten


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