Boost logo

Boost :

Subject: Re: [boost] [variant] Basic rvalue and C++11 features support
From: Paul Smith (pl.smith.mail_at_[hidden])
Date: 2013-01-11 10:02:45


On Fri, Jan 11, 2013 at 4:18 PM, Peter Dimov <lists_at_[hidden]> wrote:
> If the variant could be empty, or equivalently, if the variant always
> contained a type that can be reliably default-constructed (without an
> exception) such as int, the problems with assignment (both copy- and move-)
> and with move construction do not occur, because the target can be left
> holding the int.
>
> So, one option is to enable move only in this case.

That's the first constructive solution so far. Something like:

template <typename T>
struct is_legitimate_move_target // specialize me
  : has_trivial_constructor<T> {};

--
Paul Smith

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