
Matt Calabrese skrev:
On Thu, Mar 5, 2009 at 3:56 AM, Thorsten Ottosen < thorsten.ottosen@dezide.com> 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