Boost C++ Libraries: Ticket #105: Why noncopyable destructor isn't virtual https://svn.boost.org/trac10/ticket/105 <pre class="wiki">Rule 14 in "Effective C++ 2/e": "Make sure base classes have virtual destructors." But why base class noncopyable doesn't have ? </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/105 Trac 1.4.3 nobody Tue, 25 May 2004 02:56:17 GMT <link>https://svn.boost.org/trac10/ticket/105#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/105#comment:1</guid> <description> <pre class="wiki">Logged In: NO Does anybody want to have pointers of noncopyable? </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>rzymek</dc:creator> <pubDate>Thu, 12 May 2005 19:39:27 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/105#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/105#comment:2</guid> <description> <pre class="wiki">Logged In: YES user_id=419557 This would be a problem if you used it like this: class A : private boost::noncopyable { /* ... */ }; noncopyable* a = new A; delete a; But noncopyable isn't supposed to be used this way. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>rzymek</dc:creator> <pubDate>Thu, 12 May 2005 19:39:38 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/105#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/105#comment:3</guid> <description> <pre class="wiki">Logged In: YES user_id=419557 This would be a problem if you used it like this: class A : private boost::noncopyable { /* ... */ }; noncopyable* a = new A; delete a; But noncopyable isn't supposed to be used this way. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>nobody</dc:creator> <pubDate>Sun, 04 Jun 2006 12:42:27 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/105#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/105#comment:4</guid> <description> <pre class="wiki">Logged In: NO one should not use the pointer to a noncopyable object A tyical code should look something like this: class A: private noncopyable { } A* pa = new A(); delete pa; And, the private will make sure that no one can access A through noncopyable interface. So you cannot say: noncopyable* pnc = new A(); it will create an error message like: a.cxx: In function `int main()': a.cxx:11: error: `noncopyable' is an inaccessible base of `A' regards, Sambit </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Dave Abrahams</dc:creator> <pubDate>Fri, 06 Jul 2007 01:23:11 GMT</pubDate> <title>status, reporter, version, resolution, description changed; severity set https://svn.boost.org/trac10/ticket/105#comment:5 https://svn.boost.org/trac10/ticket/105#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>severity</strong> → <span class="trac-field-new">Cosmetic</span> </li> <li><strong>reporter</strong> changed from <span class="trac-author">wusan</span> to <span class="trac-author">wusan@…</span> </li> <li><strong>version</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">release 1.34.0</span> </li> <li><strong>resolution</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">wontfix</span> </li> <li><strong>description</strong> modified (<a href="/trac10/ticket/105?action=diff&amp;version=5">diff</a>) </li> </ul> <p> The answer why not is that it would add needless overhead. </p> Ticket