Boost C++ Libraries: Ticket #11672: Thread: Should use unique_ptr, not auto_ptr https://svn.boost.org/trac10/ticket/11672 <p> Boost.Thread has two occurrences of <code>auto_ptr</code>, which is deprecated since C++11: </p> <pre class="wiki">$ grep -rn 'auto_ptr' include/boost/thread/detail/thread_group.hpp:78: std::auto_ptr&lt;thread&gt; new_thread(new thread(threadfunc)); src/win32/thread.cpp:156: std::auto_ptr&lt; ThreadProxyData&gt; data(reinterpret_cast&lt; ThreadProxyData*&gt;(args)); </pre><p> 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". </p> <p> I can see the following ways to resolve the warning: </p> <ul><li>Literally silence the warning, like in <a class="new ticket" href="https://svn.boost.org/trac10/ticket/11622" title="#11622: Bugs: std::auto_ptr is deprecated (new)">#11622</a>. I view this as a very bad idea. </li><li>Use <code>std::unique_ptr</code> if using C++11 or newer. I view this as a bad idea. </li><li>Use <code>boost::movelib::unique_ptr</code>. I view this as a good idea. </li></ul><p> I checked both occurrences of <code>auto_ptr</code> by hand, and found that in both cases, std::unique_ptr can be used just as well! (In both cases, <code>auto_ptr</code> is only used to guarantee a call to <code>delete</code> in case anything throws.) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11672 Trac 1.4.3 Ben Wiederhake <Ben.Wiederhake@…> Sat, 19 Sep 2015 16:26:27 GMT <link>https://svn.boost.org/trac10/ticket/11672#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11672#comment:1</guid> <description> <p> Created fix and submitted as PR: <a class="ext-link" href="https://github.com/boostorg/thread/pull/66"><span class="icon">​</span>https://github.com/boostorg/thread/pull/66</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 19 Sep 2015 17:58:14 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/11672#comment:2 https://svn.boost.org/trac10/ticket/11672#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> thanks for the PR. </p> Ticket viboes Sat, 19 Sep 2015 18:00:34 GMT milestone changed https://svn.boost.org/trac10/ticket/11672#comment:3 https://svn.boost.org/trac10/ticket/11672#comment:3 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.60.0</span> </li> </ul> <p> <a class="ext-link" href="https://github.com/boostorg/thread/commit/2af9c7b98e4283699d10d4da71a6a4c4c093c357"><span class="icon">​</span>https://github.com/boostorg/thread/commit/2af9c7b98e4283699d10d4da71a6a4c4c093c357</a> </p> Ticket viboes Sun, 27 Sep 2015 13:42:46 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11672#comment:4 https://svn.boost.org/trac10/ticket/11672#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <blockquote> <p> <a class="ext-link" href="https://github.com/boostorg/thread/commit/730cb550e6d969520c3f39e0ddf5d80351bddf3a"><span class="icon">​</span>https://github.com/boostorg/thread/commit/730cb550e6d969520c3f39e0ddf5d80351bddf3a</a> </p> </blockquote> Ticket