Subject: Re: [boost] [variant] Basic rvalue and C++11 features support
From: Joel de Guzman (djowel_at_[hidden])
Date: 2013-01-11 01:17:57
On 1/11/13 2:00 PM, Larry Evans wrote:
> On 01/10/13 21:38, Rob Stewart wrote:
>> On Jan 10, 2013, at 6:29 PM, Joel de Guzman <djowel_at_[hidden]> wrote:
>>> On 1/9/13 11:03 PM, Paul Smith wrote:
>>>> On Tue, Jan 8, 2013 at 8:48 PM, Peter Dimov <lists_at_[hidden]> 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?
>> Validity depends upon the class in question. A smart pointer can be
>> null and still valid. In your case, the class has the semantics that
>> it always references a value. Changing that, to permit a null state,
>> may be acceptable or it may have unacceptable side effects. Perhaps
>> a new type, with the null state, can be added and used in some of
>> the current contexts.
> The "truly tagged" variant here:
> has such a null state. When constructed with no arguments, it's in
> this null state. It's "truly tagged" because there can be duplicate
> bounded types distinguished only by the tag value. IOW, although:
Larry, sorry, but that's irrelevant. We are talking about recursive_wrapper
here, not variant.
-- Joel de Guzman http://www.boostpro.com http://boost-spirit.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk