Subject: Re: [boost] [utility] new auto_buffer class --- RFC
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-03-15 15:19:51
On Sun, Mar 15, 2009 at 14:34, Thorsten Ottosen
> Scott McMurray skrev:
>> I agree that self-assignment is uncommon enough for an explicit check
>> to be a pessimization, though. Â Is the algorithm you have ( the
>> attachment to the first post in this thread doesn't have operator= )
>> really more efficient than one that doesn't need the explicit check?
> Here's the current version. I guess I would have to do some test to make
> 100% sure it's faster.
I would be interested to see if the manual inlining (essentially)
really does make a noticeable speedup. For small n it wouldn't
surprise me if it did, though.
The important part, though, is that what you have should work just
fine for self-assignment. diff will be 0, so you go into the first
if, pop_back nothing, and then copy over it with itself. So I think
you actually wrote a self-assignment-safe version without realizing
P.S. What kind of exception-throwing limitations are you assuming?
That (*this).~auto_buffer(); is scary, especially when you don't yet
have the replacement memory initialized...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk