Boost logo

Boost :

Subject: Re: [boost] [any] Move semantic
From: Nevin Liber (nevin_at_[hidden])
Date: 2012-05-17 11:26:11


On 17 May 2012 03:33, Klaim - Joël Lamotte <mjklaim_at_[hidden]> wrote:

Third, I want to use boost::any in a value-semantic type. Sometime it would
> keep a unique_ptr.
> If I understand correctly move semantic and unique_ptr implementation, the
> current boost::any implementation don't forbid me to use
> unique_ptr as a value type.
>

It currently forbids you because Copyable is a requirement on the value
type, and is enforced in boost::any::holder<ValueType>::clone. If you want
to hold a move only type, you'll have to have a version of detect it and
throw an exception when copying is attempted.

-- 
 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

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