
On 1/9/13 11:03 PM, Paul Smith wrote:
On Tue, Jan 8, 2013 at 8:48 PM, Peter Dimov <lists@pdimov.com> wrote:
Paul Smith wrote:
The only way to make everyone happy is to guarantee that a moved-from recursive variant is a valid variant.
Well, the performance hit from `new T` is making a lot of people unhappy, so technically, this is not true. :-)
Unfortunately, that's probably not the worst thing about it. The fact that it can also throw is the one that has the more subtle and far reaching consequences.
And that is utterly disappointing. This "conservative" move makes all proxy-like objects with pointer ownership very inefficient! While we are advocating pass by value! So... can anyone finally give a good definition of what "valid" means? Nevin gives a compelling counter argument with NaN in that a NaN is a valid state for a floating point value yet you can't do any operations on it. I would think that such a state can be acceptable for an already moved-from object. Well, because, it just makes sense! And IMO, it would be foolish to let this optimization opportunity pass. Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com