[smart_ptr] Migrating from boost::shared_ptr<> to std::shared_ptr<>
Hi, 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) - is there a way to easily convert one to another - what are (if any) differences between std and boost versions Regards, Szymon Gatner
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-t...
- 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-bett...
participants (2)
-
Igor R
-
Szymon Gatner