Boost logo

Boost Users :

Subject: Re: [Boost-users] [smart_ptr] Migrating from boost::shared_ptr<> to std::shared_ptr<>
From: Igor R (boost.lists_at_[hidden])
Date: 2013-05-18 17:00:19


> with recently acquired (semi) C++11 compiler (YEY!) I started to think which
> of BOOST functionality could be replaced by standard counterparts. First
> obvious candidates are smart pointers.
>
> Thing is, there is lots of functions that take boost::shared_ptr<> as
> arguments (or return them) and it is just not easy to do do. My questions:
>
> - does it even make sense to switch to std::shared_ptr<> (should new
> functions use std instead of boost)

If some (interface) functions use the std version and some other - the
boost one, it'd worsen the interoperability.

> - is there a way to easily convert one to another

See the following:
http://stackoverflow.com/questions/6326757/conversion-from-boostshared-ptr-to-stdshared-ptr

> - what are (if any) differences between std and boost versions

In theory, there shouldn't be any difference. In practice, it depends
on the implementation you've got, eg. tr1::shared_ptr in MSCV9 was
quite buggy.
Some std::make_shared implementations may have better performance,
than boost::make_shared:
http://stackoverflow.com/questions/12932348/why-stdmake-shared-has-much-better-performance-than-boostmake-shared


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net