[Boost-bugs] [Boost C++ Libraries] #11259: boost::movelib::unique_ptr is not convertible to boost::shared_ptr

Subject: [Boost-bugs] [Boost C++ Libraries] #11259: boost::movelib::unique_ptr is not convertible to boost::shared_ptr
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-04-30 18:18:42


#11259: boost::movelib::unique_ptr is not convertible to boost::shared_ptr
------------------------------------------+-----------------------
 Reporter: Tavian Barnes <tavianator@…> | Owner: pdimov
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: smart_ptr
  Version: Boost 1.58.0 | Severity: Problem
 Keywords: |
------------------------------------------+-----------------------
 I'm working on porting some code to a platform without a C++11 standard
 library, and wanted to use the Boost versions of shared_ptr and
 unique_ptr. Unfortunately code like this doesn't work:

 {{{
 namespace mystd {
     using boost::shared_ptr;
     using boost::make_shared;

     using boost::movelib::unique_ptr;
     using boost::movelib::make_unique;
 }

 mystd::unique_ptr<int> load_thing() {
     return mystd::make_unique<int>(1);
 }

 mystd::shared_ptr<int> get_thing() {
     return load_thing();
 }
 }}}

 because there is no conversion from movelib::unique_ptr to shared_ptr.

 I'm happy to submit a patch that adds it but I'm not sure whether it's
 okay to add a Boost.Move dependency to Boost.SmartPtr. And if I do that,
 should I also add move emulation to boost::shared_ptr? C++03 users might
 like the performance benefit of moving them instead of copying them.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11259>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC