3

Now with C++11, should we prefer vector<unique_ptr<>> or boost::ptr_vector to store pointer's to objects if we want managed memory?

Cookie
  • 12,004
  • 13
  • 54
  • 83
  • I'd suggest ptr_vector because it's a bit simpler conceptually and probably slightly more efficient. Then again, it all depends on use cases – sehe May 26 '14 at 14:24
  • 3
    This [question](http://stackoverflow.com/q/9469968/1053968) covers some of the differences between the two options. – Tanner Sansbury May 26 '14 at 14:29

1 Answers1

2

I would suggest vector<unique_ptr<>> as it is supported by compiler. no extra effect. otherwise, boost need your import into your project.

Jerry YY Rain
  • 4,134
  • 7
  • 35
  • 52