Boost logo

Boost :

Subject: Re: [boost] [utility] new auto_buffer class --- RFC
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-03-15 06:15:13

Scott McMurray skrev:
> On Sat, Mar 14, 2009 at 04:47, Thorsten Ottosen
> <thorsten.ottosen_at_[hidden]> wrote:
>> David Abrahams skrev:
>>> A class that attempts to provide value semantics but doesn't support x = x
>>> is putting a big hole in the system of equational reasoning. Justifying
>>> that (to me) would take some pretty heavy proof.
>> I have not really seen code that exhibits x = x. I've seen lot's of
>> discussion (e.g. Sutter & Meyers). Does anybody write such code?
> On purpose? Doubtful. Does it happen? Probably.
> Is there really a cost to allowing it, though? I'd assume it would
> have a vector-like operator= that'd be something like this:
> copy(other.begin(), other.begin() + size(), begin());
> if (size() > other.size()) erase(begin()+other.size(), end());
> else insert(end(), other.begin()+size(), other.end());

That is not quite how I implemented it, but for operator= the extra
check is not that important, so I can add it,


Boost list run by bdawes at, gregod at, cpdaniel at, john at