[Boost-bugs] [Boost C++ Libraries] #11672: Thread: Should use unique_ptr, not auto_ptr

Subject: [Boost-bugs] [Boost C++ Libraries] #11672: Thread: Should use unique_ptr, not auto_ptr
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-19 12:59:56


#11672: Thread: Should use unique_ptr, not auto_ptr
-----------------------------------------------+----------------------
 Reporter: Ben Wiederhake <Ben.Wiederhake@…> | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.59.0 | Severity: Problem
 Keywords: auto_ptr |
-----------------------------------------------+----------------------
 Boost.Thread has two occurrences of `auto_ptr`, which is deprecated since
 C++11:

 {{{
 $ grep -rn 'auto_ptr'
 include/boost/thread/detail/thread_group.hpp:78:
   std::auto_ptr<thread> new_thread(new thread(threadfunc));
 src/win32/thread.cpp:156:
   std::auto_ptr< ThreadProxyData> data(reinterpret_cast<
 ThreadProxyData*>(args));
 }}}

 This causes a warning when compiling with gcc-5.2, and soon other
 compilers as they become compliant with the clause "std::auto_ptr is
 deprecated".

 I can see the following ways to resolve the warning:

 - Literally silence the warning, like in #11622. I view this as a very bad
 idea.
 - Use `std::unique_ptr` if using C++11 or newer. I view this as a bad
 idea.
 - Use `boost::movelib::unique_ptr`. I view this as a good idea.

 I checked both occurrences of `auto_ptr` by hand, and found that in both
 cases, std::unique_ptr can be used just as well! (In both cases,
 `auto_ptr` is only used to guarantee a call to `delete` in case anything
 throws.)

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11672>
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:19 UTC