Boost C++ Libraries: Ticket #6578: Update noncopyable for C++11 https://svn.boost.org/trac10/ticket/6578 <p> Here's a quick update to <code>boost::noncopyable</code> for C++11, which has added enough primitives to express the concept directly. I tried it out with a copy of GCC 4.6, and have included the patch (with "svn diff --git"). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6578 Trac 1.4.3 Daryle Walker Sat, 18 Feb 2012 20:16:13 GMT attachment set https://svn.boost.org/trac10/ticket/6578 https://svn.boost.org/trac10/ticket/6578 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">noncopyable_cpp11.git.2.diff</span> </li> </ul> <p> Changes for updating noncopyable for Cxx11 </p> Ticket viboes Mon, 04 Feb 2013 22:34:21 GMT owner, status changed https://svn.boost.org/trac10/ticket/6578#comment:1 https://svn.boost.org/trac10/ticket/6578#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">No-Maintainer</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> Ticket viboes Wed, 10 Apr 2013 17:16:36 GMT milestone changed https://svn.boost.org/trac10/ticket/6578#comment:2 https://svn.boost.org/trac10/ticket/6578#comment:2 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.50.0</span> → <span class="trac-field-new">Boost 1.54.0</span> </li> </ul> <p> Committed revision <a class="changeset" href="https://svn.boost.org/trac10/changeset/83833" title="Utility/noncopyable: Make use of =delete #6578.">[83833]</a>. </p> Ticket viboes Sat, 13 Apr 2013 13:49:54 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6578#comment:3 https://svn.boost.org/trac10/ticket/6578#comment:3 <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> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/83869" title="utility/noncopyable : fix #6578.">[83869]</a>) utility/noncopyable : fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6578" title="#6578: Feature Requests: Update noncopyable for C++11 (closed: fixed)">#6578</a>. </p> Ticket Robert Ramey Sun, 10 Nov 2013 21:31:03 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/6578#comment:4 https://svn.boost.org/trac10/ticket/6578#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> Vicente, </p> <p> I'm having a problem with this patch. My gcc 4.53 compiler gives the error message: </p> <p> "noncopayable:: declared with non-public access cannot be defaulted in the class body" </p> <p> Which seems to make some sense to me. My copy of the standard (section 8.4.2) says "If it[the function] is explicitly defaulted on its first declaration, — it shall be public," As usual the standard text is somewhat convoluted, but that what it says to me. I'm not sure why the test passes. The macro name (BOOST_NO_DEFAULTED_FUNCTIONS used to condition this code has been marked as deprecated in favor of a new one (BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) i don't know if that might be related. </p> <p> Robert Ramey </p> Ticket viboes Mon, 11 Nov 2013 11:28:05 GMT <link>https://svn.boost.org/trac10/ticket/6578#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6578#comment:5</guid> <description> <p> I have no access to gcc-4.5.3. Please could you move to the public section and see how it works? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 04 Apr 2015 21:22:30 GMT</pubDate> <title>status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/6578#comment:6 https://svn.boost.org/trac10/ticket/6578#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.54.0</span> → <span class="trac-field-new">Boost 1.58.0</span> </li> </ul> <p> It seems the new code fixes this issue. </p> <pre class="wiki"> class noncopyable { protected: #if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) &amp;&amp; !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS) BOOST_CONSTEXPR noncopyable() = default; ~noncopyable() = default; #else noncopyable() {} ~noncopyable() {} #endif #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) noncopyable( const noncopyable&amp; ) = delete; noncopyable&amp; operator=( const noncopyable&amp; ) = delete; #else private: // emphasize the following members are private noncopyable( const noncopyable&amp; ); noncopyable&amp; operator=( const noncopyable&amp; ); #endif }; </pre> Ticket