|
Boost : |
Subject: Re: [boost] [utility] auto_buffer v2
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-03-05 11:26:03
Matt Calabrese skrev:
> On Thu, Mar 5, 2009 at 3:56 AM, Thorsten Ottosen <
> thorsten.ottosen_at_[hidden]> wrote:
>
>> As one can see from my code, swap and copy-operations are difficult to
>> implement. Especially swap. Therefore such an allocator will be *very*
>> difficult to use correctly in a container. In particular, swap() sometimes
>> only gives the basic guarantee (and no better guarantee is possible!).
>>
>
> I haven't given it too much thought, but intuitively (perhaps naively on my
> part), it seems to me like if the types you are instantiating the template
> with have no-throw copy/copy-assign/swap operations you could satisfy the
> strong guarantee for the associated auto_buffer operations regardless of if
> neither, one, or both operands store their data in a separate allocation.
swap(), for example, already has the nothrow guarantee under your
constraints above.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk