
22 Jun
2012
22 Jun
'12
5:03 p.m.
On 21 June 2012 19:06, Dave Abrahams <dave@boostpro.com> 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@eviloverlord.com> (847) 691-1404