Boost logo

Boost :

Subject: Re: [boost] [variant] Basic rvalue and C++11 features support
From: Michael Caisse (mcaisse-lists_at_[hidden])
Date: 2013-01-07 22:41:37


On 01/05/2013 05:40 PM, Joel de Guzman wrote:
> Hi,
>
> I just looked at the current state of variant and noticed that the
> implementation
> of recursive_variant's move ctor seems to be not as optimal as I hoped. The
> current implementation as written is:
>
> recursive_wrapper<T>::recursive_wrapper(recursive_wrapper&& operand)
> : p_(new T( detail::variant::move(operand.get()) ))
> {
> }
>
> Unless I am mistaken, I think the heap allocation is not needed
> and the target should simply grab the pointer and mark the source
> pointer as 0 (with additional checks for 0 in the dtor):
>

<snip>

>
> Thoughts? I can commit this patch if it is acceptable.
>
> Regards,

Hi Joel -

I think the patch looks good and I would be extremely happy to see it
adopted. I have several libraries that are heavy users of
recursive_wrapper and would benefit from this change.

Does variant have an active maintainer?

michael

-- 
Michael Caisse
ciere consulting
ciere.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk