Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: TypeErasure
From: Nevin Liber (nevin_at_[hidden])
Date: 2012-06-22 13:03:54


On 21 June 2012 19:06, Dave Abrahams <dave_at_[hidden]> wrote:

>
> >> This is an honest question. I may be a couple steps behind on best
> >> practices of C++. I'd probably give the user of monster an object he
> >> can't move/copy.
>
> Why not give him one he can move, so e.g. he can put it in a vector
> without getting into dynamic allocation?
>

To be fair, most of the other C++11 containers have ways to put elements in
them that don't require moveability/copyability on the element type. For
deque and list, you can use emplace_front or emplace_back, and for the
node-based containers, you can use emplace.

-- 
 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