Boost logo

Boost :

Subject: Re: [boost] [variant] Please vote for behavior (Was: Basic rvalue and C++11 features seupport)
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-01-21 14:37:55


On January 21, 2013 11:27:36 PM Sergey Cheban <s.cheban_at_[hidden]> wrote:
>
> > II: Set operand.p_ to NULL, add BOOST_ASSERT in get operations
> > + good performance
> > + provides noexcept guarantee for move constructor
> > + optimization will be used even if varinat has no type with trivial
> > default constructor
> > + easy to implement
> > - triggers an assert when user tries to reuse moved object
> > - adds an empty state to the recursive_wrapper
> Let's think about non-recursive variants. For example:
>
> // both CFileObj and CDatabaseObj are movable, not copyable and
> // not nothrow-default-constructible
> boost::variant< CFileObj, CDatabaseObj > v1( CFileObj(SomeFileName) );
> boost::variant< CFileObj, CDatabaseObj > v2( std::move( v1 ) );
>
> // What would be the state of v1 at this point?

Moved-from CFileObj, I presume.


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