Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2008-07-07 10:24:30


on Mon Jul 07 2008, Joel de Guzman <joel-AT-boost-consulting.com> wrote:

> Oliver Mueller wrote:
>> hello,
>> at the last boostcon i had the chance to be introduced to fusion by
>> dan and joel. i appreciate the idea of fusion a lot and the library
>> amazingly detailed. since we have already had great exposure to the
>> mpl the fusion concepts present ample opportunity for new ideas.
>> still, some little things sometimes make it hard for me to keep
>> rolling with fusion:
>>
>> i need to have a vector/list of non-copy-constructible types. using
>> e.g. a standard fusion::vector that does not seem to be possible since
>> objects are constructed first, then copied. of course, i could provide
>> a public copy-constructor but that would in other places remove the
>> compiler enforced contract that those objects are not copied under any
>> circumstances.
>> i also cannot think of a good reason why it is nesseccary to copy in that case.
>> so is there a way of having a fusion sequence that does work on
>> non-copy-constructible types?
>
> Hmm... well...
> a) How do you put a noncopyable object in a container?

Direct in-place construction. I think in C++0x it's called "emplace."

> b) How do you copy a container with noncopyable elements?

Ya don't.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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