|
Boost : |
Subject: Re: [boost] [variant] Please vote for behavior (Was: Basic rvalue and C++11 features seupport)
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2013-01-21 16:17:47
On Mon, Jan 21, 2013 at 5:39 AM, Antony Polukhin <antoshkka_at_[hidden]>wrote:
> Current implementation of recursive_wrapper move constructor is not
> optimal:
>
> recursive_wrapper<T>::recursive_wrapper(recursive_wrapper&& operand)
> : p_(new T(std::move(operand.get()) ))
> { }
>
> During descussion were made following proposals:
>
> I: Leave it as is
>
[...]
> II: Set operand.p_ to NULL, add BOOST_ASSERT in get operations
>
[...]
> III: Make recursive_wrapper and variant cooperate, enable move for
> varinat in the presence of recursive_wrappers only when there is at
> least one type that is nothrow-default-constructible, regardless of
> whether it's current.
[...]
> IV: After move away, delay construction of type held by
> recursive_wrapper till it will be be required.
>
[...]
> Please, vote for solution or propose a better one.
>
IMHO, III is the only strictly correct solution, given variant's present
never-empty guarantee (which the original author deemed pretty important,
given the amount of documentation dedicated to it).
Aside: recursive_wrapper is only used within the context of a variant,
right?
- Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk