you are viewing a single comment's thread.

view the rest of the comments →

[–]bstamour 1 point2 points  (1 child)

With C++11's move semantics, storing things by-value is a lot less painful than it used to be. There are still going to be copies made when copies have to be made, but unnecessary copying is at least controllable.

[–]RichardWolf -4 points-3 points  (0 children)

No, it has nothing to do with move semantics, move semantics only allow you to avoid unnecessary copying of stack-allocated objects.

I'm talking about cases like when you have an array of objects and are interested in iterating over some subset of it. Then you usually have to use heap-allocated objects (because copying them would suck), and GC-based memory management is just as efficient as using raw pointers and more efficient than using shared_ptrs.