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:39:36

On Fri, Jan 11, 2013 at 5:22 PM, Peter Dimov <lists_at_[hidden]> wrote:
> Paul Smith wrote:
>> That's the first constructive solution so far. Something like:
>> template <typename T>
>> struct is_legitimate_move_target // specialize me
>> : has_trivial_constructor<T> {};
> has_nothrow_default_constructor is enough. There's no need to introduce a
> separate trait.
> Read
> people. It's all explained there.

Even though it's called the "never-empty guarantee", I always thought
that variant actually provides a strong exception guarantee (i.e. the
variant is not just left unempty, but specifically in the previous
state) so it's not directly relevant. Am I wrong?

Anyway, there's no need to outright disallow move in any case. The
goal is simply to find a good move target. Automatically assuming that
a non-throwing default constructor is a good move target is a
heuristic. A good one, but still a heuristic. A trivial default
constructor looks like the most sensible default. If the user thinks
otherwise, let him specialize the move-oriented trait.

Paul Smith

Boost list run by bdawes at, gregod at, cpdaniel at, john at