[ptr container] up to date?
Hello, I am considering putting Boost Pointer Container to use in an application to help with, among other things, the polymorphic slicing issue. I've got a domain model which potentially has exactly that creeping in, vector of shared_ptr to base class, with heterogeneous vector composition. http://www.boost.org/doc/libs/1_55_0/libs/ptr_container/doc/ptr_container.ht... I was reading a lot of references to std::auto_ptr, which is a deprecated feature these days (http://www.cplusplus.com/reference/memory/auto_ptr/). Also the last update was in 2007 or thereabouts. Is this up to date with current language features such as std's?, i.e. std::unique_ptr, std::shared_ptr? Just generally, this is a fitness for use query. Thank you... Best regards, Michael Powell
On 22-07-2014 15:37, Michael Powell wrote:
Hello,
The slicing issue is easily prevented by deriving from boost::noncopyable.
(http://www.cplusplus.com/reference/memory/auto_ptr/). Also the last update was in 2007 or thereabouts. Is this up to date with current language features such as std's?, i.e. std::unique_ptr, std::shared_ptr?
The library has not been updated for C++11 features. The two major things here would to use std::unique_ptr as ptr_container::auto_type and to enable move-semantics. You can however, easily derive from one of the containers and add move-semantics to you own container type if that feature is essential. ptr_container::release() works as a poor man's move-semantics for C++03. shared_ptr is not use by the library. -Thorsten
participants (2)
-
Michael Powell
-
Thorsten Ottosen