Subject: Re: [boost] [variant] Basic rvalue and C++11 features support
From: Paul Smith (pl.smith.mail_at_[hidden])
Date: 2013-01-11 12:15:58
On Fri, Jan 11, 2013 at 6:35 PM, Peter Dimov <lists_at_[hidden]> wrote:
> Paul Smith wrote:
>> Still, there's no need to supress move construction in the absence of
>> a no-throw default constructible type.
> No, you could still keep the current behavior.
I think this was affirmative, but I'm not sure.
> Incidentally, now that I think of it, the first implementation strategy in
> is possible when the target type has a nothrow move constructor. You could
> move-construct the temporary backup, destroy the target and if the copy
> fails, move-construct it back. So the assignment would go along the
> following lines:
> - if the types are the same, assign
> - if the source type has a nothrow copy* constructor, use it
> - if the target type has a nothrow move constructor, use it
> - if there is a nothrow-default-constructible type, use it
> - otherwise, do the heap backup thing
On a similar note, we should probably use a nothrow default
constructible type when move constructing a variant for any type with
a throwing move-ctor, not just recursive_wrapper.
-- Paul Smith
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk